コード例 #1
0
ファイル: comments.php プロジェクト: vitrinephp/Vitrine-PHP
 public static function make_a_comment_to(ORM $object, $insertion_user, $title, $content, $moderated_state = 'DEFAULT', Comment_Model $in_reply_to = NULL, $url_identifier = '')
 {
     $comment_to_insert = ORM::factory('comment');
     $comment_to_insert->commented_object = $object;
     $comment_to_insert->insertion_user_id = $insertion_user->id;
     Workshop::factory()->add_as_author_of($insertion_user, $object);
     $comment_to_insert->title = $title;
     $comment_to_insert->content = $content;
     $comment_to_insert->moderated_state = $moderated_state;
     if ($in_reply_to != NULL) {
         $comment_to_insert->in_reply_to_id = $in_reply_to->id;
     }
     if ($url_identifier == '') {
         $url_identifier = comments::make_url_identifier($comment_to_insert);
     }
     $comment_to_insert->url_identifier = url_identifier::get_next_available_url_identifier($comment_to_insert, $url_identifier);
     $comment_to_insert->save();
 }