dbms_primeidc/extdbms/lib/Controller/Statistics.php
2025-03-20 18:38:28 +09:00

41 lines
1.4 KiB
PHP

<?php
namespace lib\Controller;
use lib\Core\Controller;
class Statistics extends Controller
{
public function __construct()
{
parent::__construct();
} //
public function execute()
{
$this->view->types = $this->getModel("Service")->getTypes_Dashboard();
$this->view->results = $this->getModel("Service")->getSummary_Dashboard($this->getSite()['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