4require_once 
'./Modules/Forum/classes/class.ilForumTopic.php';
 
   92    public function __construct($a_id = 0, $a_is_moderator = 
false, $preventImplicitRead = 
false)
 
   96        $this->db = 
$DIC->database();
 
   97        $this->lng = 
$DIC->language();
 
  100        if (!$preventImplicitRead) {
 
  108        unset($this->objThread);
 
  113        if ($this->forum_id && $this->thread_id) {
 
  114            $this->
id = $this->db->nextId(
'frm_posts');
 
  116            $this->db->insert(
'frm_posts', array(
 
  117                'pos_pk'                => array(
'integer', $this->
id),
 
  118                'pos_top_fk'    => array(
'integer', $this->forum_id),
 
  119                'pos_thr_fk'    => array(
'integer', $this->thread_id),
 
  120                'pos_display_user_id'   => array(
'integer', $this->display_user_id),
 
  121                'pos_usr_alias' => array(
'text', $this->user_alias),
 
  122                'pos_subject'   => array(
'text', $this->subject),
 
  123                'pos_message'   => array(
'clob', $this->message),
 
  124                'pos_date'              => array(
'timestamp', $this->createdate),
 
  125                'pos_update'    => array(
'timestamp', $this->createdate),
 
  126                'update_user'   => array(
'integer', $this->user_id_update),
 
  127                'pos_cens'              => array(
'integer', $this->censored),
 
  128                'notify'                => array(
'integer', (
int) $this->
notification),
 
  129                'import_name'   => array(
'text', (
string) $this->import_name),
 
  130                'pos_status'    => array(
'integer', (
int) $this->status),
 
  131                'pos_author_id' => array(
'integer', (
int) $this->pos_author_id),
 
  132                'is_author_moderator' => array(
'integer', $this->is_author_moderator),
 
  133                'pos_activation_date' => array(
'timestamp', $this->createdate)
 
  148                    'pos_top_fk'        => array(
'integer', $this->forum_id),
 
  149                    'pos_thr_fk'        => array(
'integer', $this->thread_id),
 
  150                    'pos_subject'       => array(
'text', $this->subject),
 
  151                    'pos_message'       => array(
'clob', $this->message),
 
  152                    'pos_update'        => array(
'timestamp', $this->changedate),
 
  153                    'update_user'       => array(
'integer', $this->user_id_update),
 
  154                    'pos_cens'          => array(
'integer', $this->censored),
 
  155                    'pos_cens_date' => array(
'timestamp', $this->censored_date),
 
  156                    'pos_cens_com'      => array(
'text', $this->censorship_comment),
 
  157                    'notify'            => array(
'integer', (
int) $this->
notification),
 
  158                    'pos_status'        => array(
'integer', (
int) $this->status)
 
  161                    'pos_pk'            => array(
'integer', (
int) $this->
id)
 
  165            if ($this->objThread->getFirstPostId() == $this->id) {
 
  166                $this->objThread->setSubject($this->subject);
 
  167                $this->objThread->update();
 
  168                $this->objThread->reload();
 
  180            $res = $this->db->queryF(
 
  182                                SELECT * FROM frm_posts 
  183                                INNER JOIN frm_posts_tree ON pos_fk = pos_pk 
  188            $row = $this->db->fetchObject(
$res);
 
  190            if (is_object(
$row)) {
 
  191                $this->
id                 = 
$row->pos_pk;
 
  192                $this->forum_id           = 
$row->pos_top_fk;
 
  193                $this->thread_id          = 
$row->pos_thr_fk;
 
  194                $this->display_user_id    = 
$row->pos_display_user_id;
 
  195                $this->user_alias         = 
$row->pos_usr_alias;
 
  196                $this->subject            = 
$row->pos_subject;
 
  197                $this->message            = 
$row->pos_message;
 
  198                $this->createdate         = 
$row->pos_date;
 
  199                $this->changedate         = 
$row->pos_update;
 
  200                $this->user_id_update     = 
$row->update_user;
 
  201                $this->censored           = 
$row->pos_cens;
 
  202                $this->censored_date      = 
$row->pos_cens_date;
 
  203                $this->censorship_comment = 
$row->pos_cens_com;
 
  205                $this->import_name        = 
$row->import_name;
 
  206                $this->status             = 
$row->pos_status;
 
  207                $this->tree_id            = 
$row->fpt_pk;
 
  208                $this->parent_id          = 
$row->parent_pos;
 
  209                $this->lft                = 
$row->lft;
 
  210                $this->rgt                = 
$row->rgt;
 
  211                $this->depth              = 
$row->depth;
 
  212                $this->pos_author_id      = 
$row->pos_author_id;
 
  213                $this->is_author_moderator = 
$row->is_author_moderator;
 
  214                $this->post_activation_date = 
$row->pos_activation_date;
 
  217                $this->objThread = 
new ilForumTopic($this->thread_id, $this->is_moderator);
 
  231            $res = $this->db->queryF(
 
  233                                SELECT * FROM frm_posts_tree 
  234                                INNER JOIN frm_posts ON pos_pk = pos_fk 
  235                                WHERE pos_status = %s 
  236                                AND lft < %s AND rgt > %s 
  238                array(
'integer', 
'integer', 
'integer', 
'integer'),
 
  239                array(
'0', $this->lft, $this->rgt, $this->thread_id)
 
  242            return $res->numRows();
 
  250        if (
$row[
'pos_display_user_id'] && 
$row[
'pos_pk']) {
 
  251            require_once 
'Services/User/classes/class.ilObjUser.php';
 
  253            $tmp_user->setFirstname(
$row[
'firstname']);
 
  254            $tmp_user->setLastname(
$row[
'lastname']);
 
  255            $tmp_user->setUTitle(
$row[
'title']);
 
  256            $tmp_user->setLogin(
$row[
'login']);
 
  258            $this->fullname = $tmp_user->getFullname();
 
  259            $this->loginname = $tmp_user->getLogin();
 
  261            $this->fullname = $this->fullname ? $this->fullname : ($this->import_name ? $this->import_name : $this->lng->txt(
'unknown'));
 
  267        if ($this->
id && $this->display_user_id) {
 
  268            require_once(
"Modules/Forum/classes/class.ilObjForumAccess.php");
 
  270                $this->fullname = $tmp_user->getFullname();
 
  271                $this->loginname = $tmp_user->getLogin();
 
  275            $this->fullname = $this->fullname ? $this->fullname : ($this->import_name ? $this->import_name : $this->lng->txt(
'unknown'));
 
  285        return $this->
read();
 
  290        $this->fullname = $a_fullname;
 
  298        $this->loginname = $a_loginname;
 
  308            $now = 
date(
"Y-m-d H:i:s");
 
  311                array(
'pos_status'      =>      array(
'integer', 1),
 
  312                      'pos_activation_date' => array(
'timestamp', $now)),
 
  313                array(
'pos_pk'          =>      array(
'integer', $this->
id))
 
  328            $query = 
"SELECT pos_pk FROM frm_posts_tree treea " 
  329                   . 
"INNER JOIN frm_posts_tree treeb ON treeb.thr_fk = treea.thr_fk " 
  330                   . 
"AND treeb.lft BETWEEN treea.lft AND treea.rgt " 
  331                   . 
"INNER JOIN frm_posts ON pos_pk = treeb.pos_fk " 
  332                   . 
"WHERE treea.pos_fk = %s";
 
  339            $now = 
date(
"Y-m-d H:i:s");
 
  343                    array(
'pos_status'  =>      array(
'integer', 1),
 
  344                          'pos_activation_date' => array(
'timestamp', $now)),
 
  345                    array(
'pos_pk'              =>      array(
'integer', 
$row[
'pos_pk']))
 
  360            $query = 
"SELECT pos_pk FROM frm_posts " 
  361                   . 
"INNER JOIN frm_posts_tree ON pos_fk = pos_pk " 
  362                   . 
"WHERE lft < %s AND rgt > %s AND thr_fk = %s";
 
  365                array(
'integer', 
'integer', 
'integer'),
 
  366                array($this->lft, $this->rgt, $this->thread_id)
 
  369            $now = 
date(
"Y-m-d H:i:s");
 
  373                    array(
'pos_status'  =>      array(
'integer', 1),
 
  374                          'pos_activation_date' => array(
'timestamp', $now)),
 
  375                    array(
'pos_pk'              =>      array(
'integer', 
$row[
'pos_pk']))
 
  392        if ($a_user_id && $this->
id) {
 
  393            $res = $this->db->queryF(
 
  395                                SELECT * FROM frm_user_read  
  398                array(
'integer', 
'integer'),
 
  399                array($a_user_id, $this->
id)
 
  402            return $res->numRows() ? true : 
false;
 
  410        if ($this->
id && $this->rgt && $this->lft) {
 
  411            $res = $this->db->queryF(
 
  413                                SELECT * FROM frm_posts_tree                                      
  414                                WHERE lft > %s AND rgt < %s 
  416                array(
'integer', 
'integer', 
'integer'),
 
  417                array($this->lft, $this->rgt, $this->thread_id)
 
  420            return $res->numRows() ? true : 
false;
 
  428        if ($this->pos_author_id && $a_user_id) {
 
  429            if ((
int) $this->pos_author_id == (
int) $a_user_id) {
 
  447        $this->forum_id = $a_forum_id;
 
  455        $this->thread_id = $a_thread_id;
 
  463        $this->display_user_id = $a_user_id;
 
  471        $this->user_alias = $a_user_alias;
 
  479        $this->subject = $a_subject;
 
  487        $this->message = $a_message;
 
  495        $this->createdate = $a_createdate;
 
  503        $this->changedate = $a_changedate;
 
  511        $this->user_id_update = $a_user_id_update;
 
  519        $this->censored = $a_censorship;
 
  523        return $this->censored == 1 ? true : 
false;
 
  527        $this->censorship_comment = $a_comment;
 
  543        $this->import_name = $a_import_name;
 
  551        $this->status = $a_status;
 
  555        return $this->status == 1 ? true : 
false;
 
  559        $this->tree_id = $a_tree_id;
 
  567        $this->parent_id = $a_parent_id;
 
  572        $this->post_read = $a_is_read;
 
  602        $this->depth = $a_depth;
 
  610        $this->objThread = $thread;
 
  715    public static function mergePosts($source_thread_id, $target_thread_id)
 
  722            array(
'pos_thr_fk' => array(
'integer', $target_thread_id)),
 
  723            array(
'pos_thr_fk' => array(
'integer', $source_thread_id))
 
date( 'd-M-Y', $objPHPExcel->getProperties() ->getCreated())
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($source_thread_id, $target_thread_id)
activatePostAndChildPosts()
buildUserRelatedData($row)
setLoginName($a_loginname)
static getCachedUserInstance($usr_id)
foreach($_POST as $key=> $value) $res