Beispiel #1
0
 public function indexAction()
 {
     $this->getLayout()->getHmenu()->add($this->getTranslator()->trans('menuComments'), array('action' => 'index'));
     $commentMapper = new CommentMapper();
     $this->getView()->set('comments', $commentMapper->getComments());
     if ($this->getRequest()->getPost('comment_comment_text')) {
         $commentModel = new CommentModel();
         $commentModel->setKey('article/index/show/id/' . $this->getRequest()->getParam('id_a') . '/id_c/' . $this->getRequest()->getParam('id'));
         $commentModel->setFKId($this->getRequest()->getParam('id'));
         $commentModel->setText($this->getRequest()->getPost('comment_comment_text'));
         $date = new \Ilch\Date();
         $commentModel->setDateCreated($date);
         $commentModel->setUserId($this->getUser()->getId());
         $commentMapper->save($commentModel);
     }
     $comments = $commentMapper->getComments('comment/index/index/id/' . $this->getRequest()->getParam('id'));
     $this->getView()->set('comment_reply', $this->getConfig()->get('comment_reply'));
     $this->getView()->set('comments', $comments);
 }
Beispiel #2
0
 public function indexAction()
 {
     $commentMapper = new CommentMapper();
     $this->getLayout()->getAdminHmenu()->add($this->getTranslator()->trans('menuComments'), array('action' => 'index'));
     if ($this->getRequest()->getPost('action') == 'delete' && $this->getRequest()->getPost('check_comments')) {
         foreach ($this->getRequest()->getPost('check_comments') as $commentId) {
             $commentMapper->delete($commentId);
         }
     }
     $this->getView()->set('comments', $commentMapper->getComments());
     $this->getView()->set('locale', $this->getConfig()->get('locale'));
 }