86    public function __construct($a_id = 0, $a_is_moderator = 
false, $preventImplicitRead = 
false)
 
   90        $this->db = 
$DIC->database();
 
   91        $this->lng = 
$DIC->language();
 
   94        if (!$preventImplicitRead) {
 
  102        unset($this->objThread);
 
  107        if ($this->forum_id && $this->thread_id) {
 
  108            $this->
id = $this->db->nextId(
'frm_posts');
 
  110            $this->db->insert(
'frm_posts', array(
 
  111                'pos_pk' => array(
'integer', $this->
id),
 
  112                'pos_top_fk' => array(
'integer', $this->forum_id),
 
  113                'pos_thr_fk' => array(
'integer', $this->thread_id),
 
  114                'pos_display_user_id' => array(
'integer', $this->display_user_id),
 
  115                'pos_usr_alias' => array(
'text', $this->user_alias),
 
  116                'pos_subject' => array(
'text', $this->subject),
 
  117                'pos_message' => array(
'clob', $this->message),
 
  118                'pos_date' => array(
'timestamp', $this->createdate),
 
  119                'pos_update' => array(
'timestamp', $this->createdate),
 
  120                'update_user' => array(
'integer', $this->user_id_update),
 
  121                'pos_cens' => array(
'integer', $this->censored),
 
  122                'notify' => array(
'integer', (
int) $this->
notification),
 
  123                'import_name' => array(
'text', (
string) $this->import_name),
 
  124                'pos_status' => array(
'integer', (
int) $this->status),
 
  125                'pos_author_id' => array(
'integer', (
int) $this->pos_author_id),
 
  126                'is_author_moderator' => array(
'integer', $this->is_author_moderator),
 
  127                'pos_activation_date' => array(
'timestamp', $this->createdate)
 
  142                    'pos_top_fk' => array(
'integer', $this->forum_id),
 
  143                    'pos_thr_fk' => array(
'integer', $this->thread_id),
 
  144                    'pos_subject' => array(
'text', $this->subject),
 
  145                    'pos_message' => array(
'clob', $this->message),
 
  146                    'pos_update' => array(
'timestamp', $this->changedate),
 
  147                    'update_user' => array(
'integer', $this->user_id_update),
 
  148                    'pos_cens' => array(
'integer', $this->censored),
 
  149                    'pos_cens_date' => array(
'timestamp', $this->censored_date),
 
  150                    'pos_cens_com' => array(
'text', $this->censorship_comment),
 
  151                    'notify' => array(
'integer', (
int) $this->
notification),
 
  152                    'pos_status' => array(
'integer', (
int) $this->status)
 
  155                    'pos_pk' => array(
'integer', (
int) $this->
id)
 
  159            if ($this->objThread->getFirstPostId() == $this->id) {
 
  160                $this->objThread->setSubject($this->subject);
 
  161                $this->objThread->update();
 
  162                $this->objThread->reload();
 
  174            $res = $this->db->queryF(
 
  176                                SELECT * FROM frm_posts 
  177                                INNER JOIN frm_posts_tree ON pos_fk = pos_pk 
  182            $row = $this->db->fetchObject(
$res);
 
  184            if (is_object(
$row)) {
 
  185                $this->
id = 
$row->pos_pk;
 
  186                $this->forum_id = 
$row->pos_top_fk;
 
  187                $this->thread_id = 
$row->pos_thr_fk;
 
  188                $this->display_user_id = 
$row->pos_display_user_id;
 
  189                $this->user_alias = 
$row->pos_usr_alias;
 
  190                $this->subject = 
$row->pos_subject;
 
  191                $this->message = 
$row->pos_message;
 
  192                $this->createdate = 
$row->pos_date;
 
  193                $this->changedate = 
$row->pos_update;
 
  194                $this->user_id_update = 
$row->update_user;
 
  195                $this->censored = 
$row->pos_cens;
 
  196                $this->censored_date = 
$row->pos_cens_date;
 
  197                $this->censorship_comment = 
$row->pos_cens_com;
 
  199                $this->import_name = 
$row->import_name;
 
  200                $this->status = 
$row->pos_status;
 
  201                $this->tree_id = 
$row->fpt_pk;
 
  202                $this->parent_id = 
$row->parent_pos;
 
  203                $this->lft = 
$row->lft;
 
  204                $this->rgt = 
$row->rgt;
 
  205                $this->depth = 
$row->depth;
 
  206                $this->pos_author_id = 
$row->pos_author_id;
 
  207                $this->is_author_moderator = 
$row->is_author_moderator;
 
  208                $this->post_activation_date = 
$row->pos_activation_date;
 
  210                $this->objThread = 
new ilForumTopic($this->thread_id, $this->is_moderator);
 
  224            $res = $this->db->queryF(
 
  226                                SELECT * FROM frm_posts_tree 
  227                                INNER JOIN frm_posts ON pos_pk = pos_fk 
  228                                WHERE pos_status = %s 
  229                                AND lft < %s AND rgt > %s 
  231                array(
'integer', 
'integer', 
'integer', 
'integer'),
 
  232                array(
'0', $this->lft, $this->rgt, $this->thread_id)
 
  235            return $res->numRows();
 
  243        return $this->
read();
 
  249            $now = date(
"Y-m-d H:i:s");
 
  252                array(
'pos_status' => array(
'integer', 1),
 
  253                      'pos_activation_date' => array(
'timestamp', $now)),
 
  254                array(
'pos_pk' => array(
'integer', $this->
id))
 
  269            $query = 
"SELECT pos_pk FROM frm_posts_tree treea " 
  270                   . 
"INNER JOIN frm_posts_tree treeb ON treeb.thr_fk = treea.thr_fk " 
  271                   . 
"AND treeb.lft BETWEEN treea.lft AND treea.rgt " 
  272                   . 
"INNER JOIN frm_posts ON pos_pk = treeb.pos_fk " 
  273                   . 
"WHERE treea.pos_fk = %s";
 
  280            $now = date(
"Y-m-d H:i:s");
 
  284                    array(
'pos_status' => array(
'integer', 1),
 
  285                          'pos_activation_date' => array(
'timestamp', $now)),
 
  286                    array(
'pos_pk' => array(
'integer', 
$row[
'pos_pk']))
 
  301            $query = 
"SELECT pos_pk FROM frm_posts " 
  302                   . 
"INNER JOIN frm_posts_tree ON pos_fk = pos_pk " 
  303                   . 
"WHERE lft < %s AND rgt > %s AND thr_fk = %s";
 
  306                array(
'integer', 
'integer', 
'integer'),
 
  307                array($this->lft, $this->rgt, $this->thread_id)
 
  310            $now = date(
"Y-m-d H:i:s");
 
  314                    array(
'pos_status' => array(
'integer', 1),
 
  315                          'pos_activation_date' => array(
'timestamp', $now)),
 
  316                    array(
'pos_pk' => array(
'integer', 
$row[
'pos_pk']))
 
  333        if ($a_user_id && $this->
id) {
 
  334            $res = $this->db->queryF(
 
  336                                SELECT * FROM frm_user_read  
  339                array(
'integer', 
'integer'),
 
  340                array($a_user_id, $this->
id)
 
  343            return $res->numRows() ? true : 
false;
 
  351        if ($this->
id && $this->rgt && $this->lft) {
 
  352            $res = $this->db->queryF(
 
  354                                SELECT * FROM frm_posts_tree                                      
  355                                WHERE lft > %s AND rgt < %s 
  357                array(
'integer', 
'integer', 
'integer'),
 
  358                array($this->lft, $this->rgt, $this->thread_id)
 
  361            return $res->numRows() ? true : 
false;
 
  369        if ($this->pos_author_id && $a_user_id) {
 
  370            if ((
int) $this->pos_author_id == (
int) $a_user_id) {
 
  388        $this->forum_id = $a_forum_id;
 
  396        $this->thread_id = $a_thread_id;
 
  404        $this->display_user_id = $a_user_id;
 
  412        $this->user_alias = $a_user_alias;
 
  420        $this->subject = $a_subject;
 
  428        $this->message = $a_message;
 
  436        $this->createdate = $a_createdate;
 
  444        $this->changedate = $a_changedate;
 
  452        $this->user_id_update = $a_user_id_update;
 
  460        $this->censored = $a_censorship;
 
  464        return $this->censored == 1 ? true : 
false;
 
  468        $this->censorship_comment = $a_comment;
 
  484        $this->import_name = $a_import_name;
 
  492        $this->status = $a_status;
 
  496        return $this->status == 1 ? true : 
false;
 
  500        $this->tree_id = $a_tree_id;
 
  508        $this->parent_id = $a_parent_id;
 
  513        $this->post_read = $a_is_read;
 
  543        $this->depth = $a_depth;
 
  551        $this->objThread = $thread;
 
  656    public static function mergePosts(
int $sourceThreadId, 
int $targetThreadId, array $excludedPostIds = [])
 
  661        $conditions = [
'pos_thr_fk = ' . 
$ilDB->quote($sourceThreadId, 
'integer')];
 
  662        if ($excludedPostIds !== []) {
 
  663            $conditions[] = 
$ilDB->in(
'pos_pk', $excludedPostIds, 
true, 
'integer');
 
  667            'UPDATE frm_posts SET pos_thr_fk = %s WHERE ' . implode(
' AND ', $conditions),
 
An exception for terminatinating execution or to throw for unit testing.
setNotification($a_notification)
setThread(ilForumTopic $thread)
__construct($a_id=0, $a_is_moderator=false, $preventImplicitRead=false)
ilForumPost constructor.
setCreateDate($a_createdate)
setCensorshipComment($a_comment)
setCensorship($a_censorship)
setThreadId($a_thread_id)
setIsAuthorModerator($is_author_moderator)
setImportName($a_import_name)
setPosAuthorId($pos_author_id)
setParentId($a_parent_id)
setUserAlias($a_user_alias)
setCensoredDate($censored_date)
setUpdateUserId($a_user_id_update)
setDisplayUserId($a_user_id)
setChangeDate($a_changedate)
setPostActivationDate($post_activation_date)
static mergePosts(int $sourceThreadId, int $targetThreadId, array $excludedPostIds=[])
activatePostAndChildPosts()
foreach($_POST as $key=> $value) $res