public function pageFormSucceeded($form, $vals) { try { if (!$this->page) { $this->page = new Entity\Page(); $this->page->date = new \DateTime(); } $this->page->title = $vals->title; $this->page->slug = $vals->slug; $this->page->body = $vals->editor; $this->page->draft = FALSE; $this->pages->save($this->page); $this->presenter->flashMessage('Stránka byla úspěšně uložena a publikována.', 'success'); $this->onSave(); } catch (Kdyby\Doctrine\DuplicateEntryException $exc) { //DBALException $this->presenter->flashMessage('Tento URL slug je již v databázi uložen, zvolte prosím jiný.', 'danger'); } catch (Nette\Security\AuthenticationException $exc) { $this->presenter->flashMessage('Myslím to vážně, editovat opravdu **ne**můžete!', 'danger'); $this->redirect('this'); return; } }