Ejemplo n.º 1
0
 public function getcommentsAction()
 {
     if ($this->getRequest()->isGet()) {
         if ($id = $this->_getParam('id')) {
             $db = new Application_Model_DbTable_Comments();
             $comments = $db->getComments($id);
             $this->view->comments = $comments;
             $out = $this->view->render("comments/getcomments.phtml");
             echo iconv("windows-1251", "UTF-8", $out);
             exit;
         } else {
             echo '';
         }
     }
 }
Ejemplo n.º 2
0
 /**
  * Specifically for Comments actions.
  *
  * @return mixed
  * @throws Exception
  */
 public function commentAction()
 {
     if ($this->getRequest()->isPost()) {
         $comment = $this->getRequest()->getPost('pcomment');
         if ($comment == "Post Comment") {
             $id = (int) $this->getRequest()->getPost('id');
             $user_name = $this->getRequest()->getPost('user_name');
             $description = $this->getRequest()->getPost('description');
             $comments = new Application_Model_DbTable_Comments();
             $comments->addComment($id, $user_name, $description);
             return $this->_helper->redirector('index');
         } else {
             $id = $this->_getParam('id', 0);
             if ($id > 0) {
                 $comments = new Application_Model_DbTable_Comments();
                 $this->view->comment = $comments->getComments($id);
             }
         }
     }
 }