Ejemplo n.º 1
0
 public function comments(Model_CommentCollection $comments)
 {
     $count = count($comments);
     if ($count == 0) {
         return 'Be the first to comment.';
     }
     $service = new Service_Comment();
     $delete_rights = false;
     if ($service->checkAcl('delete')) {
         $delete_rights = true;
     }
     $string = '';
     for ($i = 0; $i < $count; $i++) {
         $comment = $comments->getItem($i);
         if (!$comment->parent_id) {
             $string .= $this->_printComment($comment, false, $delete_rights);
             for ($j = 0; $j < $count; $j++) {
                 $reply = $comments->getItem($j);
                 if ($reply->parent_id == $comment->id) {
                     $string .= $this->_printComment($reply, true, $delete_rights);
                 }
             }
         }
     }
     if ($delete_rights) {
         $string .= $this->view->render('delete-comment-js.phtml');
     }
     return $string;
 }
Ejemplo n.º 2
0
 public function deleteCommentAction()
 {
     $service = new Service_Comment();
     if (!$service->checkAcl('delete')) {
         throw new Keplin_ProhibitedException('Deleting Comments: Access Prohibited.');
     }
     $this->_helper->layout->disableLayout();
     $this->_helper->viewRenderer->setNoRender();
     $service->delete($this->_request->getParam('id'));
 }
Ejemplo n.º 3
0
 public function viewAction()
 {
     $service = new Service_Post();
     $post = $service->getFromTitle($this->_request->getParam('title'));
     $edit_link = $service->getEditLink($post->id);
     $service = new Service_Comment();
     $service->setPost($post);
     $service->attach(new Keplin_Mail_Author());
     $service->attach(new Keplin_Mail_Commenter());
     $service->attach(new Keplin_Mail_Comment());
     if ($data = $this->_request->getPost()) {
         $service->create($data);
     }
     $this->view->post = $post;
     $this->view->message = $service->getMessage();
     $this->view->form = $service->getForm();
     $this->view->edit_link = $edit_link;
 }