4 require_once
'Services/Object/classes/class.ilObject.php';
5 require_once
'Modules/Forum/classes/class.ilForum.php';
6 require_once
'Modules/Forum/classes/class.ilFileDataForum.php';
7 require_once
'Modules/Forum/classes/class.ilForumProperties.php';
59 public function __construct($a_id = 0, $a_call_by_reference =
true)
62 parent::__construct($a_id, $a_call_by_reference);
70 $new_deadline = time() - 60 * 60 * 24 * 7 * ($this->
ilias->getSetting(
'frm_store_new') ?
71 $this->
ilias->getSetting(
'frm_store_new') :
73 define(
'NEW_DEADLINE', $new_deadline);
84 $id = parent::create();
86 require_once
'Modules/Forum/classes/class.ilForumProperties.php';
88 $properties->setDefaultView(1);
89 $properties->setAnonymisation(0);
90 $properties->setStatisticsStatus(0);
91 $properties->setPostActivation(0);
92 $properties->setThreadSorting(0);
93 $properties->insert();
112 parent::setPermissions($a_ref_id);
115 $roles = array(ilObjForum::_lookupModeratorRole($this->
getRefId()));
116 $rbacadmin->assignUser($roles[0], $this->
getOwner(),
'n');
117 $this->updateModeratorRole($roles[0]);
123 public function updateModeratorRole($role_id)
130 $ilDB->manipulate(
'UPDATE frm_data SET top_mods = ' . $ilDB->quote($role_id,
'integer') .
' WHERE top_frm_fk = ' . $ilDB->quote($this->
getId(),
'integer'));
140 require_once(
"./Modules/File/classes/class.ilObjFileAccess.php");
141 return ilObjForumAccess::_lookupDiskUsage($this->
id);
144 public static function _lookupThreadSubject($a_thread_id)
152 $res = $ilDB->queryf(
' 153 SELECT thr_subject FROM frm_threads WHERE thr_pk = %s',
154 array(
'integer'), array($a_thread_id));
156 while(
$row = $ilDB->fetchObject(
$res))
158 return $row->thr_subject;
164 public function getCountUnread($a_usr_id, $a_thread_id = 0)
172 $a_frm_id = $this->
getId();
179 $ilBench->start(
"Forum",
'getCountRead');
183 $res = $ilDB->queryf(
' 184 SELECT top_pk FROM frm_data WHERE top_frm_fk = %s',
185 array(
'integer'), array($a_frm_id));
188 while(
$row = $ilDB->fetchObject(
$res))
190 $topic_id =
$row->top_pk;
194 $res = $ilDB->queryf(
' 195 SELECT COUNT(pos_pk) num_posts FROM frm_posts 196 WHERE pos_top_fk = %s',
197 array(
'integer'), array($topic_id));
199 while(
$row = $ilDB->fetchObject(
$res))
201 $num_posts =
$row->num_posts;
204 $res = $ilDB->queryf(
' 205 SELECT COUNT(post_id) count_read FROM frm_user_read 208 array(
'integer',
'integer'), array($a_frm_id, $a_usr_id));
210 while(
$row = $ilDB->fetchObject(
$res))
212 $count_read =
$row->count_read;
214 $unread = $num_posts - $count_read;
216 $ilBench->stop(
"Forum",
'getCountRead');
217 return $unread > 0 ? $unread : 0;
221 $res = $ilDB->queryf(
' 222 SELECT COUNT(pos_pk) num_posts FROM frm_posts 223 WHERE pos_thr_fk = %s',
224 array(
'integer'), array($a_thread_id));
227 $num_posts =
$row->num_posts;
229 $res = $ilDB->queryf(
' 230 SELECT COUNT(post_id) count_read FROM frm_user_read 234 array(
'integer',
'integer',
'integer'), array($a_frm_id, $a_frm_id, $a_thread_id));
237 $count_read =
$row->count_read;
239 $unread = $num_posts - $count_read;
241 $ilBench->stop(
"Forum",
'getCountRead');
242 return $unread > 0 ? $unread : 0;
244 $ilBench->stop(
"Forum",
'getCountRead');
249 public function markThreadRead($a_usr_id, $a_thread_id)
257 $res = $ilDB->queryf(
' 258 SELECT * FROM frm_posts WHERE pos_thr_fk = %s',
259 array(
'integer'), array($a_thread_id));
261 while(
$row = $ilDB->fetchObject(
$res))
263 $this->markPostRead($a_usr_id, $a_thread_id,
$row->pos_pk);
268 public function markAllThreadsRead($a_usr_id)
275 $res = $ilDB->queryf(
' 276 SELECT * FROM frm_data, frm_threads 277 WHERE top_frm_fk = %s 278 AND top_pk = thr_top_fk',
279 array(
'integer'), array($this->
getId()));
281 while(
$row = $ilDB->fetchObject(
$res))
283 $this->markThreadRead($a_usr_id,
$row->thr_pk);
290 public function markPostRead($a_usr_id, $a_thread_id, $a_post_id)
298 $res = $ilDB->queryf(
' 299 SELECT * FROM frm_user_read 304 array(
'integer',
'integer',
'integer',
'integer'),
305 array($a_usr_id, $this->
getId(), $a_thread_id, $a_post_id));
307 if($ilDB->numRows(
$res))
312 $res = $ilDB->manipulateF(
' 313 INSERT INTO frm_user_read 319 VALUES (%s,%s,%s,%s)',
320 array(
'integer',
'integer',
'integer',
'integer'),
321 array($a_usr_id, $this->
getId(), $a_thread_id, $a_post_id));
326 public function markPostUnread($a_user_id, $a_post_id)
333 $res = $ilDB->manipulateF(
' 334 DELETE FROM frm_user_read 337 array(
'integer',
'integer'),
338 array($a_user_id, $a_post_id));
341 public function isRead($a_usr_id, $a_post_id)
348 $res = $ilDB->queryf(
' 349 SELECT * FROM frm_user_read 352 array(
'integer',
'integer'),
353 array($a_usr_id, $a_post_id));
355 return $ilDB->numRows(
$res) ? true :
false;
358 public function updateLastAccess($a_usr_id, $a_thread_id)
365 $res = $ilDB->queryf(
' 366 SELECT * FROM frm_thread_access 370 array(
'integer',
'integer',
'integer'),
371 array($a_usr_id, $this->
getId(), $a_thread_id));
377 'usr_id' => array(
'integer', $a_usr_id),
378 'obj_id' => array(
'integer', $this->
getId()),
379 'thread_id' => array(
'integer', $a_thread_id)
382 'access_last' => array(
'integer', time()),
383 'access_old' => array(
'integer', isset(
$data[
'access_old']) ?
$data[
'access_old'] : 0),
384 'access_old_ts' => array(
'timestamp', $data[
'access_old_ts'])
395 public static function _updateOldAccess($a_usr_id)
404 UPDATE frm_thread_access 405 SET access_old = access_last 407 array(
'integer'), array($a_usr_id));
409 $set = $ilDB->query(
"SELECT * FROM frm_thread_access " .
410 " WHERE usr_id = " . $ilDB->quote($a_usr_id,
"integer")
412 while($rec = $ilDB->fetchAssoc($set))
414 $ilDB->manipulate(
"UPDATE frm_thread_access SET " .
415 " access_old_ts = " . $ilDB->quote(date(
'Y-m-d H:i:s', $rec[
"access_old"]),
"timestamp") .
416 " WHERE usr_id = " . $ilDB->quote($rec[
"usr_id"],
"integer") .
417 " AND obj_id = " . $ilDB->quote($rec[
"obj_id"],
"integer") .
418 " AND thread_id = " . $ilDB->quote($rec[
"thread_id"],
"integer")
422 $new_deadline = time() - 60 * 60 * 24 * 7 * ($ilias->getSetting(
'frm_store_new') ?
423 $ilias->getSetting(
'frm_store_new') :
427 DELETE FROM frm_thread_access WHERE access_last < %s',
428 array(
'integer'), array($new_deadline));
431 function _deleteUser($a_usr_id)
438 $data = array($a_usr_id);
440 $res = $ilDB->manipulateF(
' 441 DELETE FROM frm_user_read WHERE usr_id = %s',
442 array(
'integer'),
$data 445 $res = $ilDB->manipulateF(
' 446 DELETE FROM frm_thread_access WHERE usr_id = %s',
447 array(
'integer'),
$data 452 DELETE FROM frm_notification WHERE user_id = %s',
453 array(
'integer'),
$data);
459 function _deleteReadEntries($a_post_id)
466 $statement = $ilDB->manipulateF(
' 467 DELETE FROM frm_user_read WHERE post_id = %s',
468 array(
'integer'), array($a_post_id));
473 function _deleteAccessEntries($a_thread_id)
480 $statement = $ilDB->manipulateF(
' 481 DELETE FROM frm_thread_access WHERE thread_id = %s',
482 array(
'integer'), array($a_thread_id));
501 $statement = $ilDB->manipulateF(
' 504 top_description = %s, 507 WHERE top_frm_fk =%s',
508 array(
'text',
'text',
'timestamp',
'integer',
'integer'),
529 public function cloneObject($a_target_id, $a_copy_id = 0)
536 $new_obj = parent::cloneObject($a_target_id, $a_copy_id);
537 $this->cloneAutoGeneratedRoles($new_obj);
540 $this->Forum->setMDB2WhereCondition(
'top_frm_fk = %s ', array(
'integer'), array($this->
getId()));
541 $topData = $this->Forum->getOneTopic();
543 $ilDB->update(
'frm_data', array(
544 'top_name' => array(
'text', $topData[
'top_name']),
545 'top_description' => array(
'text', $topData[
'top_description']),
546 'top_num_posts' => array(
'integer', $topData[
'top_num_posts']),
547 'top_num_threads' => array(
'integer', $topData[
'top_num_threads']),
548 'top_last_post' => array(
'text', $topData[
'top_last_post']),
549 'top_date' => array(
'timestamp', $topData[
'top_date']),
550 'visits' => array(
'integer', $topData[
'visits']),
551 'top_update' => array(
'timestamp', $topData[
'top_update']),
552 'update_user' => array(
'integer', $topData[
'update_user']),
553 'top_usr_id' => array(
'integer', $topData[
'top_usr_id'])
555 'top_frm_fk' => array(
'integer', $new_obj->getId())
559 include_once(
'Services/CopyWizard/classes/class.ilCopyWizardOptions.php');
564 $options[
'threads'] = $this->Forum->_getThreads($this->
getId());
567 include_once(
'Modules/Forum/classes/class.ilFileDataForum.php');
569 $new_frm = $new_obj->Forum;
570 $new_frm->setMDB2WhereCondition(
'top_frm_fk = %s ', array(
'integer'), array($new_obj->getId()));
572 $new_frm->setForumId($new_obj->getId());
573 $new_frm->setForumRefId($new_obj->getRefId());
575 $new_topic = $new_frm->getOneTopic();
576 foreach(
$options[
'threads'] as $thread_id=> $thread_subject)
578 $this->Forum->setMDB2WhereCondition(
'thr_pk = %s ', array(
'integer'), array($thread_id));
580 $old_thread = $this->Forum->getOneThread();
582 $old_post_id = $this->Forum->getFirstPostByThread($old_thread[
'thr_pk']);
583 $old_post = $this->Forum->getOnePost($old_post_id);
587 $new_post = $new_frm->generateThread(
588 $new_topic[
'top_pk'],
589 $old_thread[
'thr_author_id'],
590 $old_thread[
'thr_display_user_id'],
591 $old_thread[
'thr_subject'],
595 $old_thread[
'thr_usr_alias'],
596 $old_thread[
'thr_date']);
599 $old_forum_files->ilClone($new_obj->getId(), $new_post);
611 public function cloneAutoGeneratedRoles($new_obj)
617 global
$ilLog, $rbacadmin;
619 $moderator = ilObjForum::_lookupModeratorRole($this->
getRefId());
620 $new_moderator = ilObjForum::_lookupModeratorRole($new_obj->getRefId());
622 if(!$moderator || !$new_moderator || !$this->
getRefId() || !$new_obj->getRefId())
624 $ilLog->write(__METHOD__ .
' : Error cloning auto generated role: il_frm_moderator');
626 $rbacadmin->copyRolePermissions($moderator, $this->
getRefId(), $new_obj->getRefId(), $new_moderator,
true);
627 $ilLog->write(__METHOD__ .
' : Finished copying of role il_frm_moderator.');
629 include_once
'./Modules/Forum/classes/class.ilForumModerators.php';
632 $old_mods = $obj_mods->getCurrentModerators();
633 foreach($old_mods as $user_id)
639 $rbacadmin->assignUser($new_moderator, $user_id);
649 public function delete()
657 if(!parent::delete())
664 $tmp_file_obj->delete();
665 unset($tmp_file_obj);
667 $this->Forum->setMDB2WhereCondition(
'top_frm_fk = %s ', array(
'integer'), array($this->
getId()));
669 $topData = $this->Forum->getOneTopic();
671 $threads = $this->Forum->getAllThreads($topData[
'top_pk']);
672 foreach($threads[
'items'] as $thread)
674 $thread_ids_to_delete[$thread->getId()] = $thread->getId();
678 $ilDB->manipulate(
'DELETE FROM frm_posts_tree WHERE '. $ilDB->in(
'thr_fk', $thread_ids_to_delete,
false,
'integer'));
681 $ilDB->manipulate(
'DELETE FROM frm_posts WHERE '. $ilDB->in(
'pos_thr_fk', $thread_ids_to_delete,
false,
'integer'));
684 $ilDB->manipulate(
'DELETE FROM frm_threads WHERE '. $ilDB->in(
'thr_pk', $thread_ids_to_delete,
false,
'integer'));
686 $obj_id = array($this->
getId());
688 $ilDB->manipulateF(
'DELETE FROM frm_data WHERE top_frm_fk = %s',
689 array(
'integer'), $obj_id);
692 $ilDB->manipulateF(
'DELETE FROM frm_settings WHERE obj_id = %s',
693 array(
'integer'), $obj_id);
696 $ilDB->manipulateF(
'DELETE FROM frm_user_read WHERE obj_id = %s',
697 array(
'integer'), $obj_id);
700 $ilDB->manipulateF(
'DELETE FROM frm_thread_access WHERE obj_id = %s',
701 array(
'integer'), $obj_id);
704 $ilDB->manipulate(
'DELETE FROM frm_notification WHERE '. $ilDB->in(
'thread_id', $thread_ids_to_delete,
false,
'integer'));
707 $ilDB->manipulateF(
'DELETE FROM frm_notification WHERE frm_id = %s', array(
'integer'), $obj_id);
719 include_once
'./Services/AccessControl/classes/class.ilObjRole.php';
721 'il_frm_moderator_'.$this->
getRefId(),
722 "Moderator of forum obj_no.".$this->
getId(),
736 public static function _lookupModeratorRole($a_ref_id)
743 $mod_title =
'il_frm_moderator_' . $a_ref_id;
745 $res = $ilDB->queryf(
' 746 SELECT * FROM object_data WHERE title = %s',
747 array(
'text'), array($mod_title));
749 while(
$row = $ilDB->fetchObject(
$res))
760 include_once(
"./Services/News/classes/class.ilNewsItem.php");
762 if($default_visibility ==
"public")
770 public function saveData($a_roles = array())
778 $nextId = $ilDB->nextId(
'frm_data');
781 'top_frm_fk' => $this->
getId(),
784 'top_num_posts' => 0,
785 'top_num_threads' => 0,
786 'top_last_post' => NULL,
787 'top_mods' => !is_numeric($a_roles[0]) ? 0 : $a_roles[0],
788 'top_usr_id' => $ilUser->getId(),
806 VALUES(%s, %s, %s, %s, %s, %s, %s, %s, %s, %s)',
807 array(
'integer',
'integer',
'text',
'text',
'integer',
'integer',
'text',
'integer',
'timestamp',
'integer'),
810 $top_data[
'top_frm_fk'],
811 $top_data[
'top_name'],
812 $top_data[
'top_description'],
813 $top_data[
'top_num_posts'],
814 $top_data[
'top_num_threads'],
815 $top_data[
'top_last_post'],
816 $top_data[
'top_mods'],
817 $top_data[
'top_date'],
818 $top_data[
'top_usr_id']
826 $ilDB->update(
'frm_threads',
827 array(
'thread_sorting' => array(
'integer',$a_sorting_value)),
828 array(
'thr_pk' => array(
'integer', $a_thr_pk)));
839 if(array_key_exists($obj_id, self::$obj_id_to_forum_id_cache))
841 return (
int)self::$obj_id_to_forum_id_cache[$obj_id];
844 self::preloadForumIdsByObjIds(array($obj_id));
846 return (
int)self::$obj_id_to_forum_id_cache[$obj_id];
856 if(array_key_exists(
$ref_id, self::$ref_id_to_forum_id_cache))
858 return (
int)self::$ref_id_to_forum_id_cache[
$ref_id];
861 self::preloadForumIdsByRefIds(array(
$ref_id));
863 return (
int)self::$ref_id_to_forum_id_cache[
$ref_id];
870 public static function preloadForumIdsByObjIds(array $obj_ids)
877 if(count($obj_ids) == 1)
879 $in =
" objr.obj_id = " . $ilDB->quote(current($obj_ids),
'integer') .
" ";
883 $in = $ilDB->in(
'objr.obj_id', $obj_ids,
false,
'integer');
886 SELECT frmd.top_pk, objr.ref_id, objr.obj_id 887 FROM object_reference objr 888 INNER JOIN frm_data frmd ON frmd.top_frm_fk = objr.obj_id 894 foreach($obj_ids as $obj_id)
896 self::$obj_id_to_forum_id_cache[$obj_id] = null;
899 while(
$row = $ilDB->fetchAssoc(
$res))
901 self::$obj_id_to_forum_id_cache[
$row[
'obj_id']] = $row[
'top_pk'];
902 self::$ref_id_to_forum_id_cache[$row[
'ref_id']] = $row[
'top_pk'];
910 public static function preloadForumIdsByRefIds(array $ref_ids)
917 if(count($ref_ids) == 1)
919 $in =
" objr.ref_id = " . $ilDB->quote(current($ref_ids),
'integer') .
" ";
923 $in = $ilDB->in(
'objr.ref_id', $ref_ids,
false,
'integer');
926 SELECT frmd.top_pk, objr.ref_id, objr.obj_id 927 FROM object_reference objr 928 INNER JOIN frm_data frmd ON frmd.top_frm_fk = objr.obj_id 936 self::$ref_id_to_forum_id_cache[
$ref_id] = null;
939 while(
$row = $ilDB->fetchAssoc(
$res))
941 self::$obj_id_to_forum_id_cache[
$row[
'obj_id']] = $row[
'top_pk'];
942 self::$ref_id_to_forum_id_cache[$row[
'ref_id']] = $row[
'top_pk'];
951 public static function lookupStatisticsByRefId(
$ref_id)
961 if(isset(self::$forum_statistics_cache[
$ref_id]))
963 return self::$forum_statistics_cache[
$ref_id];
968 'num_unread_posts' => 0,
972 $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))
986 $act_clause .=
" AND (frm_posts.pos_status = " . $ilDB->quote(1,
"integer") .
" OR frm_posts.pos_author_id = " . $ilDB->quote($ilUser->getId(),
"integer") .
") ";
989 $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));
991 if(!$ilUser->isAnonymous())
994 (SELECT COUNT(frm_posts.pos_pk) cnt 996 INNER JOIN frm_threads ON frm_posts.pos_thr_fk = frm_threads.thr_pk 997 WHERE frm_threads.thr_top_fk = %s $act_clause) 1001 (SELECT COUNT(DISTINCT(frm_user_read.post_id)) cnt 1003 INNER JOIN frm_posts ON frm_user_read.post_id = frm_posts.pos_pk 1004 INNER JOIN frm_threads ON frm_threads.thr_pk = frm_posts.pos_thr_fk 1005 WHERE frm_user_read.usr_id = %s AND frm_posts.pos_top_fk = %s $act_clause) 1008 $types = array(
'integer',
'integer',
'integer');
1009 $values = array($forumId, $ilUser->getId(), $forumId);
1011 $forum_overview_setting = (int)$ilSetting::_lookupValue(
'frma',
'forum_overview');
1014 $news_types = array(
'integer',
'integer',
'integer',
'timestamp',
'integer');
1015 $news_values = array($ilUser->getId(), $ilUser->getId(), $forumId, $new_deadline, $ilUser->getId());
1020 (SELECT COUNT(frm_posts.pos_pk) cnt 1022 LEFT JOIN frm_user_read ON (post_id = frm_posts.pos_pk AND frm_user_read.usr_id = %s) 1023 LEFT JOIN frm_thread_access ON (frm_thread_access.thread_id = frm_posts.pos_thr_fk AND frm_thread_access.usr_id = %s) 1024 WHERE frm_posts.pos_top_fk = %s 1025 AND ( (frm_posts.pos_update > frm_thread_access.access_old_ts) 1026 OR (frm_thread_access.access_old IS NULL AND frm_posts.pos_update > %s) 1028 AND frm_posts.pos_author_id != %s 1029 AND frm_user_read.usr_id IS NULL $act_clause)";
1031 $types = array_merge($types, $news_types);
1032 $values = array_merge($values, $news_values);
1035 $mapping = array_keys($statistics);
1036 $res = $ilDB->queryF(
1041 for($i = 0; $i <= 2; $i++)
1045 $statistics[$mapping[$i]] = (int)
$row[
'cnt'];
1050 $statistics[$mapping[$i]] = $statistics[$mapping[$i - 1]] - $statistics[$mapping[$i]];
1057 SELECT COUNT(frm_posts.pos_pk) cnt 1059 INNER JOIN frm_threads ON frm_posts.pos_thr_fk = frm_threads.thr_pk 1060 WHERE frm_threads.thr_top_fk = %s $act_clause 1062 $types = array(
'integer');
1063 $values = array($forumId);
1064 $res = $ilDB->queryF(
1071 $statistics = array(
1072 'num_posts' =>
$row[
'cnt'],
1073 'num_unread_posts' =>
$row[
'cnt'],
1074 'num_new_posts' =>
$row[
'cnt']
1078 self::$forum_statistics_cache[
$ref_id] = $statistics;
1080 return self::$forum_statistics_cache[
$ref_id];
1088 public static function lookupLastPostByRefId(
$ref_id)
1097 if(isset(self::$forum_last_post_cache[
$ref_id]))
1099 return self::$forum_last_post_cache[
$ref_id];
1102 $forumId = self::lookupForumIdByRefId($ref_id);
1105 self::$forum_last_post_cache[
$ref_id] = array();
1106 return self::$forum_last_post_cache[
$ref_id];
1110 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 WHERE pos_top_fk = %s $act_clause 1120 ORDER BY pos_date DESC 1122 $res = $ilDB->queryF(
1132 return self::$forum_last_post_cache[
$ref_id];
1141 public static function getUserIdsOfLastPostsByRefIdAndThreadIds(
$ref_id, array $thread_ids)
1151 $act_inner_clause =
'';
1152 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 1165 SELECT t3.pos_thr_fk, MAX(t3.pos_date) pos_date 1167 WHERE $inner_in $act_inner_clause 1168 GROUP BY t3.pos_thr_fk 1169 ) t2 ON t2.pos_thr_fk = t1.pos_thr_fk AND t2.pos_date = t1.pos_date 1170 WHERE $in $act_clause 1171 GROUP BY t1.pos_thr_fk, t1.pos_display_user_id, t1.update_user 1177 while(
$row = $ilDB->fetchAssoc(
$res))
1179 if((
int)
$row[
'pos_display_user_id'])
1181 $usr_ids[] = (int)
$row[
'pos_display_user_id'];
1183 if((
int)
$row[
'update_user'])
1185 $usr_ids[] = (int)
$row[
'update_user'];
1189 return array_unique($usr_ids);
1196 $ilDB->update(
'frm_user_read',
1197 array(
'thread_id' => array(
'integer', $merge_target_thread_id)),
1198 array(
'thread_id' => array(
'integer',$merge_source_thread_id)));
static $forum_last_post_cache
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.
setThreadSorting($a_thr_pk, $a_sorting_value)
static lookupForumIdByObjId($obj_id)
cloneObject($a_target_id, $a_copy_id=0, $a_omit_tree=false)
Clone object permissions, put in tree ...
Class ilObject Basic functions for all objects.
static lookupForumIdByRefId($ref_id)
static $obj_id_to_forum_id_cache
initDefaultRoles()
init default roles settings public
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)
static _lookupObjectId($a_ref_id)
lookup object id
static getInstance($a_obj_id=0)
static _getInstance($a_copy_id)
Get instance of copy wizard options.
if(!is_array($argv)) $options
getId()
get object id public
getTitle()
get object title public
getDescription()
get object description
redirection script todo: (a better solution should control the processing via a xml file) ...
static $forum_statistics_cache
const FORUM_OVERVIEW_WITH_NEW_POSTS
This class handles all operations on files for the forum object.
static _getDefaultVisibilityForRefId($a_ref_id)
Get default visibility for reference id.
_lookupPostMessage($a_id)
getRefId()
get reference id public
__construct($a_id=0, $a_call_by_reference=true)
Constructor public.
static $ref_id_to_forum_id_cache
update()
update object in db
setPermissions($a_parent_ref)
set permissions of object
getDiskUsage()
Gets the disk usage of the object in bytes.