コード例 #1
0
 public function add_comment()
 {
     $obj_option = joosRequest::post('obj_option');
     $obj_id = joosRequest::int('obj_id', 0);
     $comment_text = joosRequest::post('comment_text');
     $parent_id = joosRequest::int('parent_id', 0);
     $comment = new modelComments();
     $comment->obj_option = $obj_option;
     $comment->obj_id = $obj_id;
     $comment->comment_text = $comment_text;
     $comment->parent_id = $parent_id;
     $comment->store();
     return array();
 }
コード例 #2
0
ファイル: helper.comments.php プロジェクト: joostina/joostina
 /**
  * Вывод древовидного представления комментариев
  *
  * @var $obj Объект комментирования
  */
 public function load_comments_tree($obj)
 {
     joosDocument::instance()->add_js_file(JPATH_SITE_APP . '/components/comments/media/js/comments.js');
     $obj_option = get_class($obj);
     $obj_id = $obj->id;
     $comments_list = modelComments::get_comments($obj_option, $obj_id);
     // список текущих комментариев
     self::render_lists($comments_list, $obj);
     // форма добавления нового комментария
     self::render_form($obj_option, $obj_id);
 }
コード例 #3
0
ファイル: model.comments.php プロジェクト: joostina/joostina
 public function before_store()
 {
     $comment_text = $this->comment_text;
     $comment_text = joosText::text_clean($comment_text);
     $comment_text = joosText::word_limiter($comment_text, 200);
     $this->comment_text = $comment_text;
     $this->user_id = joosCore::user()->id;
     $this->user_ip = joosRequest::user_ip();
     // высчитываем родителя и заполняем дерево
     if ($this->parent_id > 0) {
         $parent = new modelComments();
         $parent->load($this->parent_id);
         $this->level = $parent->level + 1;
         $this->path = $parent->path . ',' . $parent->id;
     } else {
         $this->path = 0;
     }
     $this->state = 1;
     return true;
 }