Esempio n. 1
0
 public function comment($name)
 {
     $id = explode('-', $name);
     $id = $id[0];
     if (!$this->isLogged()) {
         $this->addPopup('danger', 'Pro přidání komentáře musíte být přihlášeni.');
         redirectTo('/clanek/' . $id);
     }
     $comment = new Comment();
     $comment->setIdUser($_SESSION["user"]->getId());
     $comment->setIdArticle($id);
     $comment->setContent($_POST["comment_text"]);
     $comment->save();
     $this->addPopup('success', 'Váš komentář byl úspěšně přidán.');
     redirectTo('/clanek/' . $id);
 }