コード例 #1
0
 public function renderZobrazit()
 {
     $this->addCss("rezervace_detail.css");
     $id = $this->getParam('id');
     $event = Tables\Event::fetchById($this->pdo, $id);
     if (!$event) {
         $this->message->warning("Událost č. {$id} nebyla nalezena");
         $this->redirectPars('rezervace', 'vypis');
     }
     $this->template['resRend'] = \model\ReservationRenderer::getInstance();
     $this->template['event'] = $event;
     if ($event->hasGameAssigned()) {
         $this->template['game'] = $this->gameTypes->fetchById($event->getGameTypeID());
     }
     $this->template['links'] = ['edit' => ['controller' => 'udalost', 'action' => 'upravit', 'id' => $id], 'delete' => ['controller' => 'udalost', 'action' => 'smazat', 'id' => $id]];
 }
コード例 #2
0
 private function checkBoxBeforeInsert($code, $game_id)
 {
     if (!$this->user->isSupervisor()) {
         return "Nedostatečná uživatelská oprávnění";
     }
     if (strlen($code) < Tables\GameBox::MIN_CODE_LENGTH) {
         return sprintf("Evidenční kód musí být alespoň %d znaků dlouhý.", Tables\GameBox::MIN_CODE_LENGTH);
     }
     $gameBox = Views\GameBoxExtended::fetchByCode($this->pdo, $code);
     if ($gameBox) {
         $response = "Kód {$code} je v databázi již veden, ";
         $response .= $gameBox->retired ? "je však vyřazený z oběhu" : "náleží hře " . $gameBox->game_name;
         return $response;
     }
     $gameType = $this->gameTypes->fetchById($game_id);
     if (!$gameType) {
         return $this->template['response'] = sprintf("Nebyla nalezena hra %03d", $game_id);
     }
     return false;
 }
コード例 #3
0
 public function renderDetailHry()
 {
     $id = $this->getParam("id");
     $gameType = $this->gameTypes->fetchById($id);
     if (!$gameType) {
         $this->message->warning("Požadovaná hra nebyla nalezena.");
         $this->redirectPars('vypis', 'hry');
     }
     $this->addCss("hra.css");
     $this->addJs('odber_prepinac.js');
     $review = Views\GameRatingExtended::fetchOne($this->pdo, $this->user->user_id, $id);
     // @todo: fetch single subscribed game only
     $this->user->setSubscribedItems(Views\Subscription::fetchGamesByUser($this->pdo, $this->user->user_id));
     $this->template['form_action'] = ['controller' => 'vypis', 'action' => 'hodnotit', 'id' => $id];
     $this->template['g'] = $gameType;
     $this->template['ratings'] = $this->buildRatings($id);
     $this->template['rating'] = ['min' => 1, 'def' => 3, 'max' => 5];
     $this->template['highlight'] = $this->getParam("highlight");
     if ($review) {
         $this->template['rating']['def'] = $review->score;
         $this->template['has_review'] = $review->review;
     }
 }
コード例 #4
0
 private function reservationCreatedSendMail($reservation_id)
 {
     $reservation = $this->reservaions->fetchById($reservation_id);
     if (!$reservation) {
         $this->message->warning("Při pokusu o odeslání upozornění hráčům odebírajícím hru " . $reservation->game_name . " nastala chyba.");
         return;
     }
     $gameType = $this->gameTypes->fetchById($reservation->game_type_id);
     $users = Views\Subscription::fetchUsersByGame($this->pdo, $reservation->game_type_id);
     $dateTime = DatetimeManager::reformat($reservation->reservation_date, DatetimeManager::HUMAN_DATE_ONLY);
     $dateTime .= ' ' . DatetimeManager::reformat($reservation->time_from, DatetimeManager::HUMAN_TIME_ONLY);
     $pars = ['gameName' => $gameType->getFullName(), 'reservationDate' => $dateTime, 'reservationUrl' => $this->urlGen->url(['controller' => 'rezervace', 'action' => 'detail', 'id' => $reservation_id])];
     MailBuilder::openReservationCreated($users, $pars);
 }