40 lines
1.4 KiB
PHP
40 lines
1.4 KiB
PHP
<?php
|
|
|
|
namespace lib\Controllers;
|
|
|
|
class DashboardController extends CommonController
|
|
{
|
|
public function __construct()
|
|
{
|
|
parent::__construct();
|
|
} //
|
|
public function mainPage()
|
|
{
|
|
$this->view->types = $this->getServiceModel()->getTypes_Dashboard();
|
|
$site = $this->getSiteInfo();
|
|
$this->view->results = $this->getServiceModel()->getSummary_Dashboard($site['id']);
|
|
|
|
$summary = array();
|
|
foreach ($this->view->types as $type) {
|
|
$summary[$type] = array("Tokyo" => 0, "Chiba" => 0);
|
|
}
|
|
foreach ($this->view->results as $company => $service) {
|
|
$summary[$company] = array("Tokyo" => 0, "Chiba" => 0);
|
|
foreach ($service as $name => $location) {
|
|
$summary[$company]['Tokyo'] += $location['Tokyo'];
|
|
$summary[$name]['Tokyo'] += $location['Tokyo'];
|
|
$summary[$company]['Chiba'] += $location['Chiba'];
|
|
$summary[$name]['Chiba'] += $location['Chiba'];
|
|
}
|
|
}
|
|
$total = array("Tokyo" => 0, "Chiba" => 0);
|
|
foreach ($this->view->types as $type) {
|
|
$total['Tokyo'] += $summary[$type]['Tokyo'];
|
|
$total['Chiba'] += $summary[$type]['Chiba'];
|
|
}
|
|
$this->view->summary = $summary;
|
|
$this->view->total = $total;
|
|
return $this->render('total_counting');
|
|
}
|
|
} //Class
|