4 require_once
'./Modules/Forum/classes/class.ilObjForum.php';
36 global $ilObjDataCache,
$lng,$ilias;
39 $this->
ilias = $ilias;
41 $this->forum_id = $ilObjDataCache->lookupObjId(
$ref_id);
47 $this->notification_id = $a_notification_id;
55 $this->user_id = $a_user_id;
64 $this->forum_id = $a_forum_id;
73 $this->thread_id = $a_thread_id;
83 $this->admin_force = $a_admin_force;
93 $this->user_toggle = $a_user_toggle;
102 $this->ref_id = $a_ref_id;
112 $this->user_id_noti = $a_user_id_noti;
117 return $this->user_id_noti;
124 $res = $ilDB->queryF(
' 125 SELECT admin_force_noti FROM frm_notification 128 AND user_id_noti > %s ',
129 array(
'integer',
'integer',
'integer'),
132 while(
$row = $ilDB->fetchAssoc(
$res))
134 return $row[
'admin_force_noti'];
141 $res = $ilDB->queryF(
' 142 SELECT user_toggle_noti FROM frm_notification 145 AND user_id_noti > %s',
146 array(
'integer',
'integer',
'integer'),
149 while(
$row = $ilDB->fetchAssoc(
$res))
151 return $row[
'user_toggle_noti'];
160 $next_id = $ilDB->nextId(
'frm_notification');
161 $res = $ilDB->manipulateF(
' 162 INSERT INTO frm_notification 163 (notification_id, user_id, frm_id, admin_force_noti, user_toggle_noti, user_id_noti) 164 VALUES(%s,%s,%s,%s,%s,%s)',
165 array(
'integer',
'integer',
'integer',
'integer',
'integer',
'integer'),
173 $res = $ilDB->manipulateF(
' 174 DELETE FROM frm_notification 177 AND admin_force_noti = %s 178 AND user_id_noti > %s' ,
179 array(
'integer',
'integer',
'integer',
'integer'),
187 $res = $ilDB->manipulateF(
' 188 DELETE FROM frm_notification 191 AND admin_force_noti = %s 192 AND user_toggle_noti = %s 193 AND user_id_noti > %s' ,
194 array(
'integer',
'integer',
'integer',
'integer',
'integer'),
203 $res = $ilDB->manipulateF(
' 204 UPDATE frm_notification 205 SET user_toggle_noti = %s 208 AND admin_force_noti = %s',
209 array(
'integer',
'integer',
'integer',
'integer'),
221 include_once
'Modules/Forum/classes/class.ilForumProperties.php';
223 $node_data = self::getCachedNodeData(
$ref_id);
225 foreach($node_data as
$data)
233 else $frm_noti->setUserId($ilUser->getId());
244 $frm_noti->setForumId($data[
'obj_id']);
245 if($frm_noti->existsNotification() ==
false)
247 $frm_noti->insertAdminForce();
257 $node_data = self::getCachedNodeData(
$ref_id);
259 include_once
'Modules/Forum/classes/class.ilForumModerators.php';
261 foreach($node_data as
$data)
266 $moderator_ids = $objFrmMods->getCurrentModerators();
272 else $frm_noti->setUserId($ilUser->getId());
274 $frm_noti->setForumId($data[
'obj_id']);
275 if(!in_array($frm_noti->getUserId(), $moderator_ids))
277 $frm_noti->deleteAdminForce();
287 if(!array_key_exists(
$ref_id, self::$node_data_cache))
290 self::$node_data_cache[
$ref_id] = $tree->getChildsByType(
$ref_id,
'frm');
293 return self::$node_data_cache[
$ref_id];
300 $parent_ref_id = $tree->getParentId($a_ref_id);
303 if($parent_obj->getType() ==
'crs' || $parent_obj->getType() ==
'grp')
304 return $parent_obj->getType();
311 global
$ilDB, $ilObjDataCache;
313 if(!$a_parameter[
'tree'] ==
'tree')
318 $ref_id = $a_parameter[
'source_id'];
319 $is_parent = self::_isParentNodeGrpCrs(
$ref_id);
326 DELETE FROM frm_notification 328 AND admin_force_noti = %s',
329 array(
'integer',
'integer'),
338 $parent_ref_id = $tree->getParentId(
$ref_id);
341 if($parent_obj->getType() ==
'crs')
343 include_once
'Modules/Course/classes/class.ilCourseParticipants.php';
346 else if($parent_obj->getType() ==
'grp')
348 include_once
'Modules/Group/classes/class.ilGroupParticipants.php';
353 if($parent_obj->getType() ==
'crs' || $parent_obj->getType() ==
'grp')
355 $moderator_ids = self::_getModerators(
$ref_id);
356 $admin_ids = $oParticipants->getAdmins();
357 $tutor_ids = $oParticipants->getTutors();
359 $result = array_unique(array_merge($moderator_ids,$admin_ids,$tutor_ids));
375 $role_arr = $rbacreview->getRolesOfRoleFolder($a_ref_id);
377 foreach ($role_arr as $role_id)
381 if ($title ==
"il_frm_moderator_".$a_ref_id)
383 #return $rbacreview->assignedUsers($roleObj->getId()); 384 return $title = $rbacreview->assignedUsers($role_id);
395 $res = $ilDB->manipulateF(
' 396 UPDATE frm_notification 397 SET admin_force_noti = %s, 398 user_toggle_noti = %s 401 array(
'integer',
'integer',
'integer',
'integer'),
409 $res = $ilDB->manipulateF(
' 410 DELETE FROM frm_notification 412 AND user_id_noti > %s',
413 array(
'integer',
'integer'),
423 SELECT * FROM frm_notification WHERE 440 $res = $ilDB->queryF(
'SELECT notification_id, user_id FROM frm_notification 443 ORDER BY user_id ASC',
444 array(
'integer',
'integer'), array(0, $merge_source_thread_id));
446 $res_2 = $ilDB->queryF(
'SELECT user_id FROM frm_notification 449 ORDER BY user_id ASC',
450 array(
'integer',
'integer'), array(0, $merge_target_thread_id));
452 $users_already_notified = $ilDB->fetchAssoc($res_2);
453 while(
$row = $ilDB->fetchAssoc(
$res))
455 if(in_array(
$row[
'user_id'], $users_already_notified))
458 $ilDB->manipulatef(
'DELETE FROM frm_notification WHERE notification_id = %s',
459 array(
'integer'), array(
$row[
'notification_id']));
464 $ilDB->update(
'frm_notification',
465 array(
'thread_id' => array(
'integer', $merge_target_thread_id)),
466 array(
'thread_id' => array(
'integer', $merge_source_thread_id)
479 $res = $ilDB->queryF(
' 480 SELECT * FROM frm_notification 483 AND admin_force_noti = %s',
484 array(
'integer',
'integer',
'integer'),
static _isParentNodeGrpCrs($a_ref_id)
_getModerators($a_ref_id)
get all users assigned to local role il_frm_moderator_<frm_ref_id> (static)
deleteNotificationAllUsers()
getInstanceByRefId($a_ref_id, $stop_on_error=true)
get an instance of an Ilias object by reference id
isUserToggleNotification()
isAdminForceNotification()
setUserIdNoti($a_user_id_noti)
static _getInstanceByObjId($a_obj_id)
Get singleton instance.
setAdminForce($a_admin_force)
static getCachedNodeData($ref_id)
static _lookupTitle($a_id)
lookup object title
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.
static checkForumsExistsDelete($ref_id, $user_id=0)
__construct($ref_id)
Constructor public.
static checkParentNodeTree($ref_id)
static checkForumsExistsInsert($ref_id, $user_id=0)
setNotificationId($a_notification_id)