示例#1
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;
     }
 }