/**
  * 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;
 }
 /**
  * Processing of post editing form
  *
  * @Privilege("edit")
  *
  * @param \Nette\Application\UI\Form $form
  */
 public function editSongFormSucceded(\Nette\Application\UI\Form $form)
 {
     $values = $form->getValues(TRUE);
     unset($values['send']);
     $item = $this->loadItem($values['id']);
     if ($item) {
         //do an update
         $item->update($values);
         $this->flashMessage('Píseň byla upravena.');
     } else {
         //do an insert
         $this->songbook->insert($values);
         $this->flashMessage('Píseň byla přidána.');
     }
     $this->redirect('default');
 }