示例#1
0
文件: Comment.php 项目: nldfr219/zhi
 public static function getComment($c_id)
 {
     if (!($objects = Obj_Cache::read('comment_' . $c_id))) {
         $tComment = new Table_Comments();
         $comments = $tComment->getComment($c_id);
         Obj_Cache::save('comment_' . $c_id, $comments);
         return $comments;
     }
     return $objects;
 }
示例#2
0
 public function addcommentAction()
 {
     $this->_helper->viewRenderer->setNoRender(true);
     $arResult = array('error' => '');
     if ($comment = $this->getRequest()->getParam('comments', '')) {
         if ($comment == '') {
             return false;
         } else {
             $tComment = new Table_Comments();
             $comment_id = $tComment->createComment($this->user->school_id, $comment);
             if ($comment_id > 0) {
                 $tActivity = new Table_Activities();
                 $tActivity->createActivity($this->user->user_id, 29, $this->user->school_id, $this->user->school_id, $comment_id);
             }
         }
         $tUser = new Table_UsersInfo();
         $creatorid = $this->user->user_id;
         $creator = '<a href="../profile/profile?uid=' . $creatorid . '" >' . $tUser->getUserName($creatorid) . '</a>';
         $arResult['creator'] = $creator;
     } else {
         $arResult['error'] = "Please enter comment";
     }
     $this->_helper->json($arResult, true, false);
 }