ILIAS  Release_4_1_x_branch Revision 61804
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilNotification Class Reference

Class ilNotification. More...

+ Collaboration diagram for ilNotification:

Static Public Member Functions

static hasNotification ($type, $user_id, $id)
 Check notification status for object and user.
static getNotificationsForObject ($type, $id, $page_id=false)
 Get all users for given object.
static setNotification ($type, $user_id, $id, $status=true)
 Set notification status for object and user.
static updateNotificationTime ($type, $id, array $user_ids, $page_id=false)
 Update the last mail timestamp for given object and users.
static removeForObject ($type, $id)
 Remove all notifications for given object.
static removeForUser ($user_id)
 Remove all notifications for given user.

Data Fields

const TYPE_EXERCISE_SUBMISSION = 1
const TYPE_WIKI = 2
const TYPE_WIKI_PAGE = 3
const THRESHOLD = 180

Detailed Description

Class ilNotification.

Author
Jörg Lützenkirchen luetz.nosp@m.enki.nosp@m.rchen.nosp@m.@lei.nosp@m.fos.c.nosp@m.om
Id:
class.ilObjExerciseGUI.php 24003 2010-05-26 14:35:42Z akill

ilNotification:

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

Member Function Documentation

static ilNotification::getNotificationsForObject (   $type,
  $id,
  $page_id = false 
)
static

Get all users for given object.

Parameters
int$type
int$id
int$page_id
Returns
array

Definition at line 50 of file class.ilNotification.php.

References $ilDB, $row, and $user.

Referenced by ilWikiUtil\sendNotification(), and ilObjExerciseGUI\sendNotifications().

{
global $ilDB;
$sql .= "SELECT user_id FROM notification".
" WHERE type = ".$ilDB->quote($type, "integer").
" AND id = ".$ilDB->quote($id, "integer").
" AND (last_mail < ".$ilDB->quote(date("Y-m-d H:i:s", strtotime("-".self::THRESHOLD."minutes")), "timestamp").
" OR last_mail IS NULL";
if($page_id)
{
$sql .= " OR page_id <> ".$ilDB->quote($page_id, "integer");
}
$sql .= ")";
$user = array();
$set = $ilDB->query($sql);
while($row = $ilDB->fetchAssoc($set))
{
$user[] = $row["user_id"];
}
return $user;
}

+ Here is the caller graph for this function:

static ilNotification::hasNotification (   $type,
  $user_id,
  $id 
)
static

Check notification status for object and user.

Parameters
int$type
int$user_id
int$id
Returns
bool

Definition at line 31 of file class.ilNotification.php.

References $ilDB.

Referenced by ilObjExerciseGUI\getPropertiesValues(), and ilWikiPageGUI\preview().

{
global $ilDB;
$set = $ilDB->query("SELECT user_id FROM notification".
" WHERE type = ".$ilDB->quote($type, "integer").
" AND user_id = ".$ilDB->quote($user_id, "integer").
" AND id = ".$ilDB->quote($id, "integer"));
return (bool)$ilDB->numRows($set);
}

+ Here is the caller graph for this function:

static ilNotification::removeForObject (   $type,
  $id 
)
static

Remove all notifications for given object.

Parameters
int$type
int$id

Definition at line 136 of file class.ilNotification.php.

References $ilDB.

Referenced by ilWikiPage\delete(), ilObjWiki\delete(), and ilObjExercise\delete().

{
global $ilDB;
$ilDB->query("DELETE FROM notification".
" WHERE type = ".$ilDB->quote($type, "integer").
" AND id = ".$ilDB->quote($id, "integer"));
}

+ Here is the caller graph for this function:

static ilNotification::removeForUser (   $user_id)
static

Remove all notifications for given user.

Parameters
int$user_id

Definition at line 150 of file class.ilNotification.php.

References $ilDB.

Referenced by ilObjUser\delete().

{
global $ilDB;
$ilDB->query("DELETE FROM notification".
" WHERE user_id = ".$ilDB->quote($user_id, "integer"));
}

+ Here is the caller graph for this function:

static ilNotification::setNotification (   $type,
  $user_id,
  $id,
  $status = true 
)
static

Set notification status for object and user.

Parameters
int$type
int$user_id
int$id
bool$status
Returns
bool

Definition at line 83 of file class.ilNotification.php.

References $ilDB.

Referenced by ilWikiPageGUI\executeCommand(), and ilObjExerciseGUI\updateObject().

{
global $ilDB;
if(!$status)
{
$ilDB->query("DELETE FROM notification".
" WHERE type = ".$ilDB->quote($type, "integer").
" AND user_id = ".$ilDB->quote($user_id, "integer").
" AND id = ".$ilDB->quote($id, "integer"));
}
else
{
$ilDB->query("REPLACE INTO notification (type, user_id, id)".
" VALUES(".$ilDB->quote($type, "integer").
", ".$ilDB->quote($user_id, "integer").
", ".$ilDB->quote($id, "integer").")");
}
}

+ Here is the caller graph for this function:

static ilNotification::updateNotificationTime (   $type,
  $id,
array  $user_ids,
  $page_id = false 
)
static

Update the last mail timestamp for given object and users.

Parameters
int$type
int$id
array$user_ids
int$page_id

Definition at line 111 of file class.ilNotification.php.

References $ilDB.

Referenced by ilWikiUtil\sendNotification().

{
global $ilDB;
$sql = "UPDATE notification".
" SET last_mail = ".$ilDB->quote(date("Y-m-d H:i:s"), "timestamp");
if($page_id)
{
$sql .= ", page_id = ".$ilDB->quote($page_id, "integer");
}
$sql .= " WHERE type = ".$ilDB->quote($type, "integer").
" AND id = ".$ilDB->quote($id, "integer").
" AND ".$ilDB->in("user_id", $user_ids, false, "integer");
$ilDB->query($sql);
}

+ Here is the caller graph for this function:

Field Documentation

const ilNotification::THRESHOLD = 180

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

const ilNotification::TYPE_EXERCISE_SUBMISSION = 1
const ilNotification::TYPE_WIKI_PAGE = 3

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