예제 #1
0
 /**
  * Save a comment object to the database
  *
  * @param SxCms_Comment $comment
  * @return mixed
  */
 public function save(SxCms_Comment $comment)
 {
     $db = Zend_Registry::get('db');
     $author = $comment->getCommenter();
     $data = array('page_id' => $comment->getPage()->getId(), 'comment' => $comment->getMessage(), 'datePosted' => date('Y-m-d H:i:s'), 'author_name' => $author->getName(), 'author_email' => $author->getEmail(), 'author_link' => $author->getWebsite(), 'approved' => $comment->isApproved(), 'dateApproved' => $comment->getDateApproved());
     if (!$comment->getId()) {
         $result = $db->insert('PageComment', $data);
         $comment->setId($db->lastInsertId());
         return $result;
     }
     return $db->update('PageComment', $data, 'comment_id = ' . $comment->getId());
 }
예제 #2
0
 public function commentDeleteAction()
 {
     SxCms_Acl::requireAcl('news', 'news.comments.delete');
     $comment = new SxCms_Comment();
     $comment->setId($this->_getParam('id'));
     $mapper = new SxCms_Comment_DataMapper();
     $mapper->delete($comment);
     $flashMessenger = $this->_helper->getHelper('FlashMessenger');
     $flashMessenger->addMessage($this->admin_tmx->_('messagedeletedsuccess'));
     $this->_helper->redirector->gotoSimple('comments', 'page');
 }