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); } }
public function findallAction() { if ($comment_id = $this->getRequest()->getParam('comment_id')) { $comment = new Comment_Model_Comment(); $comment->find($comment_id); $customer = new Customer_Model_Customer(); $noLogo = $customer->getImageLink(); if ($comment->getId()) { $answer = new Comment_Model_Answer(); $answers = $answer->findByComment($comment->getId()); $data = array(); foreach ($answers as $answer) { $data[] = array("id" => $answer->getId(), "author" => $answer->getCustomerName(), "picture" => $noLogo, "message" => $answer->getText(), "created_at" => $this->_durationSince($answer->getCreatedAt())); } $this->_sendHtml($data); } } }
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)); } }
public function flagpostAction() { if ($value_id = $this->getRequest()->getParam('value_id') and $comment_id = $this->getRequest()->getParam('comment_id')) { $application = $this->getApplication(); $comment = new Comment_Model_Comment(); $comment->find($comment_id); if ($comment->getId() and $comment->getValueId() == $value_id) { $comment->setFlag($comment->getFlag() + 1); $comment->save(); $message = $this->_('Your flag has successfully been notified'); $html = array('success' => 1, 'message' => $message); $this->_sendHtml($html); } } }