60 public function __construct($a_id = 0, $a_call_by_reference =
true)
64 $this->rbac = $DIC->rbac();
65 $this->db = $DIC->database();
66 $this->ilBench = $DIC[
'ilBench'];
67 $this->
user = $DIC->user();
68 $this->logger = $DIC->logger()->root();
71 parent::__construct($a_id, $a_call_by_reference);
79 $new_deadline = time() - 60 * 60 * 24 * 7 * ($this->
settings->get(
'frm_store_new') ?
80 $this->
settings->get(
'frm_store_new') :
82 define(
'NEW_DEADLINE', $new_deadline);
93 $id = parent::create();
96 $properties->setDefaultView(1);
97 $properties->setAnonymisation(0);
98 $properties->setStatisticsStatus(0);
99 $properties->setPostActivation(0);
100 $properties->setThreadSorting(0);
101 $properties->insert();
115 parent::setPermissions($a_ref_id);
119 $this->rbac->admin()->assignUser($roles[0], $this->
getOwner(),
'n');
128 $this->db->manipulate(
'UPDATE frm_data SET top_mods = ' . $this->db->quote($role_id,
'integer') .
' WHERE top_frm_fk = ' . $this->db->quote($this->
getId(),
'integer'));
144 $ilDB = $DIC->database();
148 SELECT thr_subject FROM frm_threads WHERE thr_pk = %s',
154 return $row->thr_subject;
162 $a_frm_id = $this->
getId();
164 $this->ilBench->start(
"Forum",
'getCountRead');
167 $res = $this->db->queryf(
169 SELECT top_pk FROM frm_data WHERE top_frm_fk = %s',
175 while (
$row = $this->db->fetchObject(
$res)) {
176 $topic_id =
$row->top_pk;
180 $res = $this->db->queryf(
182 SELECT COUNT(pos_pk) num_posts 184 LEFT JOIN frm_posts_tree ON frm_posts_tree.pos_fk = pos_pk 185 WHERE pos_top_fk = %s' . ($ignoreRoot ?
' AND parent_pos != 0 ' :
''),
190 while (
$row = $this->db->fetchObject(
$res)) {
191 $num_posts =
$row->num_posts;
194 $res = $this->db->queryf(
196 SELECT COUNT(post_id) count_read FROM frm_user_read 199 array(
'integer',
'integer'),
200 array($a_frm_id, $a_usr_id)
203 while (
$row = $this->db->fetchObject(
$res)) {
204 $count_read =
$row->count_read;
206 $unread = $num_posts - $count_read;
208 $this->ilBench->stop(
"Forum",
'getCountRead');
209 return $unread > 0 ? $unread : 0;
211 $res = $this->db->queryf(
213 SELECT COUNT(pos_pk) num_posts FROM frm_posts 214 LEFT JOIN frm_posts_tree ON frm_posts_tree.pos_fk = pos_pk 215 WHERE pos_thr_fk = %s' . ($ignoreRoot ?
' AND parent_pos != 0 ' :
''),
220 $row = $this->db->fetchObject(
$res);
221 $num_posts =
$row->num_posts;
223 $res = $this->db->queryf(
225 SELECT COUNT(post_id) count_read FROM frm_user_read 229 array(
'integer',
'integer',
'integer'),
230 array($a_frm_id, $a_frm_id, $a_thread_id)
233 $row = $this->db->fetchObject(
$res);
234 $count_read =
$row->count_read;
236 $unread = $num_posts - $count_read;
238 $this->ilBench->stop(
"Forum",
'getCountRead');
239 return $unread > 0 ? $unread : 0;
241 $this->ilBench->stop(
"Forum",
'getCountRead');
249 $res = $this->db->queryf(
251 SELECT * FROM frm_posts WHERE pos_thr_fk = %s',
256 while (
$row = $this->db->fetchObject(
$res)) {
264 $res = $this->db->queryf(
266 SELECT * FROM frm_data, frm_threads 267 WHERE top_frm_fk = %s 268 AND top_pk = thr_top_fk',
270 array($this->
getId())
273 while (
$row = $this->db->fetchObject(
$res)) {
284 $res = $this->db->queryf(
286 SELECT * FROM frm_user_read 291 array(
'integer',
'integer',
'integer',
'integer'),
292 array($a_usr_id, $this->
getId(), $a_thread_id, $a_post_id)
295 if ($this->db->numRows(
$res)) {
299 $this->db->manipulateF(
301 INSERT INTO frm_user_read 307 VALUES (%s,%s,%s,%s)',
308 array(
'integer',
'integer',
'integer',
'integer'),
309 array($a_usr_id, $this->
getId(), $a_thread_id, $a_post_id)
317 $this->db->manipulateF(
319 DELETE FROM frm_user_read 322 array(
'integer',
'integer'),
323 array($a_user_id, $a_post_id)
327 public function isRead($a_usr_id, $a_post_id)
329 $res = $this->db->queryf(
331 SELECT * FROM frm_user_read 334 array(
'integer',
'integer'),
335 array($a_usr_id, $a_post_id)
338 return $this->db->numRows(
$res) ? true :
false;
343 $res = $this->db->queryf(
345 SELECT * FROM frm_thread_access 349 array(
'integer',
'integer',
'integer'),
350 array($a_usr_id, $this->
getId(), $a_thread_id)
357 'usr_id' => array(
'integer', $a_usr_id),
358 'obj_id' => array(
'integer', $this->
getId()),
359 'thread_id' => array(
'integer', $a_thread_id)
362 'access_last' => array(
'integer', time()),
363 'access_old' => array(
'integer', isset(
$data[
'access_old']) ?
$data[
'access_old'] : 0),
364 'access_old_ts' => array(
'timestamp', $data[
'access_old_ts'])
378 $ilDB = $DIC->database();
382 UPDATE frm_thread_access 383 SET access_old = access_last 390 "SELECT * FROM frm_thread_access " .
391 " WHERE usr_id = " .
$ilDB->quote($a_usr_id,
"integer")
393 while ($rec =
$ilDB->fetchAssoc($set)) {
395 "UPDATE frm_thread_access SET " .
396 " access_old_ts = " .
$ilDB->quote(date(
'Y-m-d H:i:s', $rec[
"access_old"]),
"timestamp") .
397 " WHERE usr_id = " .
$ilDB->quote($rec[
"usr_id"],
"integer") .
398 " AND obj_id = " .
$ilDB->quote($rec[
"obj_id"],
"integer") .
399 " AND thread_id = " .
$ilDB->quote($rec[
"thread_id"],
"integer")
403 $new_deadline = time() - 60 * 60 * 24 * 7 * ($DIC->settings()->get(
'frm_store_new') ?
404 $DIC->settings()->get(
'frm_store_new') :
409 DELETE FROM frm_thread_access WHERE access_last < %s',
418 $ilDB = $DIC->database();
420 $data = array($a_usr_id);
424 DELETE FROM frm_user_read WHERE usr_id = %s',
431 DELETE FROM frm_thread_access WHERE usr_id = %s',
439 DELETE FROM frm_notification WHERE user_id = %s',
451 $ilDB = $DIC->database();
455 DELETE FROM frm_user_read WHERE post_id = %s',
466 $ilDB = $DIC->database();
469 DELETE FROM frm_thread_access WHERE thread_id = %s',
481 public function update($a_update_user_id = 0)
483 if (!$a_update_user_id) {
484 $a_update_user_id = $this->
user->getId();
488 $this->db->manipulateF(
492 top_description = %s, 495 WHERE top_frm_fk =%s',
496 array(
'text',
'text',
'timestamp',
'integer',
'integer'),
501 (
int) $a_update_user_id,
518 public function cloneObject($a_target_id, $a_copy_id = 0, $a_omit_tree =
false)
521 $new_obj = parent::cloneObject($a_target_id, $a_copy_id, $a_omit_tree);
525 $this->Forum->setMDB2WhereCondition(
'top_frm_fk = %s ', array(
'integer'), array($this->
getId()));
526 $topData = $this->Forum->getOneTopic();
528 $this->db->update(
'frm_data', array(
529 'top_name' => array(
'text', $topData[
'top_name']),
530 'top_description' => array(
'text', $topData[
'top_description']),
531 'top_num_posts' => array(
'integer', $topData[
'top_num_posts']),
532 'top_num_threads' => array(
'integer', $topData[
'top_num_threads']),
533 'top_last_post' => array(
'text', $topData[
'top_last_post']),
534 'top_date' => array(
'timestamp', $topData[
'top_date']),
535 'visits' => array(
'integer', $topData[
'visits']),
536 'top_update' => array(
'timestamp', $topData[
'top_update']),
537 'update_user' => array(
'integer', $topData[
'update_user']),
538 'top_usr_id' => array(
'integer', $topData[
'top_usr_id'])
540 'top_frm_fk' => array(
'integer', $new_obj->getId())
547 $options[
'threads'] = $this->Forum->_getThreads($this->
getId());
550 $new_frm = $new_obj->Forum;
551 $new_frm->setMDB2WhereCondition(
'top_frm_fk = %s ', array(
'integer'), array($new_obj->getId()));
553 $new_frm->setForumId($new_obj->getId());
554 $new_frm->setForumRefId($new_obj->getRefId());
556 $new_topic = $new_frm->getOneTopic();
557 foreach (
$options[
'threads'] as $thread_id => $thread_subject) {
558 $this->Forum->setMDB2WhereCondition(
'thr_pk = %s ', array(
'integer'), array($thread_id));
560 $old_thread = $this->Forum->getOneThread();
562 $old_post_id = $this->Forum->getFirstPostByThread($old_thread[
'thr_pk']);
563 $old_post = $this->Forum->getOnePost($old_post_id);
566 $newThread->setSticky($old_thread[
'is_sticky']);
567 $newThread->setForumId($new_topic[
'top_pk']);
568 $newThread->setThrAuthorId($old_thread[
'thr_author_id']);
569 $newThread->setDisplayUserId($old_thread[
'thr_display_user_id']);
570 $newThread->setSubject($old_thread[
'thr_subject']);
571 $newThread->setUserAlias($old_thread[
'thr_usr_alias']);
572 $newThread->setCreateDate($old_thread[
'thr_date']);
574 $newPostId = $new_frm->generateThread(
584 $old_forum_files->ilClone($new_obj->getId(), $newPostId);
588 $targetRefId = $new_obj->getRefId();
591 $sourceRefId > 0 && $targetRefId > 0 &&
592 $this->tree->getParentId($sourceRefId) === $this->tree->getParentId($targetRefId)
594 $grpRefId = $this->tree->checkForParentType($targetRefId,
'grp');
595 $crsRefId = $this->tree->checkForParentType($targetRefId,
'crs');
597 if ($grpRefId > 0 || $crsRefId > 0) {
598 $notifications = new \ilForumNotification($targetRefId);
599 $notifications->cloneFromSource((
int) $sourceRefId);
617 if (!$moderator || !$new_moderator || !$this->
getRefId() || !$new_obj->getRefId()) {
618 $this->logger->write(__METHOD__ .
' : Error cloning auto generated role: il_frm_moderator');
620 $this->rbac->admin()->copyRolePermissions($moderator, $this->
getRefId(), $new_obj->getRefId(), $new_moderator,
true);
621 $this->logger->write(__METHOD__ .
' : Finished copying of role il_frm_moderator.');
625 $old_mods = $obj_mods->getCurrentModerators();
626 foreach ($old_mods as $user_id) {
629 if ($this->
getOwner() != $user_id) {
630 $this->rbac->admin()->assignUser($new_moderator, $user_id);
640 public function delete()
643 if (!parent::delete()) {
649 $tmp_file_obj->delete();
650 unset($tmp_file_obj);
652 $this->Forum->setMDB2WhereCondition(
'top_frm_fk = %s ', array(
'integer'), array($this->
getId()));
654 $topData = $this->Forum->getOneTopic();
656 $threads = $this->Forum->getAllThreads($topData[
'top_pk']);
657 foreach ($threads[
'items'] as $thread) {
658 $thread_ids_to_delete[$thread->getId()] = $thread->getId();
662 $this->db->manipulate(
'DELETE FROM frm_posts_tree WHERE ' . $this->db->in(
'thr_fk', $thread_ids_to_delete,
false,
'integer'));
665 $this->db->manipulate(
'DELETE FROM frm_posts WHERE ' . $this->db->in(
'pos_thr_fk', $thread_ids_to_delete,
false,
'integer'));
668 $this->db->manipulate(
'DELETE FROM frm_threads WHERE ' . $this->db->in(
'thr_pk', $thread_ids_to_delete,
false,
'integer'));
670 $obj_id = array($this->
getId());
672 $this->db->manipulateF(
673 'DELETE FROM frm_data WHERE top_frm_fk = %s',
679 $this->db->manipulateF(
680 'DELETE FROM frm_settings WHERE obj_id = %s',
686 $this->db->manipulateF(
687 'DELETE FROM frm_user_read WHERE obj_id = %s',
693 $this->db->manipulateF(
694 'DELETE FROM frm_thread_access WHERE obj_id = %s',
700 $this->db->manipulate(
'DELETE FROM frm_notification WHERE ' . $this->db->in(
'thread_id', $thread_ids_to_delete,
false,
'integer'));
703 $this->db->manipulateF(
'DELETE FROM frm_notification WHERE frm_id = %s', array(
'integer'), $obj_id);
706 $this->db->manipulateF(
'DELETE FROM frm_posts_deleted WHERE obj_id = %s', array(
'integer'), $obj_id);
719 $res = $this->db->queryF(
720 'SELECT draft_id FROM frm_posts_drafts WHERE forum_id = %s',
722 array((
int) $forum_id)
725 $draft_ids = array();
726 while (
$row = $this->db->fetchAssoc(
$res)) {
727 $draft_ids[] =
$row[
'draft_id'];
730 if (count($draft_ids) > 0) {
732 $historyObj->deleteHistoryByDraftIds($draft_ids);
735 $draftObj->deleteDraftsByDraftIds($draft_ids);
747 'il_frm_moderator_' . $this->
getRefId(),
748 "Moderator of forum obj_no." . $this->
getId(),
765 $ilDB = $DIC->database();
767 $mod_title =
'il_frm_moderator_' . $a_ref_id;
771 SELECT * FROM object_data WHERE title = %s',
787 if ($default_visibility ==
"public") {
796 $nextId = $this->db->nextId(
'frm_data');
799 'top_frm_fk' => $this->
getId(),
802 'top_num_posts' => 0,
803 'top_num_threads' => 0,
804 'top_last_post' => null,
805 'top_mods' => !is_numeric($a_roles[0]) ? 0 : $a_roles[0],
806 'top_usr_id' => $this->
user->getId(),
810 $this->db->manipulateF(
825 VALUES(%s, %s, %s, %s, %s, %s, %s, %s, %s, %s)',
826 array(
'integer',
'integer',
'text',
'text',
'integer',
'integer',
'text',
'integer',
'timestamp',
'integer'),
829 $top_data[
'top_frm_fk'],
830 $top_data[
'top_name'],
831 $top_data[
'top_description'],
832 $top_data[
'top_num_posts'],
833 $top_data[
'top_num_threads'],
834 $top_data[
'top_last_post'],
835 $top_data[
'top_mods'],
836 $top_data[
'top_date'],
837 $top_data[
'top_usr_id']
846 array(
'thread_sorting' => array(
'integer',$a_sorting_value)),
847 array(
'thr_pk' => array(
'integer', $a_thr_pk))
859 if (array_key_exists($obj_id, self::$obj_id_to_forum_id_cache)) {
860 return (
int) self::$obj_id_to_forum_id_cache[$obj_id];
863 self::preloadForumIdsByObjIds(array($obj_id));
865 return (
int) self::$obj_id_to_forum_id_cache[$obj_id];
875 if (array_key_exists(
$ref_id, self::$ref_id_to_forum_id_cache)) {
876 return (
int) self::$ref_id_to_forum_id_cache[
$ref_id];
879 self::preloadForumIdsByRefIds(array(
$ref_id));
881 return (
int) self::$ref_id_to_forum_id_cache[
$ref_id];
891 $ilDB = $DIC->database();
893 if (count($obj_ids) == 1) {
894 $in =
" objr.obj_id = " .
$ilDB->quote(current($obj_ids),
'integer') .
" ";
896 $in =
$ilDB->in(
'objr.obj_id', $obj_ids,
false,
'integer');
899 SELECT frmd.top_pk, objr.ref_id, objr.obj_id 900 FROM object_reference objr 901 INNER JOIN frm_data frmd ON frmd.top_frm_fk = objr.obj_id 907 foreach ($obj_ids as $obj_id) {
908 self::$obj_id_to_forum_id_cache[$obj_id] = null;
912 self::$obj_id_to_forum_id_cache[
$row[
'obj_id']] = $row[
'top_pk'];
913 self::$ref_id_to_forum_id_cache[$row[
'ref_id']] = $row[
'top_pk'];
924 $ilDB = $DIC->database();
926 if (count($ref_ids) == 1) {
927 $in =
" objr.ref_id = " .
$ilDB->quote(current($ref_ids),
'integer') .
" ";
929 $in =
$ilDB->in(
'objr.ref_id', $ref_ids,
false,
'integer');
932 SELECT frmd.top_pk, objr.ref_id, objr.obj_id 933 FROM object_reference objr 934 INNER JOIN frm_data frmd ON frmd.top_frm_fk = objr.obj_id 940 foreach ($ref_ids as
$ref_id) {
941 self::$ref_id_to_forum_id_cache[
$ref_id] = null;
945 self::$obj_id_to_forum_id_cache[
$row[
'obj_id']] = $row[
'top_pk'];
946 self::$ref_id_to_forum_id_cache[$row[
'ref_id']] = $row[
'top_pk'];
958 $ilAccess = $DIC->access();
960 $ilDB = $DIC->database();
963 if (isset(self::$forum_statistics_cache[
$ref_id])) {
964 return self::$forum_statistics_cache[
$ref_id];
969 'num_unread_posts' => 0,
973 $forumId = self::lookupForumIdByRefId($ref_id);
975 self::$forum_statistics_cache[
$ref_id] = $statistics;
976 return self::$forum_statistics_cache[
$ref_id];
980 $is_post_activation_enabled = $objProperties->isPostActivationEnabled();
984 if ($is_post_activation_enabled && !$ilAccess->checkAccess(
'moderate_frm',
'', $ref_id)) {
985 $act_clause .=
" AND (frm_posts.pos_status = " .
$ilDB->quote(1,
"integer") .
" OR frm_posts.pos_author_id = " .
$ilDB->quote(
$ilUser->getId(),
"integer") .
") ";
988 $new_deadline = date(
'Y-m-d H:i:s', time() - 60 * 60 * 24 * 7 * (
$ilSetting->get(
'frm_store_new') ?
$ilSetting->get(
'frm_store_new') : 8));
992 (SELECT COUNT(frm_posts.pos_pk) cnt 994 INNER JOIN frm_posts_tree tree1 995 ON tree1.pos_fk = frm_posts.pos_pk 996 AND tree1.parent_pos != 0 997 INNER JOIN frm_threads ON frm_posts.pos_thr_fk = frm_threads.thr_pk 998 WHERE frm_threads.thr_top_fk = %s $act_clause) 1002 (SELECT COUNT(DISTINCT(frm_user_read.post_id)) cnt 1004 INNER JOIN frm_posts ON frm_user_read.post_id = frm_posts.pos_pk 1005 INNER JOIN frm_posts_tree tree1 1006 ON tree1.pos_fk = frm_posts.pos_pk 1007 AND tree1.parent_pos != 0 1008 INNER JOIN frm_threads ON frm_threads.thr_pk = frm_posts.pos_thr_fk 1009 WHERE frm_user_read.usr_id = %s AND frm_posts.pos_top_fk = %s $act_clause) 1012 $types = array(
'integer',
'integer',
'integer');
1015 $forum_overview_setting = (int) $ilSetting::_lookupValue(
'frma',
'forum_overview');
1017 $news_types = array(
'integer',
'integer',
'integer',
'timestamp',
'integer');
1018 $news_values = array(
$ilUser->getId(),
$ilUser->getId(), $forumId, $new_deadline,
$ilUser->getId());
1023 (SELECT COUNT(frm_posts.pos_pk) cnt 1025 INNER JOIN frm_posts_tree tree1 1026 ON tree1.pos_fk = frm_posts.pos_pk 1027 AND tree1.parent_pos != 0 1028 LEFT JOIN frm_user_read ON (post_id = frm_posts.pos_pk AND frm_user_read.usr_id = %s) 1029 LEFT JOIN frm_thread_access ON (frm_thread_access.thread_id = frm_posts.pos_thr_fk AND frm_thread_access.usr_id = %s) 1030 WHERE frm_posts.pos_top_fk = %s 1031 AND ( (frm_posts.pos_update > frm_thread_access.access_old_ts) 1032 OR (frm_thread_access.access_old IS NULL AND frm_posts.pos_update > %s) 1034 AND frm_posts.pos_author_id != %s 1035 AND frm_user_read.usr_id IS NULL $act_clause)";
1037 $types = array_merge($types, $news_types);
1041 $mapping = array_keys($statistics);
1047 for (
$i = 0;
$i <= 2;
$i++) {
1050 $statistics[$mapping[
$i]] = (int)
$row[
'cnt'];
1054 $statistics[$mapping[
$i]] = $statistics[$mapping[
$i - 1]] - $statistics[$mapping[
$i]];
1059 SELECT COUNT(frm_posts.pos_pk) cnt 1061 INNER JOIN frm_posts_tree tree1 1062 ON tree1.pos_fk = frm_posts.pos_pk 1063 AND tree1.parent_pos != 0 1064 INNER JOIN frm_threads ON frm_posts.pos_thr_fk = frm_threads.thr_pk 1065 WHERE frm_threads.thr_top_fk = %s $act_clause 1067 $types = array(
'integer');
1076 $statistics = array(
1077 'num_posts' =>
$row[
'cnt'],
1078 'num_unread_posts' =>
$row[
'cnt'],
1079 'num_new_posts' =>
$row[
'cnt']
1083 self::$forum_statistics_cache[
$ref_id] = $statistics;
1085 return self::$forum_statistics_cache[
$ref_id];
1096 $ilAccess = $DIC->access();
1098 $ilDB = $DIC->database();
1100 if (isset(self::$forum_last_post_cache[
$ref_id])) {
1101 return self::$forum_last_post_cache[
$ref_id];
1104 $forumId = self::lookupForumIdByRefId($ref_id);
1106 self::$forum_last_post_cache[
$ref_id] = array();
1107 return self::$forum_last_post_cache[
$ref_id];
1111 if (!$ilAccess->checkAccess(
'moderate_frm',
'', $ref_id)) {
1112 $act_clause .=
" AND (frm_posts.pos_status = " .
$ilDB->quote(1,
"integer") .
" OR frm_posts.pos_author_id = " .
$ilDB->quote(
$ilUser->getId(),
"integer") .
") ";
1115 $ilDB->setLimit(1, 0);
1119 INNER JOIN frm_posts_tree tree1 1120 ON tree1.pos_fk = frm_posts.pos_pk 1121 AND tree1.parent_pos != 0 1122 WHERE pos_top_fk = %s $act_clause 1123 ORDER BY pos_date DESC 1135 return self::$forum_last_post_cache[
$ref_id];
1147 $ilAccess = $DIC->access();
1149 $ilDB = $DIC->database();
1152 $act_inner_clause =
'';
1153 if (!$ilAccess->checkAccess(
'moderate_frm',
'',
$ref_id)) {
1154 $act_clause .=
" AND (t1.pos_status = " .
$ilDB->quote(1,
"integer") .
" OR t1.pos_author_id = " .
$ilDB->quote(
$ilUser->getId(),
"integer") .
") ";
1155 $act_inner_clause .=
" AND (t3.pos_status = " .
$ilDB->quote(1,
"integer") .
" OR t3.pos_author_id = " .
$ilDB->quote(
$ilUser->getId(),
"integer") .
") ";
1158 $in =
$ilDB->in(
"t1.pos_thr_fk", $thread_ids,
false,
'integer');
1159 $inner_in =
$ilDB->in(
"t3.pos_thr_fk", $thread_ids,
false,
'integer');
1162 SELECT t1.pos_display_user_id, t1.update_user 1164 INNER JOIN frm_posts_tree tree1 ON tree1.pos_fk = t1.pos_pk AND tree1.parent_pos != 0 1166 SELECT t3.pos_thr_fk, MAX(t3.pos_date) pos_date 1168 INNER JOIN frm_posts_tree tree2 ON tree2.pos_fk = t3.pos_pk AND tree2.parent_pos != 0 1169 WHERE $inner_in $act_inner_clause 1170 GROUP BY t3.pos_thr_fk 1171 ) t2 ON t2.pos_thr_fk = t1.pos_thr_fk AND t2.pos_date = t1.pos_date 1172 WHERE $in $act_clause 1173 GROUP BY t1.pos_thr_fk, t1.pos_display_user_id, t1.update_user 1180 if ((
int)
$row[
'pos_display_user_id']) {
1181 $usr_ids[] = (int)
$row[
'pos_display_user_id'];
1183 if ((
int)
$row[
'update_user']) {
1184 $usr_ids[] = (int)
$row[
'update_user'];
1188 return array_unique($usr_ids);
1194 $ilDB = $DIC->database();
1198 array(
'thread_id' => array(
'integer', $merge_target_thread_id)),
1199 array(
'thread_id' => array(
'integer',$merge_source_thread_id))
static $forum_last_post_cache
markAllThreadsRead($a_usr_id)
static mergeForumUserRead($merge_source_thread_id, $merge_target_thread_id)
Class Forum core functions for forum.
static _write($a_type, $a_setting, $a_value, $a_user=0, $a_block_id=0)
Write setting to database.
update($a_update_user_id=0)
update forum data public
static _lookupPostMessage($a_id)
setThreadSorting($a_thr_pk, $a_sorting_value)
static lookupForumIdByObjId($obj_id)
static lookupForumIdByRefId($ref_id)
static $obj_id_to_forum_id_cache
initDefaultRoles()
init default roles settings public
deleteDraftsByForumId($forum_id)
markPostRead($a_usr_id, $a_thread_id, $a_post_id)
markThreadRead($a_usr_id, $a_thread_id)
static preloadForumIdsByObjIds(array $obj_ids)
setPermissions($a_ref_id)
getOwner()
get object owner
static now()
Return current timestamp in Y-m-d H:i:s format.
static createDefaultRole($a_title, $a_description, $a_tpl_name, $a_ref_id)
Class ilForumDraftHistory.
markPostUnread($a_user_id, $a_post_id)
saveData($a_roles=array())
static _lookupObjectId($a_ref_id)
lookup object id
updateLastAccess($a_usr_id, $a_thread_id)
static _deleteReadEntries($a_post_id)
static getInstance($a_obj_id=0)
static _getInstance($a_copy_id)
Get instance of copy wizard options.
updateModeratorRole($role_id)
static _lookupThreadSubject($a_thread_id)
foreach($_POST as $key=> $value) $res
getId()
get object id public
static _lookupDiskUsage($a_obj_id)
Returns the number of bytes used on the harddisk by the specified forum.
static _lookupModeratorRole($a_ref_id)
Lookup moderator role public.
getTitle()
get object title public
getDescription()
get object description
static _updateOldAccess($a_usr_id)
if(php_sapi_name() !='cli') $in
update($pash, $contents, Config $config)
static _deleteAccessEntries($a_thread_id)
static $forum_statistics_cache
const FORUM_OVERVIEW_WITH_NEW_POSTS
static _deleteUser($a_usr_id)
isRead($a_usr_id, $a_post_id)
This class handles all operations on files for the forum object.
static _getDefaultVisibilityForRefId($a_ref_id)
Get default visibility for reference id.
getRefId()
get reference id public
static lookupStatisticsByRefId($ref_id)
__construct($a_id=0, $a_call_by_reference=true)
Constructor public.
static $ref_id_to_forum_id_cache
getCountUnread($a_usr_id, $a_thread_id=0, $ignoreRoot=false)
cloneAutoGeneratedRoles($new_obj)
Clone forum moderator role public.
static getUserIdsOfLastPostsByRefIdAndThreadIds($ref_id, array $thread_ids)
static preloadForumIdsByRefIds(array $ref_ids)
getDiskUsage()
Gets the disk usage of the object in bytes.
static lookupLastPostByRefId($ref_id)