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; }
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')); }