Ejemplo n.º 1
0
 /**
  * Edits the content of a comment
  *
  * @param void
  * @return ViewModel
  * @throws AccessProhibitedException
  **/
 public function editAction()
 {
     $this->_checkAcl('edit');
     $comment = $this->_service->getOne($this->getRequest()->getQuery('id'));
     $form = new CommentForm();
     $form->bind($comment);
     $form->remove('parentId');
     $form->remove('captcha');
     $form->get('comment')->setAttribute('id', 'commentEditor');
     $form->get('comment')->setAttribute('class', 'ckeditor');
     $form->get('submit')->setValue('Save');
     $this->_service->setForm($form);
     if ($this->getRequest()->isPost()) {
         $this->_service->edit($this->getRequest()->getPost());
     }
     return new ViewModel(array('form' => $form, 'messages' => $this->_service->getMessages(CommentService::MSG_NOTICE), 'errors' => $this->_service->getMessages(CommentService::MSG_ERROR)));
 }