4 require_once
'Modules/Forum/classes/class.ilObjForum.php';
5 require_once
'Modules/Forum/classes/class.ilForum.php';
37 global $ilObjDataCache,
$lng,$ilias;
40 $this->
ilias = $ilias;
42 $this->forum_id = $ilObjDataCache->lookupObjId(
$ref_id);
48 $this->notification_id = $a_notification_id;
56 $this->user_id = $a_user_id;
65 $this->forum_id = $a_forum_id;
74 $this->thread_id = $a_thread_id;
84 $this->admin_force = $a_admin_force;
94 $this->user_toggle = $a_user_toggle;
103 $this->ref_id = $a_ref_id;
113 $this->user_id_noti = $a_user_id_noti;
118 return $this->user_id_noti;
125 $res = $ilDB->queryF(
' 126 SELECT admin_force_noti FROM frm_notification 129 AND user_id_noti > %s ',
130 array(
'integer',
'integer',
'integer'),
133 while(
$row = $ilDB->fetchAssoc(
$res))
135 return $row[
'admin_force_noti'];
142 $res = $ilDB->queryF(
' 143 SELECT user_toggle_noti FROM frm_notification 146 AND user_id_noti > %s',
147 array(
'integer',
'integer',
'integer'),
150 while(
$row = $ilDB->fetchAssoc(
$res))
152 return $row[
'user_toggle_noti'];
161 $next_id = $ilDB->nextId(
'frm_notification');
162 $res = $ilDB->manipulateF(
' 163 INSERT INTO frm_notification 164 (notification_id, user_id, frm_id, admin_force_noti, user_toggle_noti, user_id_noti) 165 VALUES(%s,%s,%s,%s,%s,%s)',
166 array(
'integer',
'integer',
'integer',
'integer',
'integer',
'integer'),
174 $res = $ilDB->manipulateF(
' 175 DELETE FROM frm_notification 178 AND admin_force_noti = %s 179 AND user_id_noti > %s' ,
180 array(
'integer',
'integer',
'integer',
'integer'),
188 $res = $ilDB->manipulateF(
' 189 DELETE FROM frm_notification 192 AND admin_force_noti = %s 193 AND user_toggle_noti = %s 194 AND user_id_noti > %s' ,
195 array(
'integer',
'integer',
'integer',
'integer',
'integer'),
204 $res = $ilDB->manipulateF(
' 205 UPDATE frm_notification 206 SET user_toggle_noti = %s 209 AND admin_force_noti = %s',
210 array(
'integer',
'integer',
'integer',
'integer'),
222 include_once
'Modules/Forum/classes/class.ilForumProperties.php';
224 $node_data = self::getCachedNodeData(
$ref_id);
226 foreach($node_data as
$data)
234 else $frm_noti->setUserId($ilUser->getId());
245 $frm_noti->setForumId($data[
'obj_id']);
246 if($frm_noti->existsNotification() ==
false)
248 $frm_noti->insertAdminForce();
258 $node_data = self::getCachedNodeData(
$ref_id);
260 include_once
'Modules/Forum/classes/class.ilForumModerators.php';
262 foreach($node_data as
$data)
267 $moderator_ids = $objFrmMods->getCurrentModerators();
273 else $frm_noti->setUserId($ilUser->getId());
275 $frm_noti->setForumId($data[
'obj_id']);
276 if(!in_array($frm_noti->getUserId(), $moderator_ids))
278 $frm_noti->deleteAdminForce();
288 if(!array_key_exists(
$ref_id, self::$node_data_cache))
291 self::$node_data_cache[
$ref_id] = $tree->getChildsByType(
$ref_id,
'frm');
294 return self::$node_data_cache[
$ref_id];
301 $parent_ref_id = $tree->getParentId($a_ref_id);
304 if($parent_obj->getType() ==
'crs' || $parent_obj->getType() ==
'grp')
305 return $parent_obj->getType();
312 global
$ilDB, $ilObjDataCache;
314 if(!$a_parameter[
'tree'] ==
'tree')
319 $ref_id = $a_parameter[
'source_id'];
320 $is_parent = self::_isParentNodeGrpCrs(
$ref_id);
327 DELETE FROM frm_notification 329 AND admin_force_noti = %s',
330 array(
'integer',
'integer'),
339 $parent_ref_id = $tree->getParentId(
$ref_id);
342 if($parent_obj->getType() ==
'crs')
344 include_once
'Modules/Course/classes/class.ilCourseParticipants.php';
347 else if($parent_obj->getType() ==
'grp')
349 include_once
'Modules/Group/classes/class.ilGroupParticipants.php';
354 if($parent_obj->getType() ==
'crs' || $parent_obj->getType() ==
'grp')
357 $admin_ids = $oParticipants->getAdmins();
358 $tutor_ids = $oParticipants->getTutors();
360 $result = array_unique(array_merge($moderator_ids,$admin_ids,$tutor_ids));
369 $res = $ilDB->manipulateF(
' 370 UPDATE frm_notification 371 SET admin_force_noti = %s, 372 user_toggle_noti = %s 375 array(
'integer',
'integer',
'integer',
'integer'),
383 $res = $ilDB->manipulateF(
' 384 DELETE FROM frm_notification 386 AND user_id_noti > %s',
387 array(
'integer',
'integer'),
397 SELECT * FROM frm_notification WHERE 414 $res = $ilDB->queryF(
'SELECT notification_id, user_id FROM frm_notification 417 ORDER BY user_id ASC',
418 array(
'integer',
'integer'),
array(0, $merge_source_thread_id));
420 $res_2 = $ilDB->queryF(
'SELECT user_id FROM frm_notification 423 ORDER BY user_id ASC',
424 array(
'integer',
'integer'),
array(0, $merge_target_thread_id));
426 $users_already_notified = $ilDB->fetchAssoc($res_2);
427 while(
$row = $ilDB->fetchAssoc(
$res))
429 if(in_array(
$row[
'user_id'], $users_already_notified))
432 $ilDB->manipulatef(
'DELETE FROM frm_notification WHERE notification_id = %s',
438 $ilDB->update(
'frm_notification',
439 array(
'thread_id' =>
array(
'integer', $merge_target_thread_id)),
440 array(
'thread_id' =>
array(
'integer', $merge_source_thread_id)
453 $res = $ilDB->queryF(
' 454 SELECT * FROM frm_notification 457 AND admin_force_noti = %s',
458 array(
'integer',
'integer',
'integer'),
static _isParentNodeGrpCrs($a_ref_id)
deleteNotificationAllUsers()
isUserToggleNotification()
isAdminForceNotification()
setUserIdNoti($a_user_id_noti)
static _getInstanceByObjId($a_obj_id)
Get singleton instance.
setAdminForce($a_admin_force)
static getCachedNodeData($ref_id)
Class ilForumNotification.
setThreadId($a_thread_id)
static mergeThreadNotificiations($merge_source_thread_id, $merge_target_thread_id)
setUserToggle($a_user_toggle)
static _clearForcedForumNotifications($a_parameter)
static _isUserToggleNoti($a_obj_id)
static _isAdminForceNoti($a_obj_id)
redirection script todo: (a better solution should control the processing via a xml file) ...
static _getInstanceByObjId($a_obj_id)
Get singleton instance.
Create styles array
The data for the language used.
static checkForumsExistsDelete($ref_id, $user_id=0)
__construct($ref_id)
Constructor public.
static checkParentNodeTree($ref_id)
static getInstanceByRefId($a_ref_id, $stop_on_error=true)
get an instance of an Ilias object by reference id
static _getModerators($a_ref_id)
get all users assigned to local role il_frm_moderator_<frm_ref_id> (static)
static checkForumsExistsInsert($ref_id, $user_id=0)
setNotificationId($a_notification_id)