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',
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',
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',
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',
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',
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',
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),
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 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',
431 public static function _deleteUser($a_usr_id)
440 $res = $ilDB->manipulateF(
' 441 DELETE FROM frm_user_read WHERE usr_id = %s',
445 $res = $ilDB->manipulateF(
' 446 DELETE FROM frm_thread_access WHERE usr_id = %s',
452 DELETE FROM frm_notification WHERE user_id = %s',
459 public static function _deleteReadEntries($a_post_id)
466 $statement = $ilDB->manipulateF(
' 467 DELETE FROM frm_user_read WHERE post_id = %s',
473 public static function _deleteAccessEntries($a_thread_id)
480 $statement = $ilDB->manipulateF(
' 481 DELETE FROM frm_thread_access WHERE thread_id = %s',
491 function update($a_update_user_id = 0)
498 if(!$a_update_user_id)
500 $a_update_user_id =
$GLOBALS[
'DIC'][
'ilUser']->getId();
507 $statement = $ilDB->manipulateF(
' 510 top_description = %s, 513 WHERE top_frm_fk =%s',
514 array(
'text',
'text',
'timestamp',
'integer',
'integer'),
519 (
int) $a_update_user_id,
535 public function cloneObject($a_target_id, $a_copy_id = 0, $a_omit_tree =
false)
543 $new_obj = parent::cloneObject($a_target_id, $a_copy_id, $a_omit_tree);
544 $this->cloneAutoGeneratedRoles($new_obj);
547 $this->Forum->setMDB2WhereCondition(
'top_frm_fk = %s ',
array(
'integer'),
array($this->
getId()));
548 $topData = $this->Forum->getOneTopic();
550 $ilDB->update(
'frm_data',
array(
551 'top_name' =>
array(
'text', $topData[
'top_name']),
552 'top_description' =>
array(
'text', $topData[
'top_description']),
553 'top_num_posts' =>
array(
'integer', $topData[
'top_num_posts']),
554 'top_num_threads' =>
array(
'integer', $topData[
'top_num_threads']),
555 'top_last_post' =>
array(
'text', $topData[
'top_last_post']),
556 'top_date' =>
array(
'timestamp', $topData[
'top_date']),
557 'visits' =>
array(
'integer', $topData[
'visits']),
558 'top_update' =>
array(
'timestamp', $topData[
'top_update']),
559 'update_user' =>
array(
'integer', $topData[
'update_user']),
560 'top_usr_id' =>
array(
'integer', $topData[
'top_usr_id'])
562 'top_frm_fk' =>
array(
'integer', $new_obj->getId())
566 include_once(
'Services/CopyWizard/classes/class.ilCopyWizardOptions.php');
571 $options[
'threads'] = $this->Forum->_getThreads($this->
getId());
574 include_once(
'Modules/Forum/classes/class.ilFileDataForum.php');
576 $new_frm = $new_obj->Forum;
577 $new_frm->setMDB2WhereCondition(
'top_frm_fk = %s ',
array(
'integer'),
array($new_obj->getId()));
579 $new_frm->setForumId($new_obj->getId());
580 $new_frm->setForumRefId($new_obj->getRefId());
582 $new_topic = $new_frm->getOneTopic();
583 foreach(
$options[
'threads'] as $thread_id => $thread_subject)
585 $this->Forum->setMDB2WhereCondition(
'thr_pk = %s ',
array(
'integer'),
array($thread_id));
587 $old_thread = $this->Forum->getOneThread();
589 $old_post_id = $this->Forum->getFirstPostByThread($old_thread[
'thr_pk']);
590 $old_post = $this->Forum->getOnePost($old_post_id);
593 $newThread->setSticky($old_thread[
'is_sticky']);
594 $newThread->setForumId($new_topic[
'top_pk']);
595 $newThread->setThrAuthorId($old_thread[
'thr_author_id']);
596 $newThread->setDisplayUserId($old_thread[
'thr_display_user_id']);
597 $newThread->setSubject($old_thread[
'thr_subject']);
598 $newThread->setUserAlias($old_thread[
'thr_usr_alias']);
599 $newThread->setCreateDate($old_thread[
'thr_date']);
601 $newPostId = $new_frm->generateThread(
609 $old_forum_files->ilClone($new_obj->getId(), $newPostId);
621 public function cloneAutoGeneratedRoles($new_obj)
627 global
$ilLog, $rbacadmin;
629 $moderator = ilObjForum::_lookupModeratorRole($this->
getRefId());
630 $new_moderator = ilObjForum::_lookupModeratorRole($new_obj->getRefId());
632 if(!$moderator || !$new_moderator || !$this->
getRefId() || !$new_obj->getRefId())
634 $ilLog->write(__METHOD__ .
' : Error cloning auto generated role: il_frm_moderator');
636 $rbacadmin->copyRolePermissions($moderator, $this->
getRefId(), $new_obj->getRefId(), $new_moderator,
true);
637 $ilLog->write(__METHOD__ .
' : Finished copying of role il_frm_moderator.');
639 include_once
'./Modules/Forum/classes/class.ilForumModerators.php';
642 $old_mods = $obj_mods->getCurrentModerators();
643 foreach($old_mods as $user_id)
649 $rbacadmin->assignUser($new_moderator, $user_id);
659 public function delete()
667 if(!parent::delete())
674 $tmp_file_obj->delete();
675 unset($tmp_file_obj);
677 $this->Forum->setMDB2WhereCondition(
'top_frm_fk = %s ',
array(
'integer'),
array($this->
getId()));
679 $topData = $this->Forum->getOneTopic();
681 $threads = $this->Forum->getAllThreads($topData[
'top_pk']);
682 foreach($threads[
'items'] as $thread)
684 $thread_ids_to_delete[$thread->getId()] = $thread->getId();
688 $ilDB->manipulate(
'DELETE FROM frm_posts_tree WHERE '. $ilDB->in(
'thr_fk', $thread_ids_to_delete,
false,
'integer'));
691 $ilDB->manipulate(
'DELETE FROM frm_posts WHERE '. $ilDB->in(
'pos_thr_fk', $thread_ids_to_delete,
false,
'integer'));
694 $ilDB->manipulate(
'DELETE FROM frm_threads WHERE '. $ilDB->in(
'thr_pk', $thread_ids_to_delete,
false,
'integer'));
698 $ilDB->manipulateF(
'DELETE FROM frm_data WHERE top_frm_fk = %s',
699 array(
'integer'), $obj_id);
702 $ilDB->manipulateF(
'DELETE FROM frm_settings WHERE obj_id = %s',
703 array(
'integer'), $obj_id);
706 $ilDB->manipulateF(
'DELETE FROM frm_user_read WHERE obj_id = %s',
707 array(
'integer'), $obj_id);
710 $ilDB->manipulateF(
'DELETE FROM frm_thread_access WHERE obj_id = %s',
711 array(
'integer'), $obj_id);
714 $ilDB->manipulate(
'DELETE FROM frm_notification WHERE '. $ilDB->in(
'thread_id', $thread_ids_to_delete,
false,
'integer'));
717 $ilDB->manipulateF(
'DELETE FROM frm_notification WHERE frm_id = %s',
array(
'integer'), $obj_id);
720 $ilDB->manipulateF(
'DELETE FROM frm_posts_deleted WHERE obj_id = %s',
array(
'integer'), $obj_id);
734 $res = $ilDB->queryF(
'SELECT draft_id FROM frm_posts_drafts WHERE forum_id = %s',
737 $draft_ids =
array();
738 while(
$row = $ilDB->fetchAssoc(
$res))
740 $draft_ids[] =
$row[
'draft_id'];
743 if(count($draft_ids) > 0)
745 require_once
'Modules/Forum/classes/class.ilForumDraftsHistory.php';
747 $historyObj->deleteHistoryByDraftIds($draft_ids);
749 require_once
'Modules/Forum/classes/class.ilForumPostDraft.php';
751 $draftObj->deleteDraftsByDraftIds($draft_ids);
762 include_once
'./Services/AccessControl/classes/class.ilObjRole.php';
764 'il_frm_moderator_'.$this->
getRefId(),
765 "Moderator of forum obj_no.".$this->
getId(),
779 public static function _lookupModeratorRole($a_ref_id)
786 $mod_title =
'il_frm_moderator_' . $a_ref_id;
788 $res = $ilDB->queryf(
' 789 SELECT * FROM object_data WHERE title = %s',
792 while(
$row = $ilDB->fetchObject(
$res))
803 include_once(
"./Services/News/classes/class.ilNewsItem.php");
805 if($default_visibility ==
"public")
813 public function saveData($a_roles =
array())
821 $nextId = $ilDB->nextId(
'frm_data');
824 'top_frm_fk' => $this->
getId(),
827 'top_num_posts' => 0,
828 'top_num_threads' => 0,
829 'top_last_post' => NULL,
830 'top_mods' => !is_numeric($a_roles[0]) ? 0 : $a_roles[0],
831 'top_usr_id' => $ilUser->getId(),
849 VALUES(%s, %s, %s, %s, %s, %s, %s, %s, %s, %s)',
850 array(
'integer',
'integer',
'text',
'text',
'integer',
'integer',
'text',
'integer',
'timestamp',
'integer'),
853 $top_data[
'top_frm_fk'],
854 $top_data[
'top_name'],
855 $top_data[
'top_description'],
856 $top_data[
'top_num_posts'],
857 $top_data[
'top_num_threads'],
858 $top_data[
'top_last_post'],
859 $top_data[
'top_mods'],
860 $top_data[
'top_date'],
861 $top_data[
'top_usr_id']
869 $ilDB->update(
'frm_threads',
870 array(
'thread_sorting' =>
array(
'integer',$a_sorting_value)),
871 array(
'thr_pk' =>
array(
'integer', $a_thr_pk)));
882 if(array_key_exists($obj_id, self::$obj_id_to_forum_id_cache))
884 return (
int)self::$obj_id_to_forum_id_cache[$obj_id];
887 self::preloadForumIdsByObjIds(
array($obj_id));
889 return (
int)self::$obj_id_to_forum_id_cache[$obj_id];
899 if(array_key_exists(
$ref_id, self::$ref_id_to_forum_id_cache))
901 return (
int)self::$ref_id_to_forum_id_cache[
$ref_id];
906 return (
int)self::$ref_id_to_forum_id_cache[
$ref_id];
913 public static function preloadForumIdsByObjIds(
array $obj_ids)
920 if(count($obj_ids) == 1)
922 $in =
" objr.obj_id = " . $ilDB->quote(current($obj_ids),
'integer') .
" ";
926 $in = $ilDB->in(
'objr.obj_id', $obj_ids,
false,
'integer');
929 SELECT frmd.top_pk, objr.ref_id, objr.obj_id 930 FROM object_reference objr 931 INNER JOIN frm_data frmd ON frmd.top_frm_fk = objr.obj_id 937 foreach($obj_ids as $obj_id)
939 self::$obj_id_to_forum_id_cache[$obj_id] = null;
942 while(
$row = $ilDB->fetchAssoc(
$res))
944 self::$obj_id_to_forum_id_cache[
$row[
'obj_id']] = $row[
'top_pk'];
945 self::$ref_id_to_forum_id_cache[$row[
'ref_id']] = $row[
'top_pk'];
953 public static function preloadForumIdsByRefIds(
array $ref_ids)
960 if(count($ref_ids) == 1)
962 $in =
" objr.ref_id = " . $ilDB->quote(current($ref_ids),
'integer') .
" ";
966 $in = $ilDB->in(
'objr.ref_id', $ref_ids,
false,
'integer');
969 SELECT frmd.top_pk, objr.ref_id, objr.obj_id 970 FROM object_reference objr 971 INNER JOIN frm_data frmd ON frmd.top_frm_fk = objr.obj_id 979 self::$ref_id_to_forum_id_cache[
$ref_id] = null;
982 while(
$row = $ilDB->fetchAssoc(
$res))
984 self::$obj_id_to_forum_id_cache[
$row[
'obj_id']] = $row[
'top_pk'];
985 self::$ref_id_to_forum_id_cache[$row[
'ref_id']] = $row[
'top_pk'];
994 public static function lookupStatisticsByRefId(
$ref_id)
1004 if(isset(self::$forum_statistics_cache[
$ref_id]))
1006 return self::$forum_statistics_cache[
$ref_id];
1009 $statistics =
array(
1011 'num_unread_posts' => 0,
1012 'num_new_posts' => 0
1015 $forumId = self::lookupForumIdByRefId($ref_id);
1018 self::$forum_statistics_cache[
$ref_id] = $statistics;
1019 return self::$forum_statistics_cache[
$ref_id];
1023 $is_post_activation_enabled = $objProperties->isPostActivationEnabled();
1027 if($is_post_activation_enabled && !$ilAccess->checkAccess(
'moderate_frm',
'', $ref_id))
1029 $act_clause .=
" AND (frm_posts.pos_status = " . $ilDB->quote(1,
"integer") .
" OR frm_posts.pos_author_id = " . $ilDB->quote($ilUser->getId(),
"integer") .
") ";
1032 $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));
1034 if(!$ilUser->isAnonymous())
1037 (SELECT COUNT(frm_posts.pos_pk) cnt 1039 INNER JOIN frm_threads ON frm_posts.pos_thr_fk = frm_threads.thr_pk 1040 WHERE frm_threads.thr_top_fk = %s $act_clause) 1044 (SELECT COUNT(DISTINCT(frm_user_read.post_id)) cnt 1046 INNER JOIN frm_posts ON frm_user_read.post_id = frm_posts.pos_pk 1047 INNER JOIN frm_threads ON frm_threads.thr_pk = frm_posts.pos_thr_fk 1048 WHERE frm_user_read.usr_id = %s AND frm_posts.pos_top_fk = %s $act_clause) 1051 $types =
array(
'integer',
'integer',
'integer');
1052 $values =
array($forumId, $ilUser->getId(), $forumId);
1054 $forum_overview_setting = (int)$ilSetting::_lookupValue(
'frma',
'forum_overview');
1057 $news_types =
array(
'integer',
'integer',
'integer',
'timestamp',
'integer');
1058 $news_values =
array($ilUser->getId(), $ilUser->getId(), $forumId, $new_deadline, $ilUser->getId());
1063 (SELECT COUNT(frm_posts.pos_pk) cnt 1065 LEFT JOIN frm_user_read ON (post_id = frm_posts.pos_pk AND frm_user_read.usr_id = %s) 1066 LEFT JOIN frm_thread_access ON (frm_thread_access.thread_id = frm_posts.pos_thr_fk AND frm_thread_access.usr_id = %s) 1067 WHERE frm_posts.pos_top_fk = %s 1068 AND ( (frm_posts.pos_update > frm_thread_access.access_old_ts) 1069 OR (frm_thread_access.access_old IS NULL AND frm_posts.pos_update > %s) 1071 AND frm_posts.pos_author_id != %s 1072 AND frm_user_read.usr_id IS NULL $act_clause)";
1074 $types = array_merge($types, $news_types);
1075 $values = array_merge($values, $news_values);
1078 $mapping = array_keys($statistics);
1079 $res = $ilDB->queryF(
1084 for($i = 0; $i <= 2; $i++)
1088 $statistics[$mapping[$i]] = (int)
$row[
'cnt'];
1093 $statistics[$mapping[$i]] = $statistics[$mapping[$i - 1]] - $statistics[$mapping[$i]];
1100 SELECT COUNT(frm_posts.pos_pk) cnt 1102 INNER JOIN frm_threads ON frm_posts.pos_thr_fk = frm_threads.thr_pk 1103 WHERE frm_threads.thr_top_fk = %s $act_clause 1105 $types =
array(
'integer');
1106 $values =
array($forumId);
1107 $res = $ilDB->queryF(
1114 $statistics =
array(
1115 'num_posts' =>
$row[
'cnt'],
1116 'num_unread_posts' =>
$row[
'cnt'],
1117 'num_new_posts' =>
$row[
'cnt']
1121 self::$forum_statistics_cache[
$ref_id] = $statistics;
1123 return self::$forum_statistics_cache[
$ref_id];
1131 public static function lookupLastPostByRefId(
$ref_id)
1140 if(isset(self::$forum_last_post_cache[
$ref_id]))
1142 return self::$forum_last_post_cache[
$ref_id];
1145 $forumId = self::lookupForumIdByRefId($ref_id);
1149 return self::$forum_last_post_cache[
$ref_id];
1153 if(!$ilAccess->checkAccess(
'moderate_frm',
'', $ref_id))
1155 $act_clause .=
" AND (frm_posts.pos_status = " . $ilDB->quote(1,
"integer") .
" OR frm_posts.pos_author_id = " . $ilDB->quote($ilUser->getId(),
"integer") .
") ";
1158 $ilDB->setLimit(1, 0);
1162 WHERE pos_top_fk = %s $act_clause 1163 ORDER BY pos_date DESC 1165 $res = $ilDB->queryF(
1175 return self::$forum_last_post_cache[
$ref_id];
1184 public static function getUserIdsOfLastPostsByRefIdAndThreadIds(
$ref_id,
array $thread_ids)
1194 $act_inner_clause =
'';
1195 if(!$ilAccess->checkAccess(
'moderate_frm',
'',
$ref_id))
1197 $act_clause .=
" AND (t1.pos_status = " . $ilDB->quote(1,
"integer") .
" OR t1.pos_author_id = " . $ilDB->quote($ilUser->getId(),
"integer") .
") ";
1198 $act_inner_clause .=
" AND (t3.pos_status = " . $ilDB->quote(1,
"integer") .
" OR t3.pos_author_id = " . $ilDB->quote($ilUser->getId(),
"integer") .
") ";
1201 $in = $ilDB->in(
"t1.pos_thr_fk", $thread_ids,
false,
'integer');
1202 $inner_in = $ilDB->in(
"t3.pos_thr_fk", $thread_ids,
false,
'integer');
1205 SELECT t1.pos_display_user_id, t1.update_user 1208 SELECT t3.pos_thr_fk, MAX(t3.pos_date) pos_date 1210 WHERE $inner_in $act_inner_clause 1211 GROUP BY t3.pos_thr_fk 1212 ) t2 ON t2.pos_thr_fk = t1.pos_thr_fk AND t2.pos_date = t1.pos_date 1213 WHERE $in $act_clause 1214 GROUP BY t1.pos_thr_fk, t1.pos_display_user_id, t1.update_user 1220 while(
$row = $ilDB->fetchAssoc(
$res))
1222 if((
int)
$row[
'pos_display_user_id'])
1224 $usr_ids[] = (int)
$row[
'pos_display_user_id'];
1226 if((
int)
$row[
'update_user'])
1228 $usr_ids[] = (int)
$row[
'update_user'];
1232 return array_unique($usr_ids);
1239 $ilDB->update(
'frm_user_read',
1240 array(
'thread_id' =>
array(
'integer', $merge_target_thread_id)),
1241 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.
static _lookupPostMessage($a_id)
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)
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
static $obj_id_to_forum_id_cache
initDefaultRoles()
init default roles settings public
deleteDraftsByForumId($forum_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.
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
date( 'd-M-Y', $objPHPExcel->getProperties() ->getCreated())
getTitle()
get object title public
getDescription()
get object description
redirection script todo: (a better solution should control the processing via a xml file) ...
Create styles array
The data for the language used.
if(php_sapi_name() !='cli') $in
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.
getRefId()
get reference id public
__construct($a_id=0, $a_call_by_reference=true)
Constructor public.
Add data(end) time
Method that wraps PHPs time in order to allow simulations with the workflow.
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.