예제 #1
0
 public function detailsAction()
 {
     if ($datas = $this->getRequest()->getParams()) {
         try {
             if (empty($datas['comment_id']) or empty($datas['option_value_id'])) {
                 throw new Exception($this->_('An error occurred during process. Please try again later.'));
             }
             $comment_id = $datas['comment_id'];
             $comment = new Comment_Model_Comment();
             if ($comment_id != 'new') {
                 $comment->find($comment_id);
                 if (!$comment->getId() or $comment->getValueId() != $this->getCurrentOptionValue()->getId()) {
                     throw new Exception($this->_('An error occurred during process. Please try again later.'));
                 }
             } else {
                 $comment->setId($comment_id);
             }
             $html = $this->getLayout()->addPartial('view_details', 'core_view_mobile_default', "comment/l{$this->_layout_id}/view/details.phtml")->setCurrentComment($comment)->toHtml();
             $html = array('html' => $html, 'title' => $this->getApplication()->getName());
         } catch (Exception $e) {
             $html = array('error' => 1, 'message' => $e->getMessage());
         }
         $this->_sendHtml($html);
     }
 }
예제 #2
0
 public function editAction()
 {
     if ($this->getCurrentOptionValue()) {
         $comment_id = $this->getRequest()->getPost('comment_id');
         $comment = new Comment_Model_Comment();
         $comment->find($comment_id);
         if ($comment->getId() and $comment->getValueId() == $this->getCurrentOptionValue()->getId()) {
             $html = array('answers_html' => $this->getLayout()->addPartial('content', 'core_view_default', 'comment/application/edit/answers.phtml')->setCurrentComment($comment)->setOptionValue($this->getCurrentOptionValue())->toHtml());
         }
         $this->getLayout()->setHtml(Zend_Json::encode($html));
     }
 }
예제 #3
0
 public function flagcommentAction()
 {
     if ($value_id = $this->getRequest()->getParam('value_id') and $answer_id = $this->getRequest()->getParam('answer_id')) {
         $application = $this->getApplication();
         $answer = new Comment_Model_Answer();
         $answer->find($answer_id);
         $comment = new Comment_Model_Comment();
         $comment->find($answer->getCommentId());
         if ($answer->getId() and $comment->getValueId() == $value_id) {
             $answer->setFlag($answer->getFlag() + 1);
             $answer->save();
             $message = $this->_('Your flag has successfully been notified');
             $html = array('success' => 1, 'message' => $message);
             $this->_sendHtml($html);
         }
     }
 }