/** * Loads a guestbook post from the database * * @param int $id Songbook ID * @return \Nette\Database\Table\ActiveRow Assossiated post */ protected function loadItem($id) { $item = $this->songbook->get($id); if (!$item) { $this->flashMessage("Vybraný příspěvek neexistuje.", 'error'); $this->redirect('default'); } return $item; }
/** * Checks for the chosen chronicle and displays it if it exists * * @param int $id songbook entry ID * * @Privilege("display") */ public function actionDetail($id) { $template = $this->template; $template->title = "Zpěvník"; $songbook = $this->songbook->get($id); if (!$songbook) { $this->flashMessage('Vybraný zápis neexistuje.'); $this->redirect('Songbook:'); } $template->songbook = $songbook; }