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);
86 require_once(
"./Modules/File/classes/class.ilObjFileAccess.php");
87 return ilObjForumAccess::_lookupDiskUsage($this->
id);
90 public static function _lookupThreadSubject($a_thread_id)
98 $res = $ilDB->queryf(
' 99 SELECT thr_subject FROM frm_threads WHERE thr_pk = %s',
100 array(
'integer'), array($a_thread_id));
102 while(
$row = $ilDB->fetchObject(
$res))
104 return $row->thr_subject;
110 public function getCountUnread($a_usr_id, $a_thread_id = 0)
118 $a_frm_id = $this->
getId();
125 $ilBench->start(
"Forum",
'getCountRead');
129 $res = $ilDB->queryf(
' 130 SELECT top_pk FROM frm_data WHERE top_frm_fk = %s',
131 array(
'integer'), array($a_frm_id));
134 while(
$row = $ilDB->fetchObject(
$res))
136 $topic_id =
$row->top_pk;
140 $res = $ilDB->queryf(
' 141 SELECT COUNT(pos_pk) num_posts FROM frm_posts 142 WHERE pos_top_fk = %s',
143 array(
'integer'), array($topic_id));
145 while(
$row = $ilDB->fetchObject(
$res))
147 $num_posts =
$row->num_posts;
150 $res = $ilDB->queryf(
' 151 SELECT COUNT(post_id) count_read FROM frm_user_read 154 array(
'integer',
'integer'), array($a_frm_id, $a_usr_id));
156 while(
$row = $ilDB->fetchObject(
$res))
158 $count_read =
$row->count_read;
160 $unread = $num_posts - $count_read;
162 $ilBench->stop(
"Forum",
'getCountRead');
163 return $unread > 0 ? $unread : 0;
167 $res = $ilDB->queryf(
' 168 SELECT COUNT(pos_pk) num_posts FROM frm_posts 169 WHERE pos_thr_fk = %s',
170 array(
'integer'), array($a_thread_id));
173 $num_posts =
$row->num_posts;
175 $res = $ilDB->queryf(
' 176 SELECT COUNT(post_id) count_read FROM frm_user_read 180 array(
'integer',
'integer',
'integer'), array($a_frm_id, $a_frm_id, $a_thread_id));
183 $count_read =
$row->count_read;
185 $unread = $num_posts - $count_read;
187 $ilBench->stop(
"Forum",
'getCountRead');
188 return $unread > 0 ? $unread : 0;
190 $ilBench->stop(
"Forum",
'getCountRead');
195 public function markThreadRead($a_usr_id, $a_thread_id)
203 $res = $ilDB->queryf(
' 204 SELECT * FROM frm_posts WHERE pos_thr_fk = %s',
205 array(
'integer'), array($a_thread_id));
207 while(
$row = $ilDB->fetchObject(
$res))
209 $this->markPostRead($a_usr_id, $a_thread_id,
$row->pos_pk);
214 public function markAllThreadsRead($a_usr_id)
221 $res = $ilDB->queryf(
' 222 SELECT * FROM frm_data, frm_threads 223 WHERE top_frm_fk = %s 224 AND top_pk = thr_top_fk',
225 array(
'integer'), array($this->
getId()));
227 while(
$row = $ilDB->fetchObject(
$res))
229 $this->markThreadRead($a_usr_id,
$row->thr_pk);
236 public function markPostRead($a_usr_id, $a_thread_id, $a_post_id)
244 $res = $ilDB->queryf(
' 245 SELECT * FROM frm_user_read 250 array(
'integer',
'integer',
'integer',
'integer'),
251 array($a_usr_id, $this->
getId(), $a_thread_id, $a_post_id));
253 if($ilDB->numRows(
$res))
258 $res = $ilDB->manipulateF(
' 259 INSERT INTO frm_user_read 265 VALUES (%s,%s,%s,%s)',
266 array(
'integer',
'integer',
'integer',
'integer'),
267 array($a_usr_id, $this->
getId(), $a_thread_id, $a_post_id));
272 public function markPostUnread($a_user_id, $a_post_id)
279 $res = $ilDB->manipulateF(
' 280 DELETE FROM frm_user_read 283 array(
'integer',
'integer'),
284 array($a_user_id, $a_post_id));
287 public function isRead($a_usr_id, $a_post_id)
294 $res = $ilDB->queryf(
' 295 SELECT * FROM frm_user_read 298 array(
'integer',
'integer'),
299 array($a_usr_id, $a_post_id));
301 return $ilDB->numRows(
$res) ? true :
false;
304 public function updateLastAccess($a_usr_id, $a_thread_id)
311 $res = $ilDB->queryf(
' 312 SELECT * FROM frm_thread_access 316 array(
'integer',
'integer',
'integer'),
317 array($a_usr_id, $this->
getId(), $a_thread_id));
323 'usr_id' => array(
'integer', $a_usr_id),
324 'obj_id' => array(
'integer', $this->
getId()),
325 'thread_id' => array(
'integer', $a_thread_id)
328 'access_last' => array(
'integer', time()),
329 'access_old' => array(
'integer', isset(
$data[
'access_old']) ?
$data[
'access_old'] : 0),
330 'access_old_ts' => array(
'timestamp', $data[
'access_old_ts'])
341 public static function _updateOldAccess($a_usr_id)
350 UPDATE frm_thread_access 351 SET access_old = access_last 353 array(
'integer'), array($a_usr_id));
355 $set = $ilDB->query(
"SELECT * FROM frm_thread_access " .
356 " WHERE usr_id = " . $ilDB->quote($a_usr_id,
"integer")
358 while($rec = $ilDB->fetchAssoc($set))
360 $ilDB->manipulate(
"UPDATE frm_thread_access SET " .
361 " access_old_ts = " . $ilDB->quote(date(
'Y-m-d H:i:s', $rec[
"access_old"]),
"timestamp") .
362 " WHERE usr_id = " . $ilDB->quote($rec[
"usr_id"],
"integer") .
363 " AND obj_id = " . $ilDB->quote($rec[
"obj_id"],
"integer") .
364 " AND thread_id = " . $ilDB->quote($rec[
"thread_id"],
"integer")
368 $new_deadline = time() - 60 * 60 * 24 * 7 * ($ilias->getSetting(
'frm_store_new') ?
369 $ilias->getSetting(
'frm_store_new') :
373 DELETE FROM frm_thread_access WHERE access_last < %s',
374 array(
'integer'), array($new_deadline));
377 function _deleteUser($a_usr_id)
384 $data = array($a_usr_id);
386 $res = $ilDB->manipulateF(
' 387 DELETE FROM frm_user_read WHERE usr_id = %s',
388 array(
'integer'),
$data 391 $res = $ilDB->manipulateF(
' 392 DELETE FROM frm_thread_access WHERE usr_id = %s',
393 array(
'integer'),
$data 398 DELETE FROM frm_notification WHERE user_id = %s',
399 array(
'integer'),
$data);
405 function _deleteReadEntries($a_post_id)
412 $statement = $ilDB->manipulateF(
' 413 DELETE FROM frm_user_read WHERE post_id = %s',
414 array(
'integer'), array($a_post_id));
419 function _deleteAccessEntries($a_thread_id)
426 $statement = $ilDB->manipulateF(
' 427 DELETE FROM frm_thread_access WHERE thread_id = %s',
428 array(
'integer'), array($a_thread_id));
447 $statement = $ilDB->manipulateF(
' 450 top_description = %s, 453 WHERE top_frm_fk =%s',
454 array(
'text',
'text',
'timestamp',
'integer',
'integer'),
475 public function cloneObject($a_target_id, $a_copy_id = 0)
482 $new_obj = parent::cloneObject($a_target_id, $a_copy_id);
483 $this->cloneAutoGeneratedRoles($new_obj);
486 $this->Forum->setMDB2WhereCondition(
'top_frm_fk = %s ', array(
'integer'), array($this->
getId()));
488 $topData = $this->Forum->getOneTopic();
490 $nextId = $ilDB->nextId(
'frm_data');
492 $statement = $ilDB->insert(
'frm_data', array(
493 'top_pk' => array(
'integer', $nextId),
494 'top_frm_fk' => array(
'integer', $new_obj->getId()),
495 'top_name' => array(
'text', $topData[
'top_name']),
496 'top_description' => array(
'text', $topData[
'top_description']),
497 'top_num_posts' => array(
'integer', $topData[
'top_num_posts']),
498 'top_num_threads' => array(
'integer', $topData[
'top_num_threads']),
499 'top_last_post' => array(
'text', $topData[
'top_last_post']),
500 'top_mods' => array(
'integer', !is_numeric($topData[
'top_mods']) ? 0 : $topData[
'top_mods']),
501 'top_date' => array(
'timestamp', $topData[
'top_date']),
502 'visits' => array(
'integer', $topData[
'visits']),
503 'top_update' => array(
'timestamp', $topData[
'top_update']),
504 'update_user' => array(
'integer', $topData[
'update_user']),
505 'top_usr_id' => array(
'integer', $topData[
'top_usr_id'])
509 include_once(
'Services/CopyWizard/classes/class.ilCopyWizardOptions.php');
514 $options[
'threads'] = $this->Forum->_getThreads($this->
getId());
517 include_once(
'Modules/Forum/classes/class.ilFileDataForum.php');
519 $new_frm = $new_obj->Forum;
520 $new_frm->setMDB2WhereCondition(
'top_frm_fk = %s ', array(
'integer'), array($new_obj->getId()));
522 $new_frm->setForumId($new_obj->getId());
523 $new_frm->setForumRefId($new_obj->getRefId());
525 $new_topic = $new_frm->getOneTopic();
526 foreach(
$options[
'threads'] as $thread_id=> $thread_subject)
528 $this->Forum->setMDB2WhereCondition(
'thr_pk = %s ', array(
'integer'), array($thread_id));
530 $old_thread = $this->Forum->getOneThread();
532 $old_post_id = $this->Forum->getFirstPostByThread($old_thread[
'thr_pk']);
533 $old_post = $this->Forum->getOnePost($old_post_id);
536 $new_post = $new_frm->generateThread($new_topic[
'top_pk'],
537 $old_thread[
'thr_usr_id'],
538 $old_thread[
'thr_subject'],
542 $old_thread[
'thr_usr_alias'],
543 $old_thread[
'thr_date']);
546 $old_forum_files->ilClone($new_obj->getId(), $new_post);
558 public function cloneAutoGeneratedRoles($new_obj)
564 global
$ilLog, $rbacadmin, $rbacreview;
566 $moderator = ilObjForum::_lookupModeratorRole($this->
getRefId());
567 $new_moderator = ilObjForum::_lookupModeratorRole($new_obj->getRefId());
568 $source_rolf = $rbacreview->getRoleFolderIdOfObject($this->
getRefId());
569 $target_rolf = $rbacreview->getRoleFolderIdOfObject($new_obj->getRefId());
571 if(!$moderator || !$new_moderator || !$source_rolf || !$target_rolf)
573 $ilLog->write(__METHOD__ .
' : Error cloning auto generated role: il_frm_moderator');
575 $rbacadmin->copyRolePermissions($moderator, $source_rolf, $target_rolf, $new_moderator,
true);
576 $ilLog->write(__METHOD__ .
' : Finished copying of role il_frm_moderator.');
578 include_once
'./Modules/Forum/classes/class.ilForumModerators.php';
582 $old_mods = $obj_mods->getCurrentModerators();
584 foreach($old_mods as $user_id)
586 $rbacadmin->assignUser($new_moderator, $user_id);
595 public function delete()
603 if(!parent::delete())
610 $tmp_file_obj->delete();
611 unset($tmp_file_obj);
613 $this->Forum->setMDB2WhereCondition(
'top_frm_fk = %s ', array(
'integer'), array($this->
getId()));
615 $topData = $this->Forum->getOneTopic();
617 $threads = $this->Forum->getAllThreads($topData[
'top_pk']);
618 foreach($threads[
'items'] as $thread)
620 $data = array($thread->getId());
624 DELETE FROM frm_posts_tree WHERE thr_fk = %s',
625 array(
'integer'),
$data);
628 $statement = $ilDB->manipulateF(
' 629 DELETE FROM frm_posts WHERE pos_thr_fk = %s',
630 array(
'integer'),
$data);
633 $statement = $ilDB->manipulateF(
' 634 DELETE FROM frm_threads WHERE thr_pk = %s',
635 array(
'integer'),
$data);
641 $statement = $ilDB->manipulateF(
' 642 DELETE FROM frm_data WHERE top_frm_fk = %s',
643 array(
'integer'),
$data);
646 $statement = $ilDB->manipulateF(
' 647 DELETE FROM frm_settings WHERE obj_id = %s',
648 array(
'integer'),
$data);
651 $statement = $ilDB->manipulateF(
' 652 DELETE FROM frm_user_read WHERE obj_id = %s',
653 array(
'integer'),
$data);
656 $statement = $ilDB->manipulateF(
' 657 DELETE FROM frm_thread_access WHERE obj_id = %s',
658 array(
'integer'),
$data);
662 DELETE FROM frm_notification WHERE frm_id = %s',
663 array(
'integer'),
$data);
680 global $rbacadmin, $rbacreview, $ilDB;
686 $role_obj = $rolf_obj->createRole(
"il_frm_moderator_" . $this->
getRefId(),
"Moderator of forum obj_no." . $this->
getId());
687 $roles[] = $role_obj->getId();
690 $statement = $ilDB->queryf(
' 691 SELECT obj_id FROM object_data 694 array(
'text',
'text'),
695 array(
'rolt',
'il_frm_moderator'));
697 $res = $ilDB->fetchObject($statement);
699 $rbacadmin->copyRoleTemplatePermissions(
$res->obj_id, ROLE_FOLDER_ID, $rolf_obj->getRefId(), $role_obj->getId());
702 $ops = $rbacreview->getOperationsOfRole($role_obj->getId(),
"frm", $rolf_obj->getRefId());
703 $rbacadmin->grantPermission($role_obj->getId(), $ops, $this->
getRefId());
705 return $roles ? $roles : array();
715 public static function _lookupModeratorRole($a_ref_id)
722 $mod_title =
'il_frm_moderator_' . $a_ref_id;
724 $res = $ilDB->queryf(
' 725 SELECT * FROM object_data WHERE title = %s',
726 array(
'text'), array($mod_title));
728 while(
$row = $ilDB->fetchObject(
$res))
739 include_once(
"./Services/News/classes/class.ilNewsItem.php");
741 if($default_visibility ==
"public")
749 public function saveData($a_roles = array())
757 $nextId = $ilDB->nextId(
'frm_data');
760 'top_frm_fk' => $this->
getId(),
763 'top_num_posts' => 0,
764 'top_num_threads' => 0,
765 'top_last_post' => NULL,
766 'top_mods' => !is_numeric($a_roles[0]) ? 0 : $a_roles[0],
767 'top_usr_id' => $ilUser->getId(),
771 $statement = $ilDB->manipulateF(
' 785 VALUES(%s, %s, %s, %s, %s, %s, %s, %s, %s, %s)',
786 array(
'integer',
'integer',
'text',
'text',
'integer',
'integer',
'text',
'integer',
'timestamp',
'integer'),
789 $top_data[
'top_frm_fk'],
790 $top_data[
'top_name'],
791 $top_data[
'top_description'],
792 $top_data[
'top_num_posts'],
793 $top_data[
'top_num_threads'],
794 $top_data[
'top_last_post'],
795 $top_data[
'top_mods'],
796 $top_data[
'top_date'],
797 $top_data[
'top_usr_id']
805 $ilDB->update(
'frm_threads',
806 array(
'thread_sorting' => array(
'integer',$a_sorting_value)),
807 array(
'thr_pk' => array(
'integer', $a_thr_pk)));
818 if(array_key_exists($obj_id, self::$obj_id_to_forum_id_cache))
820 return (
int)self::$obj_id_to_forum_id_cache[$obj_id];
823 self::preloadForumIdsByObjIds(array($obj_id));
825 return (
int)self::$obj_id_to_forum_id_cache[$obj_id];
835 if(array_key_exists(
$ref_id, self::$ref_id_to_forum_id_cache))
837 return (
int)self::$ref_id_to_forum_id_cache[
$ref_id];
840 self::preloadForumIdsByRefIds(array(
$ref_id));
842 return (
int)self::$ref_id_to_forum_id_cache[
$ref_id];
849 public static function preloadForumIdsByObjIds(array $obj_ids)
856 if(count($obj_ids) == 1)
858 $in =
" objr.obj_id = " . $ilDB->quote(current($obj_ids),
'integer') .
" ";
862 $in = $ilDB->in(
'objr.obj_id', $obj_ids,
false,
'integer');
865 SELECT frmd.top_pk, objr.ref_id, objr.obj_id 866 FROM object_reference objr 867 INNER JOIN frm_data frmd ON frmd.top_frm_fk = objr.obj_id 873 foreach($obj_ids as $obj_id)
875 self::$obj_id_to_forum_id_cache[$obj_id] = null;
878 while(
$row = $ilDB->fetchAssoc(
$res))
880 self::$obj_id_to_forum_id_cache[
$row[
'obj_id']] = $row[
'top_pk'];
881 self::$ref_id_to_forum_id_cache[$row[
'ref_id']] = $row[
'top_pk'];
889 public static function preloadForumIdsByRefIds(array $ref_ids)
896 if(count($ref_ids) == 1)
898 $in =
" objr.ref_id = " . $ilDB->quote(current($ref_ids),
'integer') .
" ";
902 $in = $ilDB->in(
'objr.ref_id', $ref_ids,
false,
'integer');
905 SELECT frmd.top_pk, objr.ref_id, objr.obj_id 906 FROM object_reference objr 907 INNER JOIN frm_data frmd ON frmd.top_frm_fk = objr.obj_id 915 self::$ref_id_to_forum_id_cache[
$ref_id] = null;
918 while(
$row = $ilDB->fetchAssoc(
$res))
920 self::$obj_id_to_forum_id_cache[
$row[
'obj_id']] = $row[
'top_pk'];
921 self::$ref_id_to_forum_id_cache[$row[
'ref_id']] = $row[
'top_pk'];
930 public static function lookupStatisticsByRefId(
$ref_id)
940 if(isset(self::$forum_statistics_cache[
$ref_id]))
942 return self::$forum_statistics_cache[
$ref_id];
947 'num_unread_posts' => 0,
951 $forumId = self::lookupForumIdByRefId($ref_id);
954 self::$forum_statistics_cache[
$ref_id] = $statistics;
955 return self::$forum_statistics_cache[
$ref_id];
959 if(!$ilAccess->checkAccess(
'moderate_frm',
'', $ref_id))
961 $act_clause .=
" AND (frm_posts.pos_status = " . $ilDB->quote(1,
"integer") .
" OR frm_posts.pos_usr_id = " . $ilDB->quote($ilUser->getId(),
"integer") .
") ";
964 $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));
966 if(!$ilUser->isAnonymous())
969 (SELECT COUNT(frm_posts.pos_pk) cnt 971 INNER JOIN frm_threads ON frm_posts.pos_thr_fk = frm_threads.thr_pk 972 WHERE frm_threads.thr_top_fk = %s $act_clause) 976 (SELECT COUNT(DISTINCT(frm_user_read.post_id)) cnt 978 INNER JOIN frm_posts ON frm_user_read.post_id = frm_posts.pos_pk 979 INNER JOIN frm_threads ON frm_threads.thr_pk = frm_posts.pos_thr_fk 980 WHERE frm_user_read.usr_id = %s AND frm_posts.pos_top_fk = %s $act_clause) 983 $types = array(
'integer',
'integer',
'integer');
984 $values = array($forumId, $ilUser->getId(), $forumId);
989 $news_types = array(
'integer',
'integer',
'integer',
'timestamp',
'integer');
990 $news_values = array($ilUser->getId(), $ilUser->getId(), $forumId, $new_deadline, $ilUser->getId());
995 (SELECT COUNT(frm_posts.pos_pk) cnt 997 LEFT JOIN frm_user_read ON (post_id = frm_posts.pos_pk AND frm_user_read.usr_id = %s) 998 LEFT JOIN frm_thread_access ON (frm_thread_access.thread_id = frm_posts.pos_thr_fk AND frm_thread_access.usr_id = %s) 999 WHERE frm_posts.pos_top_fk = %s 1000 AND ( (frm_posts.pos_update > frm_thread_access.access_old_ts) 1001 OR (frm_thread_access.access_old IS NULL AND frm_posts.pos_update > %s) 1003 AND frm_posts.pos_usr_id != %s 1004 AND frm_user_read.usr_id IS NULL $act_clause)";
1006 $types = array_merge($types, $news_types);
1007 $values = array_merge($values, $news_values);
1010 $mapping = array_keys($statistics);
1011 $res = $ilDB->queryF(
1016 for($i = 0; $i <= 2; $i++)
1020 $statistics[$mapping[$i]] = (int)
$row[
'cnt'];
1025 $statistics[$mapping[$i]] = $statistics[$mapping[$i - 1]] - $statistics[$mapping[$i]];
1032 SELECT COUNT(frm_posts.pos_pk) cnt 1034 INNER JOIN frm_threads ON frm_posts.pos_thr_fk = frm_threads.thr_pk 1035 WHERE frm_threads.thr_top_fk = %s $act_clause 1037 $types = array(
'integer');
1038 $values = array($forumId);
1039 $res = $ilDB->queryF(
1046 $statistics = array(
1047 'num_posts' =>
$row[
'cnt'],
1048 'num_unread_posts' =>
$row[
'cnt'],
1049 'num_new_posts' =>
$row[
'cnt']
1053 self::$forum_statistics_cache[
$ref_id] = $statistics;
1055 return self::$forum_statistics_cache[
$ref_id];
1063 public static function lookupLastPostByRefId(
$ref_id)
1070 global $ilAccess,
$ilUser, $ilDB;
1072 if(isset(self::$forum_last_post_cache[
$ref_id]))
1074 return self::$forum_last_post_cache[
$ref_id];
1077 $forumId = self::lookupForumIdByRefId($ref_id);
1080 self::$forum_last_post_cache[
$ref_id] = array();
1081 return self::$forum_last_post_cache[
$ref_id];
1085 if(!$ilAccess->checkAccess(
'moderate_frm',
'', $ref_id))
1087 $act_clause .=
" AND (frm_posts.pos_status = " . $ilDB->quote(1,
"integer") .
" OR frm_posts.pos_usr_id = " . $ilDB->quote($ilUser->getId(),
"integer") .
") ";
1090 $ilDB->setLimit(1, 0);
1094 WHERE pos_top_fk = %s $act_clause 1095 ORDER BY pos_date DESC 1097 $res = $ilDB->queryF(
1107 return self::$forum_last_post_cache[
$ref_id];
1116 public static function getUserIdsOfLastPostsByRefIdAndThreadIds(
$ref_id, array $thread_ids)
1123 global
$ilUser, $ilAccess, $ilDB;
1126 $act_inner_clause =
'';
1127 if(!$ilAccess->checkAccess(
'moderate_frm',
'',
$ref_id))
1129 $act_clause .=
" AND (t1.pos_status = " . $ilDB->quote(1,
"integer") .
" OR t1.pos_usr_id = " . $ilDB->quote($ilUser->getId(),
"integer") .
") ";
1130 $act_inner_clause .=
" AND (t3.pos_status = " . $ilDB->quote(1,
"integer") .
" OR t3.pos_usr_id = " . $ilDB->quote($ilUser->getId(),
"integer") .
") ";
1133 $in = $ilDB->in(
"t1.pos_thr_fk", $thread_ids,
false,
'integer');
1134 $inner_in = $ilDB->in(
"t3.pos_thr_fk", $thread_ids,
false,
'integer');
1137 SELECT t1.pos_usr_id, t1.update_user 1140 SELECT t3.pos_thr_fk, MAX(t3.pos_date) pos_date 1142 WHERE $inner_in $act_inner_clause 1143 GROUP BY t3.pos_thr_fk 1144 ) t2 ON t2.pos_thr_fk = t1.pos_thr_fk AND t2.pos_date = t1.pos_date 1145 WHERE $in $act_clause 1151 while(
$row = $ilDB->fetchAssoc(
$res))
1153 if((
int)
$row[
'pos_usr_id'])
1155 $usr_ids[] = (int)
$row[
'pos_usr_id'];
1157 if((
int)
$row[
'update_user'])
1159 $usr_ids[] = (int)
$row[
'update_user'];
1163 return array_unique($usr_ids);
1170 $ilDB->update(
'frm_user_read',
1171 array(
'thread_id' => array(
'integer', $merge_target_thread_id)),
1172 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
static now()
Return current timestamp in Y-m-d H:i:s format.
static _lookupValue($a_module, $a_keyword)
manipulateF($a_query, $a_types, $a_values)
Formatted manupulate (for DELETE, UPDATE, INSERT).
fetchAssoc($a_set)
Fetch row as associative array from result set.
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) ...
initDefaultRoles()
init default roles settings Purpose of this function is to create a local role folder and local roles...
static $forum_statistics_cache
const FORUM_OVERVIEW_WITH_NEW_POSTS
while($lm_rec=$ilDB->fetchAssoc($lm_set)) $data
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
createRoleFolder()
creates a local role folder
getDiskUsage()
Gets the disk usage of the object in bytes.