public function renderHry() { $this->addCss("hra.css"); $this->addCss('input-specific.css'); $this->addJs('input-specific.js'); $this->template['pageTitle'] = "Správa her"; $this->template['insert_game_form_action'] = ['controller' => 'sprava', 'action' => 'pridatHru']; $this->template['col_game'] = 4; $this->template['game_edit_form_action'] = ['controller' => 'sprava', 'action' => 'upravitHru']; $this->template['mailLink'] = ['controller' => 'sprava', 'action' => 'hromadnyMail', 'id' => 0]; $this->template['img_fileTypes'] = ImageManager::fileTypes(); $this->template['games'] = Views\GameTypeExtended::fetchAllWithCounts($this->pdo); }
/** * * @return Views\GameTypeExtended[] */ private function prepareGames($timePars = []) { $games = Views\GameTypeExtended::fetchAllWithCounts($this->pdo); $date_from = isset($timePars['time_from']) ? $timePars['time_from'] : DatetimeManager::format(strtotime('now'), DatetimeManager::DB_FULL); $date_to = isset($timePars['time_to']) ? $timePars['time_to'] : DatetimeManager::format(strtotime('+ 1 month'), DatetimeManager::DB_FULL); $resCounts = $this->reservaions->countWithin($date_from, $date_to); foreach ($resCounts as $count) { $games[$count['game_type_id']]->reservationCount = $count['count']; } return $games; }