public function getComment() { if (is_null($this->_comment)) { $comment = new Comment_Model_Comment(); $comment->find($this->getCommentId()); $this->_comment = $comment; } return $this->_comment; }
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 showAction() { $html = ''; if ($id = $this->getRequest()->getParam('id')) { try { $comment = new Comment_Model_Comment(); $comment->find($id)->setisVisible(1)->save(); $html = array('success' => '1', 'success_message' => $this->_('Information successfully shown'), 'message_timeout' => 2, 'message_button' => 0, 'message_loader' => 0); } catch (Exception $e) { $html = array('error' => 1, 'message' => $e->getMessage()); } $this->getLayout()->setHtml(Zend_Json::encode($html)); } }
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); } } }
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 pullmoreAction() { if ($datas = $this->getRequest()->getParams()) { try { $comment = new Comment_Model_Comment(); $comments = $comment->pullMore($datas['option_value_id'], $datas['pos_id'], $datas['from'], 5); $partial_comment = ''; $partial_details = ''; foreach ($comments as $comment) { $partial_comment .= $this->getLayout()->addPartial('comment_' . $comment->getId(), 'core_view_mobile_default', 'comment/l1/view/item.phtml')->setCurrentComment($comment)->toHtml(); $partial_details .= $this->getLayout()->addPartial('comment_details_' . $comment->getId(), 'core_view_mobile_default', 'comment/l1/view/details.phtml')->setCurrentComment($comment)->toHtml(); } $html = array('success' => 1, 'comments' => $partial_comment, 'details' => $partial_details); } catch (Exception $e) { $html = array('error' => 1, 'message' => $e->getMessage()); } $this->_sendHtml($html); } }