Esempio n. 1
0
 /**
  * @param $id
  */
 public function handleAllowed($id)
 {
     $comment = $this->commentsRepository->get($id);
     $comment->allowed(!$comment->allowed());
     $this->commentsRepository->save($comment);
     if (!$this->isAjax()) {
         $this->redirect('default');
     }
     $this->redrawControl();
 }
Esempio n. 2
0
 /**
  * @param UI\Form $form
  */
 public function processForm(UI\Form $form)
 {
     $values = $form->getValues();
     $comment = new CommentsEntity();
     $comment->pageId($this->pageId);
     $comment->articleId($this->articleId);
     $comment->author($values->name);
     $comment->text($values->text);
     $comment->date(new DateTime());
     $comment->allowed(0);
     $this->commentsRepository->save($comment);
     $this->flashMessage("Děkujeme za názor. Váš komentář byl odeslán a po schválení bude zobrazen", 'success');
     if (!$this->presenter->isAjax()) {
         $this->redirect('this');
     }
     $this->redrawControl();
 }