コード例 #1
0
ファイル: Comment.php プロジェクト: bklein01/SiberianCMS
 public function getAnswers()
 {
     if (!$this->getId()) {
         return array();
     }
     if (is_null($this->_answers)) {
         $answer = new Comment_Model_Answer();
         $answer->setStatus($this);
         $this->_answers = $answer->findByComment($this->getId(), true);
         foreach ($this->_answers as $answer) {
             $answer->setComment($this);
         }
     }
     return $this->_answers;
 }
コード例 #2
0
 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);
         }
     }
 }