ILIAS  Release_5_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilForumNotification Class Reference

Class ilForumNotification. More...

+ Collaboration diagram for ilForumNotification:

Public Member Functions

 __construct ($ref_id)
 Constructor public.
 setNotificationId ($a_notification_id)
 getNotificationId ()
 setUserId ($a_user_id)
 getUserId ()
 setForumId ($a_forum_id)
 getForumId ()
 setThreadId ($a_thread_id)
 getThreadId ()
 setAdminForce ($a_admin_force)
 getAdminForce ()
 setUserToggle ($a_user_toggle)
 getUserToggle ()
 setForumRefId ($a_ref_id)
 getForumRefId ()
 setUserIdNoti ($a_user_id_noti)
 getUserIdNoti ()
 isAdminForceNotification ()
 isUserToggleNotification ()
 insertAdminForce ()
 deleteAdminForce ()
 deleteUserToggle ()
 updateUserToggle ()
 _getModerators ($a_ref_id)
 get all users assigned to local role il_frm_moderator_<frm_ref_id> (static)
 update ()
 deleteNotificationAllUsers ()
 read ()
 existsNotification ()

Static Public Member Functions

static checkForumsExistsInsert ($ref_id, $user_id=0)
static checkForumsExistsDelete ($ref_id, $user_id=0)
static getCachedNodeData ($ref_id)
static _isParentNodeGrpCrs ($a_ref_id)
static _clearForcedForumNotifications ($a_parameter)
static checkParentNodeTree ($ref_id)
static mergeThreadNotificiations ($merge_source_thread_id, $merge_target_thread_id)

Static Protected Attributes

static $node_data_cache = array()

Private Attributes

 $notification_id
 $user_id
 $forum_id
 $thread_id
 $admin_force
 $user_toggle
 $ref_id

Detailed Description

Class ilForumNotification.

Author
Nadia Ahmad nahma.nosp@m.d@da.nosp@m.tabay.nosp@m..de
Version
$Id:$

Definition at line 15 of file class.ilForumNotification.php.

Constructor & Destructor Documentation

ilForumNotification::__construct (   $ref_id)

Constructor public.

Definition at line 34 of file class.ilForumNotification.php.

References $lng, and $ref_id.

{
global $ilObjDataCache,$lng,$ilias;
$this->lng = $lng;
$this->ilias = $ilias;
$this->ref_id = $ref_id;
$this->forum_id = $ilObjDataCache->lookupObjId($ref_id);
}

Member Function Documentation

static ilForumNotification::_clearForcedForumNotifications (   $a_parameter)
static

Definition at line 309 of file class.ilForumNotification.php.

References $forum_id, $ilDB, $ref_id, and _isParentNodeGrpCrs().

Referenced by ilForumAppEventListener\handleEvent().

{
global $ilDB, $ilObjDataCache;
if(!$a_parameter['tree'] == 'tree')
{
return;
}
$ref_id = $a_parameter['source_id'];
if($is_parent)
{
$forum_id = $ilObjDataCache->lookupObjId($ref_id);
$ilDB->manipulateF('
DELETE FROM frm_notification
WHERE frm_id = %s
AND admin_force_noti = %s',
array('integer','integer'),
array($forum_id, 1));
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilForumNotification::_getModerators (   $a_ref_id)

get all users assigned to local role il_frm_moderator_<frm_ref_id> (static)

Parameters
int$a_ref_idreference id
Returns
array user_ids public

Definition at line 371 of file class.ilForumNotification.php.

References ilObject\_lookupTitle().

Referenced by checkParentNodeTree(), and ilObjForumGUI\updateUserNotifications().

{
global $rbacreview;
$role_arr = $rbacreview->getRolesOfRoleFolder($a_ref_id);
foreach ($role_arr as $role_id)
{
//$roleObj = $this->ilias->obj_factory->getInstanceByObjId($role_id);
$title = ilObject::_lookupTitle($role_id);
if ($title == "il_frm_moderator_".$a_ref_id)
{
#return $rbacreview->assignedUsers($roleObj->getId());
return $title = $rbacreview->assignedUsers($role_id);
}
}
return array();
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static ilForumNotification::_isParentNodeGrpCrs (   $a_ref_id)
static

Definition at line 296 of file class.ilForumNotification.php.

References ilObjectFactory\getInstanceByRefId().

Referenced by _clearForcedForumNotifications(), ilForumModeratorsGUI\addModerator(), and ilForumModeratorsGUI\detachModeratorRole().

{
global $tree;
$parent_ref_id = $tree->getParentId($a_ref_id);
$parent_obj = ilObjectFactory::getInstanceByRefId($parent_ref_id);
if($parent_obj->getType() == 'crs' || $parent_obj->getType() == 'grp')
return $parent_obj->getType();
else return false;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static ilForumNotification::checkForumsExistsDelete (   $ref_id,
  $user_id = 0 
)
static

Definition at line 253 of file class.ilForumNotification.php.

References $ilUser, $ref_id, $user_id, and getCachedNodeData().

Referenced by ilPDSelectedItemsBlockGUI\confirmedUnsubscribe(), and ilForumAppEventListener\handleEvent().

{
global $ilUser;
include_once 'Modules/Forum/classes/class.ilForumModerators.php';
foreach($node_data as $data)
{
//check frm_properties if frm_noti is enabled
$frm_noti = new ilForumNotification($data['ref_id']);
$objFrmMods = new ilForumModerators($data['ref_id']);
$moderator_ids = $objFrmMods->getCurrentModerators();
if($user_id != 0)
{
$frm_noti->setUserId($user_id);
}
else $frm_noti->setUserId($ilUser->getId());
$frm_noti->setForumId($data['obj_id']);
if(!in_array($frm_noti->getUserId(), $moderator_ids))
{
$frm_noti->deleteAdminForce();
}
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static ilForumNotification::checkForumsExistsInsert (   $ref_id,
  $user_id = 0 
)
static

Definition at line 217 of file class.ilForumNotification.php.

References $admin_force, $ilUser, $ref_id, $user_id, $user_toggle, ilForumProperties\_isAdminForceNoti(), ilForumProperties\_isUserToggleNoti(), and getCachedNodeData().

Referenced by ilGroupRegistrationGUI\add(), ilCourseRegistrationGUI\add(), ilForumAppEventListener\handleEvent(), and ilObjCourse\register().

{
global $ilUser;
include_once 'Modules/Forum/classes/class.ilForumProperties.php';
foreach($node_data as $data)
{
//check frm_properties if frm_noti is enabled
$frm_noti = new ilForumNotification($data['ref_id']);
if($user_id != 0)
{
$frm_noti->setUserId($user_id);
}
else $frm_noti->setUserId($ilUser->getId());
$frm_noti->setAdminForce($admin_force);
if($user_toggle) $frm_noti->setAdminForce(1);
if($admin_force == 1 || $user_toggle == 1)
{
$frm_noti->setUserToggle($user_toggle);
$frm_noti->setForumId($data['obj_id']);
if($frm_noti->existsNotification() == false)
{
$frm_noti->insertAdminForce();
}
}
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static ilForumNotification::checkParentNodeTree (   $ref_id)
static

Definition at line 334 of file class.ilForumNotification.php.

References $ref_id, $result, ilGroupParticipants\_getInstanceByObjId(), ilCourseParticipants\_getInstanceByObjId(), _getModerators(), and ilObjectFactory\getInstanceByRefId().

{
global $tree;
$parent_ref_id = $tree->getParentId($ref_id);
$parent_obj = ilObjectFactory::getInstanceByRefId($parent_ref_id);
if($parent_obj->getType() == 'crs')
{
include_once 'Modules/Course/classes/class.ilCourseParticipants.php';
$oParticipants = ilCourseParticipants::_getInstanceByObjId($parent_obj->getId());
}
else if($parent_obj->getType() == 'grp')
{
include_once 'Modules/Group/classes/class.ilGroupParticipants.php';
$oParticipants = ilGroupParticipants::_getInstanceByObjId($parent_obj->getId());
}
$result = array();
if($parent_obj->getType() == 'crs' || $parent_obj->getType() == 'grp')
{
$moderator_ids = self::_getModerators($ref_id);
$admin_ids = $oParticipants->getAdmins();
$tutor_ids = $oParticipants->getTutors();
$result = array_unique(array_merge($moderator_ids,$admin_ids,$tutor_ids));
}
return $result;
}

+ Here is the call graph for this function:

ilForumNotification::deleteAdminForce ( )

Definition at line 169 of file class.ilForumNotification.php.

References $ilDB, $res, getForumId(), and getUserId().

{
global $ilDB;
$res = $ilDB->manipulateF('
DELETE FROM frm_notification
WHERE user_id = %s
AND frm_id = %s
AND admin_force_noti = %s
AND user_id_noti > %s' ,
array('integer', 'integer','integer', 'integer'),
array($this->getUserId(), $this->getForumId(), 1, 0));
}

+ Here is the call graph for this function:

ilForumNotification::deleteNotificationAllUsers ( )

Definition at line 405 of file class.ilForumNotification.php.

References $ilDB, $res, and getForumId().

{
global $ilDB;
$res = $ilDB->manipulateF('
DELETE FROM frm_notification
WHERE frm_id = %s
AND user_id_noti > %s',
array('integer', 'integer'),
array($this->getForumId(), 0));
}

+ Here is the call graph for this function:

ilForumNotification::deleteUserToggle ( )

Definition at line 183 of file class.ilForumNotification.php.

References $ilDB, $ilUser, $res, getForumId(), and getUserId().

{
global $ilDB, $ilUser;
$res = $ilDB->manipulateF('
DELETE FROM frm_notification
WHERE user_id = %s
AND frm_id = %s
AND admin_force_noti = %s
AND user_toggle_noti = %s
AND user_id_noti > %s' ,
array('integer', 'integer','integer','integer', 'integer'),
array($this->getUserId(),$this->getForumId(),1,1, 0 ));
}

+ Here is the call graph for this function:

ilForumNotification::existsNotification ( )
Returns
bool

Definition at line 475 of file class.ilForumNotification.php.

References $ilDB, $res, $row, getAdminForce(), getForumId(), and getUserId().

{
global $ilDB;
$res = $ilDB->queryF('
SELECT * FROM frm_notification
WHERE user_id = %s
AND frm_id = %s
AND admin_force_noti = %s',
array('integer', 'integer', 'integer'),
array($this->getUserId(), $this->getForumId(), $this->getAdminForce()));
if($row = $ilDB->numRows($res) > 0)
{
return true;
}
return false;
}

+ Here is the call graph for this function:

ilForumNotification::getAdminForce ( )

Definition at line 85 of file class.ilForumNotification.php.

References $admin_force.

Referenced by existsNotification(), insertAdminForce(), and update().

{
}

+ Here is the caller graph for this function:

static ilForumNotification::getCachedNodeData (   $ref_id)
static
Parameters
$ref_id

Definition at line 285 of file class.ilForumNotification.php.

References $ref_id.

Referenced by checkForumsExistsDelete(), and checkForumsExistsInsert().

{
if(!array_key_exists($ref_id, self::$node_data_cache))
{
global $tree;
self::$node_data_cache[$ref_id] = $tree->getChildsByType($ref_id, 'frm');
}
return self::$node_data_cache[$ref_id];
}

+ Here is the caller graph for this function:

ilForumNotification::getForumId ( )
ilForumNotification::getForumRefId ( )

Definition at line 104 of file class.ilForumNotification.php.

References $ref_id.

{
return $this->ref_id;
}
ilForumNotification::getNotificationId ( )

Definition at line 49 of file class.ilForumNotification.php.

References $notification_id.

ilForumNotification::getThreadId ( )

Definition at line 75 of file class.ilForumNotification.php.

References $thread_id.

{
}
ilForumNotification::getUserId ( )
ilForumNotification::getUserIdNoti ( )

Definition at line 115 of file class.ilForumNotification.php.

{
return $this->user_id_noti;
}
ilForumNotification::getUserToggle ( )

Definition at line 95 of file class.ilForumNotification.php.

References $user_toggle.

Referenced by insertAdminForce(), update(), and updateUserToggle().

{
}

+ Here is the caller graph for this function:

ilForumNotification::insertAdminForce ( )

Definition at line 156 of file class.ilForumNotification.php.

References $ilDB, $ilUser, $res, getAdminForce(), getForumId(), getUserId(), and getUserToggle().

{
global $ilDB, $ilUser;
$next_id = $ilDB->nextId('frm_notification');
$res = $ilDB->manipulateF('
INSERT INTO frm_notification
(notification_id, user_id, frm_id, admin_force_noti, user_toggle_noti, user_id_noti)
VALUES(%s,%s,%s,%s,%s,%s)',
array('integer', 'integer', 'integer', 'integer', 'integer', 'integer'),
array($next_id, $this->getUserId(), $this->getForumId(), $this->getAdminForce(), $this->getUserToggle(), $ilUser->getId()));
}

+ Here is the call graph for this function:

ilForumNotification::isAdminForceNotification ( )

Definition at line 120 of file class.ilForumNotification.php.

References $ilDB, $res, $row, getForumId(), and getUserId().

{
global $ilDB;
$res = $ilDB->queryF('
SELECT admin_force_noti FROM frm_notification
WHERE user_id = %s
AND frm_id = %s
AND user_id_noti > %s ',
array('integer','integer', 'integer'),
array($this->getUserId(), $this->getForumId(), 0));
while($row = $ilDB->fetchAssoc($res))
{
return $row['admin_force_noti'];
}
}

+ Here is the call graph for this function:

ilForumNotification::isUserToggleNotification ( )

Definition at line 137 of file class.ilForumNotification.php.

References $ilDB, $res, $row, getForumId(), and getUserId().

Referenced by ilObjForumGUI\getUserNotificationTableData().

{
global $ilDB;
$res = $ilDB->queryF('
SELECT user_toggle_noti FROM frm_notification
WHERE user_id = %s
AND frm_id = %s
AND user_id_noti > %s',
array('integer', 'integer', 'integer'),
array($this->getUserId(), $this->getForumId(), 0 ));
while($row = $ilDB->fetchAssoc($res))
{
return $row['user_toggle_noti'];
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static ilForumNotification::mergeThreadNotificiations (   $merge_source_thread_id,
  $merge_target_thread_id 
)
static

Definition at line 435 of file class.ilForumNotification.php.

References $ilDB, $res, and $row.

Referenced by ilForum\mergeThreads().

{
// check notifications etc..
global $ilDB;
$res = $ilDB->queryF('SELECT notification_id, user_id FROM frm_notification
WHERE frm_id = %s
AND thread_id = %s
ORDER BY user_id ASC',
array('integer', 'integer'), array(0, $merge_source_thread_id));
$res_2 = $ilDB->queryF('SELECT user_id FROM frm_notification
WHERE frm_id = %s
AND thread_id = %s
ORDER BY user_id ASC',
array('integer', 'integer'), array(0, $merge_target_thread_id));
$users_already_notified = $ilDB->fetchAssoc($res_2);
while($row = $ilDB->fetchAssoc($res))
{
if(in_array($row['user_id'], $users_already_notified))
{
// delete source notification because already exists for target_id
$ilDB->manipulatef('DELETE FROM frm_notification WHERE notification_id = %s',
array('integer'), array($row['notification_id']));
}
else
{
// update source notification
$ilDB->update('frm_notification',
array('thread_id' => array('integer', $merge_target_thread_id)),
array('thread_id' => array('integer', $merge_source_thread_id)
));
}
}
}

+ Here is the caller graph for this function:

ilForumNotification::read ( )

Definition at line 417 of file class.ilForumNotification.php.

References $ilDB, $query, $result, $row, and getForumId().

{
global $ilDB;
$result = array();
$query = $ilDB->queryF('
SELECT * FROM frm_notification WHERE
frm_id = %s',
array('integer'),
array($this->getForumId()));
while($row = $ilDB->fetchAssoc($query))
{
$result[$row['user_id']] = $row;
}
return $result;
}

+ Here is the call graph for this function:

ilForumNotification::setAdminForce (   $a_admin_force)

Definition at line 81 of file class.ilForumNotification.php.

{
$this->admin_force = $a_admin_force;
}
ilForumNotification::setForumId (   $a_forum_id)

Definition at line 62 of file class.ilForumNotification.php.

{
$this->forum_id = $a_forum_id;
}
ilForumNotification::setForumRefId (   $a_ref_id)

Definition at line 100 of file class.ilForumNotification.php.

{
$this->ref_id = $a_ref_id;
}
ilForumNotification::setNotificationId (   $a_notification_id)

Definition at line 45 of file class.ilForumNotification.php.

{
$this->notification_id = $a_notification_id;
}
ilForumNotification::setThreadId (   $a_thread_id)

Definition at line 71 of file class.ilForumNotification.php.

{
$this->thread_id = $a_thread_id;
}
ilForumNotification::setUserId (   $a_user_id)

Definition at line 53 of file class.ilForumNotification.php.

Referenced by ilObjForumGUI\getUserNotificationTableData().

{
$this->user_id = $a_user_id;
}

+ Here is the caller graph for this function:

ilForumNotification::setUserIdNoti (   $a_user_id_noti)

Definition at line 110 of file class.ilForumNotification.php.

{
$this->user_id_noti = $a_user_id_noti;
}
ilForumNotification::setUserToggle (   $a_user_toggle)

Definition at line 91 of file class.ilForumNotification.php.

{
$this->user_toggle = $a_user_toggle;
}
ilForumNotification::update ( )

Definition at line 391 of file class.ilForumNotification.php.

References $ilDB, $res, getAdminForce(), getForumId(), getUserId(), and getUserToggle().

{
global $ilDB;
$res = $ilDB->manipulateF('
UPDATE frm_notification
SET admin_force_noti = %s,
user_toggle_noti = %s
WHERE user_id = %s
AND frm_id = %s',
array('integer','integer','integer','integer'),
array($this->getAdminForce(), $this->getUserToggle(), $this->getUserId(), $this->getForumId()));
}

+ Here is the call graph for this function:

ilForumNotification::updateUserToggle ( )

Definition at line 199 of file class.ilForumNotification.php.

References $ilDB, $res, getForumId(), getUserId(), and getUserToggle().

{
global $ilDB;
$res = $ilDB->manipulateF('
UPDATE frm_notification
SET user_toggle_noti = %s
WHERE user_id = %s
AND frm_id = %s
AND admin_force_noti = %s',
array('integer','integer','integer','integer'),
array($this->getUserToggle(), $this->getUserId(),$this->getForumId(), 1));
}

+ Here is the call graph for this function:

Field Documentation

ilForumNotification::$admin_force
private

Definition at line 23 of file class.ilForumNotification.php.

Referenced by checkForumsExistsInsert(), and getAdminForce().

ilForumNotification::$forum_id
private

Definition at line 21 of file class.ilForumNotification.php.

Referenced by _clearForcedForumNotifications(), and getForumId().

ilForumNotification::$node_data_cache = array()
staticprotected

Definition at line 17 of file class.ilForumNotification.php.

ilForumNotification::$notification_id
private

Definition at line 19 of file class.ilForumNotification.php.

Referenced by getNotificationId().

ilForumNotification::$thread_id
private

Definition at line 22 of file class.ilForumNotification.php.

Referenced by getThreadId().

ilForumNotification::$user_id
private
ilForumNotification::$user_toggle
private

Definition at line 24 of file class.ilForumNotification.php.

Referenced by checkForumsExistsInsert(), and getUserToggle().


The documentation for this class was generated from the following file: