コード例 #1
0
ファイル: CommentControl.php プロジェクト: blitzik/CMS
 public function handleRemove()
 {
     $this->userPermissionCheck('remove');
     try {
         $this->commentFacade->remove($this->comment);
     } catch (ActionFailedException $e) {
         $this->refresh('page.comments.actions.remove.messages.error', FlashMessage::ERROR);
     }
     $this->onSuccessCommentRemoval($this->comment);
     $this->redirect('this#comments');
 }
コード例 #2
0
ファイル: CommentsControl.php プロジェクト: blitzik/CMS
 public function processForm(Form $form, $values)
 {
     if ($this->page->getAllowedComments() === false and !$this->authorizator->isAllowed($this->user, 'page_comment_form', 'comment_on_closed')) {
         $this->flashMessage('page.comments.form.messages.closedComments', FlashMessage::WARNING);
         $this->redirect('this#comments');
     }
     $values['page'] = $this->page;
     try {
         $comment = $this->commentFacade->save((array) $values);
         $this->flashMessage('page.comments.form.messages.success', FlashMessage::SUCCESS);
         $this->redirect('this#comment-' . $comment->getId());
     } catch (ActionFailedException $e) {
         $form->addError($this->translator->translate('page.comments.form.messages.error'));
     }
 }
コード例 #3
0
 /**
  * @param $commentId
  * @return Comment|null
  */
 private function getComment($commentId)
 {
     return $this->commentFacade->fetchComment((new CommentQuery())->byId($commentId)->byPage($this->page)->indexedById());
 }