4require_once 
'./Modules/Forum/classes/class.ilForumProperties.php';
 
    5require_once 
'./Modules/Forum/classes/class.ilObjForum.php';
 
    6require_once 
'./Modules/Forum/classes/class.ilForumTopic.php';
 
    7require_once 
'./Modules/Forum/classes/class.ilForumPost.php';
 
   82        $this->
error = $DIC[
'ilErr'];
 
   83        $this->lng = 
$DIC->language();
 
   84        $this->db = 
$DIC->database();
 
   85        $this->
user = $DIC->user();
 
  107        static $lngCache = array();
 
  112        if (!isset($lngCache[$languageShorthandle])) {
 
  113            $lngCache[$languageShorthandle] = 
new ilLanguage($languageShorthandle);
 
  114            $lngCache[$languageShorthandle]->loadLanguageModule(
'forum');
 
  117        return $lngCache[$languageShorthandle];
 
  127        if (!isset($a_obj_id)) {
 
  128            $message = get_class($this) . 
"::setForumId(): No obj_id given!";
 
  132        $this->
id = $a_obj_id;
 
  142        if (!isset($a_ref_id)) {
 
  143            $message = get_class($this) . 
"::setForumRefId(): No ref_id given!";
 
  147        $this->ref_id = $a_ref_id;
 
  167        return $this->ref_id;
 
  179            die($this->className . 
"::setOrderField(): No orderField given.");
 
  205            die($this->className . 
"::setDbTable(): No database table given.");
 
  232        $this->mdb2Query = $query_string;
 
  233        $this->mdb2DataValue = $data_value;
 
  234        $this->mdb2DataType = $data_type;
 
  245        if ($this->mdb2Query != 
'') {
 
  256        if ($this->mdb2DataValue != 
'') {
 
  267        if ($this->mdb2DataType != 
'') {
 
  304        $data_type = array();
 
  305        $data_value = array();
 
  307        $query = 
'SELECT * FROM frm_data WHERE ';
 
  314            $res = $this->db->queryf(
$query, $data_type, $data_value);
 
  321            $row[
"top_name"] = trim(
$row[
"top_name"]);
 
  322            $row[
"top_description"] = nl2br(
$row[
"top_description"]);
 
  331            if (!is_array(
$row) || !count(
$row)) {
 
  335            $row[
'top_name'] = trim(
$row[
'top_name']);
 
  336            $row[
'top_description'] = nl2br(
$row[
'top_description']);
 
  349        $data_type = array();
 
  350        $data_value = array();
 
  352        $query = 
'SELECT * FROM frm_threads WHERE ';
 
  359            $sql_res = $this->db->queryf(
$query, $data_type, $data_value);
 
  360            $result = $this->db->fetchAssoc($sql_res);
 
  375        $res = $this->db->queryf(
 
  377                        SELECT frm_posts.*, usr_data.lastname FROM frm_posts, usr_data  
  379                        AND pos_display_user_id = usr_id',
 
  387        $row[
"pos_message"] = nl2br(
$row[
"pos_message"]);
 
  399                        SELECT * FROM frm_posts WHERE pos_pk = %s',
 
  405            return $row->pos_message;
 
  426    public function generatePost($forum_id, $thread_id, $author_id, $display_user_id, 
$message, $parent_pos, $notify, $subject = 
'', $alias = 
'', $date = 
'', $status = 1, $send_activation_mail = 0)
 
  429        $objNewPost->setForumId($forum_id);
 
  430        $objNewPost->setThreadId($thread_id);
 
  431        $objNewPost->setSubject($subject);
 
  433        $objNewPost->setDisplayUserId($display_user_id);
 
  434        $objNewPost->setUserAlias($alias);
 
  435        $objNewPost->setPosAuthorId($author_id);
 
  439        if ($frm_settings->getMarkModeratorPosts() == 1) {
 
  442            $is_moderator = 
false;
 
  444        $objNewPost->setIsAuthorModerator($is_moderator);
 
  447            $objNewPost->setCreateDate(
date(
"Y-m-d H:i:s"));
 
  449            if (strpos($date, 
"-") >  0) {              
 
  450                $objNewPost->setCreateDate($date);
 
  452                $objNewPost->setCreateDate(
date(
"Y-m-d H:i:s", $date));
 
  456            $objNewPost->setPostActivationDate($objNewPost->getCreateDate());
 
  460        $objNewPost->setNotification($notify);
 
  461        $objNewPost->setStatus($status);
 
  462        $objNewPost->insert();
 
  465        if ($parent_pos == 0) {
 
  466            $this->
addPostTree($objNewPost->getThreadId(), $objNewPost->getId(), $objNewPost->getCreateDate());
 
  468            $this->
insertPostNode($objNewPost->getId(), $parent_pos, $objNewPost->getThreadId(), $objNewPost->getCreateDate());
 
  472        $lastPost = $objNewPost->getForumId() . 
"#" . $objNewPost->getThreadId() . 
"#" . $objNewPost->getId();
 
  475        $this->db->manipulateF(
 
  478                        SET thr_num_posts = thr_num_posts + 1, 
  481            array(
'text', 
'integer'),
 
  482            array($lastPost, $objNewPost->getThreadId())
 
  486        $this->db->manipulateF(
 
  489                        SET top_num_posts = top_num_posts + 1, 
  492            array(
'text', 
'integer'),
 
  493            array($lastPost, $objNewPost->getForumId())
 
  498        $forum_obj->markPostRead($objNewPost->getPosAuthorId(), $objNewPost->getThreadId(), $objNewPost->getId());
 
  502            require_once 
'Services/RTE/classes/class.ilRTE.php';
 
  503            include_once(
"./Services/News/classes/class.ilNewsItem.php");
 
  505            $news_item->setContext($forum_obj->getId(), 
'frm', $objNewPost->getId(), 
'pos');
 
  507            $news_item->setTitle($objNewPost->getSubject());
 
  509            if ($objNewPost->getMessage() != strip_tags($objNewPost->getMessage())) {
 
  510                $news_item->setContentHtml(
true);
 
  513            $news_item->setUserId($display_user_id);
 
  515            $news_item->create();
 
  518        return $objNewPost->getId();
 
  538        if ($notify_posts == 1) {
 
  542        $this->db->manipulateF(
 
  545                        SET top_num_threads = top_num_threads + 1 
  576    public function moveThreads($thread_ids = array(), $src_ref_id = 0, $dest_top_frm_fk = 0)
 
  580        $errorMessages = array();
 
  582        if (is_numeric($src_top_frm_fk) && $src_top_frm_fk > 0 && is_numeric($dest_top_frm_fk) && $dest_top_frm_fk > 0) {
 
  591            if ($oldFrmData[
'top_pk'] && $newFrmData[
'top_pk']) {
 
  596                foreach ($thread_ids as 
$id) {
 
  600                        $numPosts = $objTmpThread->movePosts(
 
  602                            $oldFrmData[
'top_pk'],
 
  604                            $newFrmData[
'top_pk']
 
  607                        if (($last_post_string = $objTmpThread->getLastPostString()) != 
'') {
 
  608                            $last_post_string = explode(
'#', $last_post_string);
 
  609                            $last_post_string[0] = $newFrmData[
'top_pk'];
 
  610                            $last_post_string = implode(
'#', $last_post_string);
 
  611                            $objTmpThread->setLastPostString($last_post_string);
 
  614                        $visits += $objTmpThread->getVisits();
 
  616                        $moved_posts += $numPosts;
 
  619                        $objTmpThread->setForumId($newFrmData[
'top_pk']);
 
  620                        $objTmpThread->update();
 
  622                        unset($objTmpThread);
 
  624                        $errorMessages[] = 
sprintf($this->lng->txt(
'frm_move_invalid_file_type'), $objTmpThread->getSubject());
 
  629                if ($moved_threads > 0 || $moved_posts > 0 || $visits > 0) {
 
  631                    $this->db->setLimit(1);
 
  632                    $res = $this->db->queryf(
 
  634                                        SELECT pos_thr_fk, pos_pk  
  636                                        WHERE pos_top_fk = %s 
  637                                        ORDER BY pos_date DESC',
 
  639                        array($oldFrmData[
'top_pk'])
 
  642                    $row = $this->db->fetchObject(
$res);
 
  643                    $last_post_src = $oldFrmData[
'top_pk'] . 
'#' . 
$row->pos_thr_fk . 
'#' . 
$row->pos_pk;
 
  645                    $this->db->manipulateF(
 
  648                                        SET top_num_posts = top_num_posts - %s, 
  649                                                top_num_threads = top_num_threads - %s, 
  650                                                visits = visits - %s, 
  653                        array(
'integer', 
'integer', 
'integer', 
'text', 
'integer'),
 
  658                            $oldFrmData[
'top_pk'])
 
  662                    $this->db->setLimit(1);
 
  663                    $res = $this->db->queryf(
 
  665                                        SELECT pos_thr_fk, pos_pk  
  667                                        WHERE pos_top_fk = %s 
  668                                        ORDER BY pos_date DESC',
 
  670                        array($newFrmData[
'top_kp'])
 
  673                    $row = $this->db->fetchObject(
$res);
 
  674                    $last_post_dest = $newFrmData[
'top_pk'] . 
'#' . 
$row->pos_thr_fk . 
'#' . 
$row->pos_pk;
 
  676                    $this->db->manipulateF(
 
  679                                        SET top_num_posts = top_num_posts + %s, 
  680                                                top_num_threads = top_num_threads + %s, 
  681                                                visits = visits + %s, 
  684                        array(
'integer', 
'integer', 
'integer', 
'text', 
'integer'),
 
  685                        array($moved_posts, $moved_threads, $visits, $last_post_dest, $newFrmData[
'top_pk'])
 
  690            return $errorMessages;
 
  704        $cens_date = 
date(
"Y-m-d H:i:s");
 
  706        $this->db->manipulateF(
 
  709                        SET pos_cens_com = %s, 
  714            array(
'text', 
'timestamp', 
'integer', 
'integer', 
'integer'),
 
  715            array(
$message, $cens_date, $cens, 
$GLOBALS[
'DIC'][
'ilUser']->getId(), $pos_pk)
 
  719        include_once(
"./Services/News/classes/class.ilNewsItem.php");
 
  732                    $news_item->setContentHtml(
true);
 
  734                    $news_item->setContentHtml(
false);
 
  737                $news_item->update();
 
  740                $res = $this->db->queryf(
 
  742                                        SELECT * FROM frm_posts 
  748                $rec = $this->db->fetchAssoc(
$res);
 
  752                $news_item->setContent(nl2br($this->
prepareText($rec[
"pos_message"], 0)));
 
  753                if ($rec[
"pos_message"] != strip_tags($rec[
"pos_message"])) {
 
  754                    $news_item->setContentHtml(
true);
 
  756                    $news_item->setContentHtml(
false);
 
  759                $news_item->update();
 
  763        require_once 
'Modules/Forum/classes/class.ilForumPost.php';
 
  764        $GLOBALS[
'ilAppEventHandler']->raise(
 
  784        include_once 
"./Modules/Forum/classes/class.ilObjForum.php";
 
  788        $GLOBALS[
'ilAppEventHandler']->raise(
 
  794                'thread_deleted' => ($p_node[
"parent"] == 0)? 
true : 
false 
  803        $obj_history->deleteHistoryByPostIds($del_id);
 
  806        $obj_draft->deleteDraftsByPostIds($del_id);
 
  809        foreach ($del_id as $post_id) {
 
  816        $dead_pos = count($del_id);
 
  820        if ($p_node[
"parent"] == 0) {
 
  822            include_once 
'./Modules/Forum/classes/class.ilObjForum.php';
 
  827            $dead_thr = $p_node[
"tree"];
 
  829            $this->db->manipulateF(
 
  831                                DELETE FROM frm_threads 
  834                array($p_node[
'tree'])
 
  838            $this->db->manipulateF(
 
  841                                SET top_num_threads = top_num_threads - 1  
  842                                WHERE top_frm_fk = %s',
 
  848            $posset = $this->db->queryf(
 
  850                                SELECT * FROM frm_posts 
  851                                WHERE pos_thr_fk = %s',
 
  853                array($p_node[
'tree'])
 
  856            while ($posrec = $this->db->fetchAssoc($posset)) {
 
  857                include_once(
"./Services/News/classes/class.ilNewsItem.php");
 
  866                    $news_item->delete();
 
  870                    include_once 
'Services/MediaObjects/classes/class.ilObjMediaObject.php';
 
  872                    foreach (
$mobs as $mob) {
 
  879                } 
catch (Exception $e) {
 
  884            $this->db->manipulateF(
 
  886                                DELETE FROM frm_posts 
  887                                WHERE pos_thr_fk = %s',
 
  889                array($p_node[
'tree'])
 
  893            for (
$i = 0; 
$i < $dead_pos; 
$i++) {
 
  894                $this->db->manipulateF(
 
  896                                        DELETE FROM frm_posts 
  903                include_once(
"./Services/News/classes/class.ilNewsItem.php");
 
  912                    $news_item->delete();
 
  916                    include_once 
'Services/MediaObjects/classes/class.ilObjMediaObject.php';
 
  918                    foreach (
$mobs as $mob) {
 
  925                } 
catch (Exception $e) {
 
  930            $this->db->manipulateF(
 
  933                                SET thr_num_posts = thr_num_posts - %s 
  935                array(
'integer', 
'integer'),
 
  936                array($dead_pos, $p_node[
'tree'])
 
  940            $res1 = $this->db->queryf(
 
  942                                SELECT * FROM frm_posts  
  943                                WHERE pos_thr_fk = %s 
  944                                ORDER BY pos_date DESC',
 
  946                array($p_node[
'tree'])
 
  949            if ($res1->numRows() == 0) {
 
  954                while ($selData = $this->db->fetchAssoc($res1)) {
 
  959                    $lastPost_thr = $selData[
"pos_top_fk"] . 
"#" . $selData[
"pos_thr_fk"] . 
"#" . $selData[
"pos_pk"];
 
  964            $this->db->manipulateF(
 
  967                                SET thr_last_post = %s 
  969                array(
'text', 
'integer'),
 
  970                array($lastPost_thr, $p_node[
'tree'])
 
  975        $this->db->manipulateF(
 
  978                        SET top_num_posts = top_num_posts - %s 
  979                        WHERE top_frm_fk = %s',
 
  980             array(
'integer', 
'integer'),
 
  981             array($dead_pos, $this->
id)
 
  985        $res2 = $this->db->queryf(
 
  987                        SELECT * FROM frm_posts, frm_data  
  988                        WHERE pos_top_fk = top_pk  
  990                        ORDER BY pos_date DESC',
 
  995        if ($res2->numRows() == 0) {
 
 1000            while ($selData = $this->db->fetchAssoc($res2)) {
 
 1005                $lastPost_top = $selData[
"pos_top_fk"] . 
"#" . $selData[
"pos_thr_fk"] . 
"#" . $selData[
"pos_pk"];
 
 1010        $this->db->manipulateF(
 
 1013                        SET top_last_post = %s 
 1014                        WHERE top_frm_fk = %s',
 
 1015            array(
'text', 
'integer'),
 
 1016            array($lastPost_top, $this->
id)
 
 1031        $frm_overview_setting       = (int) $this->
settings->get(
'forum_overview');
 
 1033        $is_post_activation_enabled = $frm_props->isPostActivationEnabled();
 
 1035        $user_id = $this->
user->getId();
 
 1037        $excluded_ids_condition = 
'';
 
 1038        if (isset(
$params[
'excluded_ids']) && is_array(
$params[
'excluded_ids']) && 
$params[
'excluded_ids']) {
 
 1039            $excluded_ids_condition = 
' AND ' . $this->db->in(
'thr_pk', 
$params[
'excluded_ids'], 
true, 
'integer') . 
' ';
 
 1042        if (!in_array(strtolower(
$params[
'order_column']), array(
'lp_date', 
'rating', 
'thr_subject', 
'num_posts', 
'num_visit'))) {
 
 1043            $params[
'order_column'] = 
'post_date';
 
 1045        if (!in_array(strtolower(
$params[
'order_direction']), array(
'asc', 
'desc'))) {
 
 1046            $params[
'order_direction'] = 
'desc';
 
 1049        $cnt_active_pos_query = 
'';
 
 1050        $cnt_join_type        = 
'LEFT';
 
 1051        if ($is_post_activation_enabled && !
$params[
'is_moderator']) {
 
 1052            $cnt_active_pos_query = 
" AND (pos_status = {$this->db->quote(1, 'integer')} OR pos_author_id = {$this->db->quote($user_id, 'integer')}) ";
 
 1053            $cnt_join_type        = 
"INNER";
 
 1056            "SELECT COUNT(DISTINCT(thr_pk)) cnt 
 1058                         {$cnt_join_type} JOIN frm_posts 
 1059                                ON pos_thr_fk = thr_pk {$cnt_active_pos_query} 
 1060                         WHERE thr_top_fk = %s {$excluded_ids_condition} 
 1062        $res      = $this->db->queryF(
$query, array(
'integer'), array($a_topic_id));
 
 1063        $cntData  = $this->db->fetchAssoc(
$res);
 
 1064        $cnt      = (int) $cntData[
'cnt'];
 
 1067        $active_inner_query         = 
'';
 
 1069        if ($is_post_activation_enabled && !
$params[
'is_moderator']) {
 
 1070            $active_query       = 
' AND (pos_status = %s OR pos_author_id = %s) ';
 
 1071            $active_inner_query = 
' AND (ipos.pos_status = %s OR ipos.pos_author_id = %s) ';
 
 1072            $having = 
' HAVING num_posts > 0';
 
 1077        $data_types = array();
 
 1079        $optional_fields = 
'';
 
 1080        if ($frm_props->isIsThreadRatingEnabled()) {
 
 1081            $optional_fields = 
',avg_rating';
 
 1083        if ($frm_props->getThreadSorting() == 1) {
 
 1084            $optional_fields = 
',thread_sorting';
 
 1087        $additional_sort = 
'';
 
 1088        if ($frm_props->getThreadSorting()) {
 
 1089            $additional_sort .= 
' , thread_sorting ASC ';
 
 1092        if (
$params[
'order_column'] == 
'thr_subject') {
 
 1093            $dynamic_columns = array(
', thr_subject ' . 
$params[
'order_direction']);
 
 1094        } elseif (
$params[
'order_column'] == 
'num_posts') {
 
 1095            $dynamic_columns = array(
', thr_num_posts ' . 
$params[
'order_direction']);
 
 1096        } elseif (
$params[
'order_column'] == 
'num_visit') {
 
 1097            $dynamic_columns = array(
', visits ' . 
$params[
'order_direction']);
 
 1099            $dynamic_columns = array(
', post_date ' . 
$params[
'order_direction']);
 
 1102        if ($frm_props->isIsThreadRatingEnabled()) {
 
 1103            $dynamic_columns[] = 
' ,avg_rating ' . 
$params[
'order_direction'];
 
 1105        if (
'rating' == strtolower(
$params[
'order_column'])) {
 
 1106            $dynamic_columns = array_reverse($dynamic_columns);
 
 1108        $additional_sort .= implode(
' ', $dynamic_columns);
 
 1110        if (!$this->
user->isAnonymous()) {
 
 1112                                          (CASE WHEN COUNT(DISTINCT(notification_id)) > 0 THEN 1 ELSE 0 END) usr_notification_is_enabled, 
 1113                                          MAX(pos_date) post_date, 
 1114                                          COUNT(DISTINCT(pos_pk)) num_posts,  
 1115                                          COUNT(DISTINCT(pos_pk)) - COUNT(DISTINCT(postread.post_id)) num_unread_posts, ";
 
 1120                                          (SELECT COUNT(DISTINCT(ipos.pos_pk)) 
 1122                                                LEFT JOIN frm_user_read iread ON iread.post_id = ipos.pos_pk AND iread.usr_id = %s 
 1123                                                LEFT JOIN frm_thread_access iacc ON (iacc.thread_id = ipos.pos_thr_fk AND iacc.usr_id = %s) 
 1124                                                WHERE ipos.pos_thr_fk = thr_pk 
 1126                                                AND (ipos.pos_update > iacc.access_old_ts 
 1128                                                        (iacc.access_old IS NULL AND (ipos.pos_update > " . $this->db->quote(
date(
'Y-m-d H:i:s', NEW_DEADLINE), 
'timestamp') . 
")) 
 1131                                                AND ipos.pos_author_id != %s 
 1132                                                AND iread.usr_id IS NULL $active_inner_query 
 1136            $query .= 
" thr_pk, thr_top_fk, thr_subject, thr_author_id, thr_display_user_id, thr_usr_alias, thr_num_posts, thr_last_post, thr_date, thr_update, visits, frm_threads.import_name, is_sticky, is_closed 
 1140                                          LEFT JOIN frm_notification 
 1141                                                ON frm_notification.thread_id = thr_pk 
 1142                                                AND frm_notification.user_id = %s 
 1145                                                ON pos_thr_fk = thr_pk $active_query 
 1147                                          LEFT JOIN frm_user_read postread 
 1148                                                ON postread.post_id = pos_pk 
 1149                                                AND postread.usr_id = %s";
 
 1151            $query .= 
" WHERE thr_top_fk = %s 
 1152                                                {$excluded_ids_condition} 
 1153                                                GROUP BY thr_pk, thr_top_fk, thr_subject, thr_author_id, thr_display_user_id, thr_usr_alias, thr_num_posts, thr_last_post, thr_date, thr_update, visits, frm_threads.import_name, is_sticky, is_closed 
 1156                                                ORDER BY is_sticky DESC {$additional_sort}, thr_date DESC";
 
 1161                $data_types[] = 
'integer';
 
 1162                $data_types[] = 
'integer';
 
 1163                $data_types[] = 
'integer';
 
 1164                if ($is_post_activation_enabled && !
$params[
'is_moderator']) {
 
 1165                    array_push($data_types, 
'integer', 
'integer');
 
 1168            $data_types[] = 
'integer';
 
 1169            if ($is_post_activation_enabled && !
$params[
'is_moderator']) {
 
 1170                array_push($data_types, 
'integer', 
'integer');
 
 1172            $data_types[] = 
'integer';
 
 1173            $data_types[] = 
'integer';
 
 1180                if ($is_post_activation_enabled && !
$params[
'is_moderator']) {
 
 1181                    array_push(
$data, 
'1', $user_id);
 
 1185            if ($is_post_activation_enabled && !
$params[
'is_moderator']) {
 
 1186                array_push(
$data, 
'1', $user_id);
 
 1189            $data[] = $a_topic_id;
 
 1192                                          0 usr_notification_is_enabled, 
 1193                                          MAX(pos_date) post_date, 
 1194                                          COUNT(DISTINCT(pos_pk)) num_posts, 
 1195                                          COUNT(DISTINCT(pos_pk)) num_unread_posts, 
 1196                                          COUNT(DISTINCT(pos_pk)) num_new_posts, 
 1197                                          thr_pk, thr_top_fk, thr_subject, thr_author_id, thr_display_user_id, thr_usr_alias, thr_num_posts, thr_last_post, thr_date, thr_update, visits, frm_threads.import_name, is_sticky, is_closed 
 1202                                                ON pos_thr_fk = thr_pk $active_query";
 
 1204            $query .= 
" WHERE thr_top_fk = %s 
 1205                                                {$excluded_ids_condition} 
 1206                                                GROUP BY thr_pk, thr_top_fk, thr_subject, thr_author_id, thr_display_user_id, thr_usr_alias, thr_num_posts, thr_last_post, thr_date, thr_update, visits, frm_threads.import_name, is_sticky, is_closed 
 1209                                                ORDER BY is_sticky DESC {$additional_sort}, thr_date DESC";
 
 1211            if ($is_post_activation_enabled && !
$params[
'is_moderator']) {
 
 1212                array_push($data_types, 
'integer', 
'integer');
 
 1214            $data_types[] = 
'integer';
 
 1215            if ($is_post_activation_enabled && !
$params[
'is_moderator']) {
 
 1216                array_push(
$data, 
'1', $user_id);
 
 1218            $data[] = $a_topic_id;
 
 1221        if ($limit || $offset) {
 
 1222            $this->db->setLimit($limit, $offset);
 
 1227        while (
$row = $this->db->fetchAssoc(
$res)) {
 
 1229            $thread->assignData(
$row);
 
 1230            $threads[
$row[
'thr_pk']] = $thread;
 
 1232            $threadIds[] = 
$row[
'thr_pk'];
 
 1235        $inner_last_active_post_condition = 
'';
 
 1236        if (
$params[
'is_moderator'] == 
false) {
 
 1237            $inner_last_active_post_condition = 
"  
 1238                                AND ( iposts.pos_status = " . $this->db->quote(1, 
'integer') . 
" 
 1239                                OR ( iposts.pos_status = " . $this->db->quote(0, 
'integer') . 
" 
 1240                                                AND iposts.pos_author_id = " . $this->db->quote($this->
user->getId(), 
'integer') . 
"))";
 
 1243        $post_res = $this->db->query(
 
 1248                                SELECT pos_thr_fk, MAX(iposts.pos_date) i_pos_date 
 1249                                FROM frm_posts iposts 
 1250                                WHERE ' . $this->db->in(
'iposts.pos_thr_fk', $threadIds, 
false, 
'integer') . 
'  
 1251                                ' . $inner_last_active_post_condition . 
' 
 1253                        ) opost ON frm_posts.pos_thr_fk = opost.pos_thr_fk AND frm_posts.pos_date = opost.i_pos_date' 
 1256        while ($post_row = $this->db->fetchAssoc($post_res)) {
 
 1259            $tmp_obj->setPosAuthorId($post_row[
'pos_author_id']);
 
 1260            $tmp_obj->setDisplayUserId($post_row[
'pos_display_user_id']);
 
 1261            $tmp_obj->setUserAlias($post_row[
'pos_usr_alias']);
 
 1262            $tmp_obj->setImportName($post_row[
'import_name']);
 
 1263            $tmp_obj->setId($post_row[
'pos_pk']);
 
 1264            $tmp_obj->setCreateDate($post_row[
'pos_date']);
 
 1266            $threads[$post_row[
'pos_thr_fk']]->setLastPostForThreadOverview($tmp_obj);
 
 1269        return array(
'items' => $threads,
'cnt' => $cnt);
 
 1278        $statistic = array();
 
 1280        $data_types = array();
 
 1283        $query = 
"SELECT COUNT(f.pos_display_user_id) ranking, u.login, p.value, u.lastname, u.firstname 
 1285                                                INNER JOIN frm_posts_tree t 
 1286                                                        ON f.pos_pk = t.pos_fk 
 1287                                                INNER JOIN frm_threads th 
 1288                                                        ON t.thr_fk = th.thr_pk 
 1289                                                INNER JOIN usr_data u 
 1290                                                        ON u.usr_id = f.pos_display_user_id 
 1291                                                INNER JOIN frm_data d 
 1292                                                        ON d.top_pk = f.pos_top_fk 
 1293                                                LEFT JOIN usr_pref p 
 1294                                                        ON p.usr_id = u.usr_id AND p.keyword = %s 
 1297        array_push($data_types, 
'text');
 
 1298        array_push(
$data, 
'public_profile');
 
 1300        if (!$is_moderator) {
 
 1301            $query .= 
' AND (pos_status = %s 
 1303                                                AND pos_author_id = %s ))';
 
 1305            array_push($data_types, 
'integer', 
'integer', 
'integer');
 
 1306            array_push(
$data, 
'1', 
'0', $this->
user->getId());
 
 1309        $query .= 
' AND d.top_frm_fk = %s 
 1310                                        GROUP BY pos_display_user_id, u.login, p.value,u.lastname, u.firstname';
 
 1312        array_push($data_types, 
'integer');
 
 1318        while (
$row = $this->db->fetchAssoc(
$res)) {
 
 1324            if (!$this->
user->isAnonymous() && in_array(
$row[
'value'], array(
'y', 
'g')) ||
 
 1325                $this->
user->isAnonymous() && 
'g' == 
$row[
'value']) {
 
 1326                $lastname = 
$row[
'lastname'];
 
 1327                $firstname = 
$row[
'firstname'];
 
 1330            $statistic[
$counter][] = $lastname;
 
 1331            $statistic[
$counter][] = $firstname;
 
 1336        return is_array($statistic) ? $statistic : array();
 
 1348        $res = $this->db->queryf(
 
 1350                        SELECT * FROM frm_posts_tree  
 1352                        AND parent_pos = %s',
 
 1353            array(
'integer', 
'integer'),
 
 1354            array($a_thread_id, 
'0')
 
 1357        $row = $this->db->fetchObject(
$res);
 
 1359        return $row->pos_fk ? 
$row->pos_fk : 0;
 
 1383        $rbacreview = 
$DIC->rbac()->review();
 
 1385        $role_arr = $rbacreview->getRolesOfRoleFolder($a_ref_id);
 
 1386        foreach ($role_arr as $role_id) {
 
 1388                return $rbacreview->assignedUsers($role_id);
 
 1405        if (!self::$moderators_by_ref_id_map[$a_ref_id]) {
 
 1408        return in_array($a_usr_id, self::$moderators_by_ref_id_map[$a_ref_id]);
 
 1420        $res = $this->db->queryf(
 
 1422                        SELECT * FROM frm_data 
 1423                        INNER JOIN frm_posts ON pos_top_fk = top_pk  
 1424                        WHERE top_frm_fk = %s 
 1425                        AND pos_author_id = %s',
 
 1426            array(
'integer', 
'integer'),
 
 1430        return $res->numRows();
 
 1435        $res = $this->db->queryf(
 
 1437                        SELECT * FROM frm_data 
 1438                        INNER JOIN frm_posts ON pos_top_fk = top_pk 
 1439                        WHERE top_frm_fk = %s 
 1440                        AND (pos_status = %s 
 1442                                        AND pos_author_id = %s 
 1445                        AND pos_author_id = %s',
 
 1446            array(
'integer', 
'integer', 
'integer', 
'integer', 
'integer'),
 
 1447            array($this->
getForumId(),
'1', 
'0', $this->
user->getId(), $a_user_id)
 
 1450        return $res->numRows();
 
 1471    public function addPostTree($a_tree_id, $a_node_id = -1, $a_date = 
'')
 
 1473        $a_date = $a_date ? $a_date : 
date(
"Y-m-d H:i:s");
 
 1475        if ($a_node_id <= 0) {
 
 1476            $a_node_id = $a_tree_id;
 
 1479        $nextId = $this->db->nextId(
'frm_posts_tree');
 
 1481        $this->db->manipulateF(
 
 1483                        INSERT INTO frm_posts_tree 
 1493                        VALUES(%s, %s, %s, %s,  %s,  %s, %s, %s )',
 
 1494            array(
'integer',
'integer', 
'integer', 
'integer', 
'integer', 
'integer', 
'integer', 
'timestamp'),
 
 1495            array($nextId, $a_tree_id, $a_node_id, 
'0', 
'1', 
'2', 
'1', $a_date)
 
 1510        $a_date = $a_date ? $a_date : 
date(
"Y-m-d H:i:s");
 
 1513        $sql_res = $this->db->queryf(
 
 1515                        SELECT * FROM frm_posts_tree 
 1518            array(
'integer', 
'integer'),
 
 1519            array($a_parent_id, $tree_id)
 
 1522        $res = $this->db->fetchObject($sql_res);
 
 1530        $this->db->manipulateF(
 
 1532                        UPDATE frm_posts_tree  
 1544            array(
'integer', 
'integer', 
'integer'),
 
 1545            array($left, $left, $tree_id)
 
 1548        $depth = $this->
getPostDepth($a_parent_id, $tree_id) + 1;
 
 1551        $nextId = $this->db->nextId(
'frm_posts_tree');
 
 1552        $this->db->manipulateF(
 
 1554                        INSERT INTO frm_posts_tree 
 1564                        VALUES(%s,%s,%s, %s, %s, %s,%s, %s)',
 
 1565             array(
'integer',
'integer', 
'integer', 
'integer', 
'integer', 
'integer', 
'integer', 
'timestamp'),
 
 1587            $sql_res = $this->db->queryf(
 
 1589                                SELECT depth FROM frm_posts_tree 
 1592                array(
'integer', 
'integer'),
 
 1593                array($a_node_id, $tree_id)
 
 1596            $res = $this->db->fetchObject($sql_res);
 
 1612        $res = $this->db->queryf(
 
 1614                        SELECT * FROM frm_posts, frm_posts_tree  
 1615                        WHERE pos_pk = pos_fk  
 1618            array(
'integer', 
'integer'),
 
 1619            array(
'0', $tree_id)
 
 1622        $row = $this->db->fetchObject(
$res);
 
 1635        $res = $this->db->queryf(
 
 1637                        SELECT * FROM frm_posts, frm_posts_tree  
 1638                        WHERE pos_pk = pos_fk  
 1644        $row = $this->db->fetchObject(
$res);
 
 1657        require_once(
'./Services/User/classes/class.ilObjUser.php');
 
 1660            $tmp_user = 
new ilObjUser($a_row->pos_display_user_id);
 
 1661            $fullname = $tmp_user->getFullname();
 
 1662            $loginname = $tmp_user->getLogin();
 
 1665        $fullname = $fullname ? $fullname : ($a_row->import_name ? $a_row->import_name : $this->lng->txt(
"unknown"));
 
 1668                    "pos_pk"            => $a_row->pos_pk,
 
 1669                    "child"         => $a_row->pos_pk,
 
 1670                    "author"            => $a_row->pos_display_user_id,
 
 1671                    "alias"                     => $a_row->pos_usr_alias,
 
 1672                    "title"         => $fullname,
 
 1673                    "loginname"         => $loginname,
 
 1675                    "message"           => $a_row->pos_message,
 
 1676                    "subject"           => $a_row->pos_subject,
 
 1677                    "pos_cens_com"      => $a_row->pos_cens_com,
 
 1678                    "pos_cens"          => $a_row->pos_cens,
 
 1680                    "date"                      => $a_row->fpt_date,
 
 1681                    "create_date"       => $a_row->pos_date,
 
 1682                    "update"            => $a_row->pos_update,
 
 1683                    "update_user"       => $a_row->update_user,
 
 1684                    "tree"                      => $a_row->thr_fk,
 
 1685                    "parent"            => $a_row->parent_pos,
 
 1686                    "lft"                       => $a_row->lft,
 
 1687                    "rgt"                       => $a_row->rgt,
 
 1688                    "depth"                     => $a_row->depth,
 
 1689                    "id"                        => $a_row->fpt_pk,
 
 1690                    "notify"            => $a_row->notify,
 
 1691                    "import_name"   => $a_row->import_name,
 
 1692                    "pos_status"   => $a_row->pos_status
 
 1707        $res = $this->db->queryf(
 
 1709                        SELECT * FROM frm_posts_tree 
 1712                        AND parent_pos = %s',
 
 1713            array(
'integer', 
'integer', 
'integer'),
 
 1714            array($a_node[
'tree'], $a_node[
'pos_pk'], $a_node[
'parent'])
 
 1717        while (
$row = $this->db->fetchObject(
$res)) {
 
 1718            $a_node[
"lft"] = 
$row->lft;
 
 1719            $a_node[
"rgt"] = 
$row->rgt;
 
 1722        $diff = $a_node[
"rgt"] - $a_node[
"lft"] + 1;
 
 1727                        SELECT * FROM frm_posts_tree  
 1728                        WHERE lft BETWEEN %s AND %s 
 1730            array(
'integer', 
'integer', 
'integer'),
 
 1731            array($a_node[
'lft'], $a_node[
'rgt'], $a_node[
'tree'])
 
 1736        while ($treeData = $this->db->fetchAssoc(
$result)) {
 
 1737            $del_id[] = $treeData[
"pos_fk"];
 
 1741        $this->db->manipulateF(
 
 1743                        DELETE FROM frm_posts_tree 
 1744                        WHERE lft BETWEEN %s AND %s 
 1746            array(
'integer', 
'integer', 
'integer'),
 
 1747            array($a_node[
'lft'], $a_node[
'rgt'], $a_node[
'tree'])
 
 1751        $this->db->manipulateF(
 
 1753                        UPDATE frm_posts_tree  
 1765            array(
'integer', 
'integer', 
'integer', 
'integer', 
'integer'),
 
 1766            array($a_node[
'lft'], $diff, $a_node[
'lft'], $diff, $a_node[
'tree'])
 
 1779        $checkTime = time() - (60*60);
 
 1781        if (
$_SESSION[
"frm_visit_" . $this->dbTable . 
"_" . $ID] < $checkTime) {
 
 1782            $_SESSION[
"frm_visit_" . $this->dbTable . 
"_" . $ID] = time();
 
 1783            $query = 
'UPDATE ' . $this->dbTable . 
' SET visits = visits + 1 WHERE ';
 
 1785            $data_type = array();
 
 1786            $data_value = array();
 
 1793                $res = $this->db->queryf(
$query, $data_type, $data_value);
 
 1807        if (
$type == 
'export') {
 
 1808            $this->replQuote1 = 
"<blockquote class=\"quote\"><hr size=\"1\" color=\"#000000\">";
 
 1809            $this->replQuote2 = 
"<hr size=\"1\" color=\"#000000\"/></blockquote>";
 
 1814            $lname = ($quote_user != 
"")
 
 1815                ? 
'="' . $quote_user . 
'"' 
 1818            $text = 
"[quote$lname]" . 
$text . 
"[/quote]";
 
 1821            $startZ = substr_count(
$text, 
"[quote");    
 
 1822            $endZ = substr_count(
$text, 
"[/quote]");
 
 1824            if ($startZ > 0 || $endZ > 0) {
 
 1826                if ($startZ > $endZ) {
 
 1827                    $diff = $startZ - $endZ;
 
 1829                    for (
$i = 0; 
$i < $diff; 
$i++) {
 
 1830                        if (
$type == 
'export') {
 
 1833                            $text .= 
"[/quote]";
 
 1836                } elseif ($startZ < $endZ) {
 
 1837                    $diff = $endZ - $startZ;
 
 1839                    for (
$i = 0; 
$i < $diff; 
$i++) {
 
 1840                        if (
$type == 
'export') {
 
 1849                    $text = preg_replace(
 
 1850                        '@\[(quote\s*?=\s*?"([^"]*?)"\s*?)\]@i',
 
 1851                        $this->replQuote1 . 
'<div class="ilForumQuoteHead">' . $this->lng->txt(
'quote') . 
' ($2)</div>',
 
 1855                    $text = str_replace(
 
 1857                        $this->replQuote1 . 
'<div class="ilForumQuoteHead">' . $this->lng->txt(
"quote") . 
'</div>',
 
 1861                    $text = str_replace(
"[/quote]", $this->replQuote2, 
$text);
 
 1866        if (
$type != 
'export') {
 
 1868                include_once 
'./Services/MathJax/classes/class.ilMathJax.php';
 
 1885        if (!is_array($a_ids)) {
 
 1888        include_once 
"./Modules/Forum/classes/class.ilFileDataForum.php";
 
 1891        foreach ($a_ids as $pos_id) {
 
 1892            $tmp_file_obj->setPosId($pos_id);
 
 1893            $files = $tmp_file_obj->getFilesOfPost();
 
 1895                $tmp_file_obj->unlinkFile(
$file[
"name"]);
 
 1898        unset($tmp_file_obj);
 
 1904        return $this->import_name;
 
 1908        $this->import_name = $a_import_name;
 
 1922            $res = $this->db->queryf(
 
 1924                                SELECT frm_notification.thread_id FROM frm_data, frm_notification, frm_threads  
 1925                                WHERE frm_notification.user_id = %s 
 1926                                AND frm_notification.thread_id = frm_threads.thr_pk  
 1927                                AND frm_threads.thr_top_fk = frm_data.top_pk  
 1928                                AND frm_data.top_frm_fk = %s 
 1929                                GROUP BY frm_notification.thread_id',
 
 1930                array(
'integer', 
'integer'),
 
 1931                array($user_id, $this->
id)
 
 1934            if (is_object(
$res) && 
$res->numRows() > 0) {
 
 1935                $thread_data = array();
 
 1936                $thread_data_types = array();
 
 1938                $query = 
' DELETE FROM frm_notification  
 1940                                                        AND thread_id IN (';
 
 1942                array_push($thread_data, $user_id);
 
 1943                array_push($thread_data_types, 
'integer');
 
 1947                while (
$row = $this->db->fetchAssoc(
$res)) {
 
 1948                    if ($counter < $res->numRows()) {
 
 1950                        array_push($thread_data, 
$row[
'thread_id']);
 
 1951                        array_push($thread_data_types, 
'integer');
 
 1956                        array_push($thread_data, 
$row[
'thread_id']);
 
 1957                        array_push($thread_data_types, 
'integer');
 
 1962                $this->db->manipulateF(
$query, $thread_data_types, $thread_data);
 
 1967            $nextId = $this->db->nextId(
'frm_notification');
 
 1969            $this->db->manipulateF(
 
 1971                                INSERT INTO frm_notification 
 1976                                VALUES(%s, %s, %s)',
 
 1977                array(
'integer',
'integer', 
'integer'),
 
 1978                array($nextId, $user_id, $this->
id)
 
 1992        $this->db->manipulateF(
 
 1994                        DELETE FROM frm_notification  
 1997            array(
'integer', 
'integer'),
 
 1998            array($user_id, $this->
id)
 
 2012            'SELECT COUNT(*) cnt FROM frm_notification WHERE user_id = %s AND frm_id = %s',
 
 2013            array(
'integer', 
'integer'),
 
 2014            array($user_id, $this->
id)
 
 2017        while ($record = $this->db->fetchAssoc(
$result)) {
 
 2018            return (
bool) $record[
'cnt'];
 
 2037            $nextId = $this->db->nextId(
'frm_notification');
 
 2038            $this->db->manipulateF(
 
 2040                                INSERT INTO frm_notification 
 2045                                VALUES (%s, %s, %s)',
 
 2046                array(
'integer', 
'integer', 
'integer'),
 
 2047                array($nextId, $user_id, $thread_id)
 
 2064                        SELECT COUNT(*) cnt FROM frm_notification  
 2066                        AND thread_id = %s',
 
 2067            array(
'integer', 
'integer'),
 
 2068            array($user_id, $thread_id)
 
 2072        while ($record = $this->db->fetchAssoc(
$result)) {
 
 2073            return (
bool) $record[
'cnt'];
 
 2085    public static function _getThreads($a_obj_id, $a_sort_mode = self::SORT_DATE)
 
 2090        switch ($a_sort_mode) {
 
 2097                $sort = 
'thr_subject';
 
 2103                        SELECT * FROM frm_threads  
 2104                        JOIN frm_data ON top_pk = thr_top_fk  
 2105                        WHERE top_frm_fk = %s 
 2107            array(
'integer', 
'text'),
 
 2108            array($a_obj_id, $sort)
 
 2112            $threads[
$row->thr_pk] = 
$row->thr_subject;
 
 2114        return $threads ? $threads : array();
 
 2124                        SELECT top_frm_fk FROM frm_data 
 2131            return $fdata[
"top_frm_fk"];
 
 2142        $res2 = 
$ilDB->queryf(
 
 2144                        SELECT pos_top_fk, pos_thr_fk, pos_pk FROM frm_posts, frm_data  
 2145                        WHERE pos_top_fk = top_pk  
 2147                        ORDER BY pos_date DESC',
 
 2152        if ($res2->numRows() == 0) {
 
 2157            while ($selData = 
$ilDB->fetchAssoc($res2)) {
 
 2162                $lastPost_top = $selData[
"pos_top_fk"] . 
"#" . $selData[
"pos_thr_fk"] . 
"#" . $selData[
"pos_pk"];
 
 2169            array(
'top_last_post' => array(
'text', $lastPost_top)),
 
 2170            array(
'top_frm_fk' => array(
'integer',  $a_obj_id))
 
 2183        $source_thread_obj = 
new ilForumTopic((
int) $source_id);
 
 2186        if ($source_thread_obj->getForumId() != $target_thread_obj->getForumId()) {
 
 2187            throw new ilException(
'not_allowed_to_merge_into_another_forum');
 
 2190        if ($source_thread_obj->getCreateDate() > $target_thread_obj->getCreateDate()) {
 
 2191            $merge_thread_source = $source_thread_obj;
 
 2192            $merge_thread_target = $target_thread_obj;
 
 2194            $merge_thread_source = $target_thread_obj;
 
 2195            $merge_thread_target = $source_thread_obj;
 
 2198        $thread_subject = $target_thread_obj->getSubject();
 
 2201        $targed_was_closed = $merge_thread_target->isClosed();
 
 2203        $merge_thread_source->close();
 
 2205        if ($targed_was_closed == 
false) {
 
 2206            $merge_thread_target->close();
 
 2209        $source_all_posts = $merge_thread_source->getAllPosts();
 
 2210        $source_root_node = $merge_thread_source->getFirstPostNode();
 
 2211        $target_root_node = $merge_thread_target->getFirstPostNode();
 
 2213        $add_difference = $target_root_node->getRgt();
 
 2216        include_once 
'Modules/Forum/classes/class.ilForumPostsTree.php';
 
 2218        $new_target_rgt = ($target_root_node->getRgt() + $source_root_node->getRgt());
 
 2221        $new_target_root = $target_root_node->getId();
 
 2224        foreach ($source_all_posts as 
$post) {
 
 2228            $posts_tree_obj->setPosFk(
$post->pos_pk);
 
 2230            if ($post_obj->getParentId() == 0) {
 
 2231                $posts_tree_obj->setParentPos($new_target_root);
 
 2234                $posts_tree_obj->setRgt(($post_obj->getRgt() + $add_difference) - 1);
 
 2235                $posts_tree_obj->setLft($target_root_node->getRgt());
 
 2237                $posts_tree_obj->setDepth(($post_obj->getDepth() + 1));
 
 2238                $posts_tree_obj->setSourceThreadId($merge_thread_source->getId());
 
 2240                $posts_tree_obj->setTargetThreadId($merge_thread_target->getId());
 
 2242                $posts_tree_obj->mergeParentPos();
 
 2244                $posts_tree_obj->setRgt(($post_obj->getRgt() + $add_difference) - 1);
 
 2245                $posts_tree_obj->setLft(($post_obj->getLft() + $add_difference) - 1);
 
 2247                $posts_tree_obj->setDepth(($post_obj->getDepth() + 1));
 
 2248                $posts_tree_obj->setSourceThreadId($merge_thread_source->getId());
 
 2250                $posts_tree_obj->setParentPos($post_obj->getParentId());
 
 2251                $posts_tree_obj->setTargetThreadId($merge_thread_target->getId());
 
 2253                $posts_tree_obj->merge();
 
 2258        include_once 
'Modules/Forum/classes/class.ilForumPost.php';
 
 2262        include_once 
'Modules/Forum/classes/class.ilForumNotification.php';
 
 2266        include_once 
'./Modules/Forum/classes/class.ilObjForum.php';
 
 2273        $post_date_source = $merge_thread_source->getLastPost()->getCreateDate();
 
 2274        $post_date_target = $merge_thread_target->getLastPost()->getCreateDate();
 
 2276        $target_last_post = $merge_thread_target->getLastPostString();
 
 2277        $exp              = explode(
'#', $target_last_post);
 
 2279        if ($post_date_source > $post_date_target) {
 
 2280            $exp[2] = $merge_thread_source->getLastPost()->getId();
 
 2282            $exp[2] = $merge_thread_target->getLastPost()->getId();
 
 2284        $new_thr_last_post = implode(
'#', $exp);
 
 2286        $num_posts_source  = (int) $merge_thread_source->getNumPosts();
 
 2287        $num_visits_source = (int) $merge_thread_source->getVisits();
 
 2288        $num_posts_target  = (int) $merge_thread_target->getNumPosts();
 
 2289        $num_visits_target = (int) $merge_thread_source->getVisits();
 
 2292        $frm_topic_obj->setNumPosts(($num_posts_source + $num_posts_target));
 
 2293        $frm_topic_obj->setVisits(($num_visits_source + $num_visits_target));
 
 2294        $frm_topic_obj->setLastPostString($new_thr_last_post);
 
 2295        $frm_topic_obj->setSubject($thread_subject);
 
 2296        $frm_topic_obj->setId($merge_thread_target->getId());
 
 2298        $frm_topic_obj->updateMergedThread();
 
 2304        if (!$targed_was_closed) {
 
 2305            $merge_thread_target->reopen();
 
 2308        $GLOBALS[
'ilAppEventHandler']->raise(
 
 2311            array(  
'source_thread_id'  => $merge_thread_source->getId(),
 
 2312                    'target_thread_id'  => $merge_thread_target->getId())
 
sprintf('%.4f', $callTime)
date( 'd-M-Y', $objPHPExcel->getProperties() ->getCreated())
An exception for terminatinating execution or to throw for unit testing.
error($a_errmsg)
set error message @access public
static formatDate(ilDateTime $date, $a_skip_day=false, $a_include_wd=false)
Format a date @access public.
@classDescription Date and time handling
Base class for ILIAS Exception handling.
This class handles all operations on files for the forum object.
Class to report exception.
Class ilForumDraftHistory.
static mergeThreadNotificiations($merge_source_thread_id, $merge_target_thread_id)
static mergePosts($source_thread_id, $target_thread_id)
static updateTargetRootRgt($root_node_id, $rgt)
const FORUM_OVERVIEW_WITH_NEW_POSTS
static getInstance($a_obj_id=0)
static deleteByThreadId($thr_id)
insert()
Inserts the object data into database.
setImportName($a_import_name)
enableNotification($a_user_id)
Enable a user's notification about new posts in a thread.
setCreateDate($a_createdate)
Class Forum core functions for forum.
countUserArticles($a_user_id)
get number of articles from given user-ID
getOnePost($post)
get one post-dataset
disableForumNotification($user_id)
Disable a user's notification about new posts in this forum.
getFirstPostNode($tree_id)
get data of the first node from frm_posts_tree and frm_posts @access public
fetchPostNodeData($a_row)
get data of parent node from frm_posts_tree and frm_posts @access private
static _lookupPostMessage($a_id)
countActiveUserArticles($a_user_id)
deletePostTree($a_node)
delete node and the whole subtree under this node @access public
__deletePostFiles($a_ids)
addPostTree($a_tree_id, $a_node_id=-1, $a_date='')
create a new post-tree
enableThreadNotification($user_id, $thread_id)
no usage? ..delete .
__construct()
Constructor @access public.
setForumId($a_obj_id)
set object id which refers to ILIAS obj_id
updateVisits($ID)
update page hits of given forum- or thread-ID @access public
getPostNode($post_id)
get data of given node from frm_posts_tree and frm_posts @access public
static $moderators_by_ref_id_map
setImportName($a_import_name)
getPostDepth($a_node_id, $tree_id)
Return depth of an object @access private.
static _isModerator($a_ref_id, $a_usr_id)
checks whether a user is moderator of a given forum object
getOneTopic()
get one topic-dataset by WhereCondition
generateThread(ilForumTopic $thread, $message, $notify, $notify_posts, $status=1)
prepareText($text, $edit=0, $quote_user='', $type='')
prepares given string @access public
getForumId()
get forum id @access public
postCensorship($message, $pos_pk, $cens=0)
update dataset in frm_posts with censorship info
generatePost($forum_id, $thread_id, $author_id, $display_user_id, $message, $parent_pos, $notify, $subject='', $alias='', $date='', $status=1, $send_activation_mail=0)
generate new dataset in frm_posts
static updateLastPostByObjId($a_obj_id)
static _getLanguageInstanceByUsrId($usr_id)
Get the ilLanguage instance for the passed user id.
convertDate($date)
converts the date format
getAllThreads($a_topic_id, array $params=array(), $limit=0, $offset=0)
isThreadNotificationEnabled($user_id, $thread_id)
Check whether a user's notification about new posts in a thread is enabled (result > 0) or not (resul...
moveThreads($thread_ids=array(), $src_ref_id=0, $dest_top_frm_fk=0)
Moves all chosen threads and their posts to a new forum.
getMDB2Query()
get content of additional condition
deletePost($post)
delete post and sub-posts
getOneThread()
get one thread-dataset by WhereCondition
setOrderField($orderField)
set database field for sorting results
getDbTable()
get name of database table
getPageHits()
get number of max.
setMDB2WhereCondition($query_string, $data_type, $data_value)
set content for additional condition
static _getThreads($a_obj_id, $a_sort_mode=self::SORT_DATE)
Get thread infos of object.
getUserStatistic($is_moderator=false)
static mergeThreads($obj_id, $source_id, $target_id)
isForumNotificationEnabled($user_id)
Check whether a user's notification about new posts in this forum is enabled (result > 0) or not (res...
getMDB2DataType()
get content of additional condition
static _lookupObjIdForForumId($a_for_id)
getFirstPostByThread($a_thread_id)
Get first post of thread.
setForumRefId($a_ref_id)
set reference id which refers to ILIAS obj_id
static _getModerators($a_ref_id)
get all users assigned to local role il_frm_moderator_<frm_ref_id> (static)
enableForumNotification($user_id)
Enable a user's notification about new posts in this forum.
getMDB2DataValue()
get content of additional condition
getModerators()
get all users assigned to local role il_frm_moderator_<frm_ref_id>
getForumRefId()
get forum ref_id @access public
setDbTable($dbTable)
set database table
getOrderField()
get name of orderField
insertPostNode($a_node_id, $a_parent_id, $tree_id, $a_date='')
insert node under parent node @access public
static getInstance()
Singleton: get instance.
static getFirstNewsIdForContext( $a_context_obj_id, $a_context_obj_type, $a_context_sub_obj_id="", $a_context_sub_obj_type="")
Get first new id of news set related to a certain context.
static _deleteReadEntries($a_post_id)
static _deleteAccessEntries($a_thread_id)
static mergeForumUserRead($merge_source_thread_id, $merge_target_thread_id)
static _lookupLanguage($a_usr_id)
static getInstanceByRefId($a_ref_id, $stop_on_error=true)
get an instance of an Ilias object by reference id
static _lookupTitle($a_id)
lookup object title
static _lookupObjectId($a_ref_id)
lookup object id
static _exists($a_id, $a_reference=false, $a_type=null)
checks if an object exists in object_data@access public
static _replaceMediaObjectImageSrc($a_text, $a_direction=0, $nic=IL_INST_ID)
Replaces image source from mob image urls with the mob id or replaces mob id with the correct image s...
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
catch(Exception $e) $message
if(!file_exists("$old.txt")) if( $old===$new) if(file_exists("$new.txt")) $file
foreach($_POST as $key=> $value) $res