Exemple #1
0
 public function statisticsAction()
 {
     $months = Objects::getMonthLongNames();
     $y = $this->params()->fromRoute('year', null);
     $m = $this->params()->fromRoute('month', null);
     $StatisticsForm = new StatisticsForm($months);
     $formTemplate = 'form-templates/search-statistics';
     $viewModelForm = new ViewModel();
     $requestDate = null;
     if (!is_null($y) && !is_null($y)) {
         $requestDate = $y . '_' . $m;
     }
     $viewModelForm->setVariables(['form' => $StatisticsForm, 'requestDate' => $requestDate]);
     $viewModelForm->setTemplate($formTemplate);
     $router = $this->getEvent()->getRouter();
     $ajaxSourceUrl = $router->assemble(['controller' => 'apartment', 'action' => 'get-occupancy-statistics-json'], ['name' => 'occupancy_statistics']);
     $viewModel = new ViewModel(['ajaxSourceUrl' => $ajaxSourceUrl]);
     $viewModel->addChild($viewModelForm, 'formOutput');
     $viewModel->setTemplate('apartment/occupancy-statistics/index');
     return $viewModel;
 }