ILIAS  Release_5_0_x_branch Revision 61816
 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=null, $ignore_threshold=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 TYPE_BLOG = 4
const TYPE_DATA_COLLECTION = 5
const TYPE_POLL = 6
const TYPE_LM_BLOCKED_USERS = 7
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 = null,
  $ignore_threshold = false 
)
static

Get all users for given object.

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

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

References $ilDB, and $row.

Referenced by ilLMPageGUI\processAnswer(), ilObjDataCollection\sendNotification(), ilObjBlog\sendNotification(), ilWikiUtil\sendNotification(), ilObjPollGUI\sendNotifications(), and ilObjExerciseGUI\sendNotifications().

{
global $ilDB;
$sql = "SELECT user_id FROM notification".
" WHERE type = ".$ilDB->quote($type, "integer").
" AND id = ".$ilDB->quote($id, "integer");
if(!$ignore_threshold)
{
$sql .= " 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 35 of file class.ilNotification.php.

References $ilDB.

Referenced by ilWikiPageGUI\addHeaderAction(), ilObjDataCollectionGUI\addHeaderAction(), ilObjExerciseGUI\getEditFormCustomValues(), ilPollBlockGUI\getHTML(), ilObjContentObjectGUI\getPropertiesFormValues(), and ilObjBlogGUI\initHeaderAction().

{
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 146 of file class.ilNotification.php.

References $ilDB.

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

{
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 160 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 91 of file class.ilNotification.php.

References $ilDB.

Referenced by ilWikiPageGUI\executeCommand(), ilObjContentObjectGUI\saveProperties(), ilObjPollGUI\subscribe(), ilObjBibliographicGUI\toggleNotification(), ilObjDataCollectionGUI\toggleNotification(), ilObjPollGUI\unsubscribe(), and ilObjExerciseGUI\updateCustom().

{
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
{
$fields = array(
"type" => array("integer", $type),
"user_id" => array("integer", $user_id),
"id" => array("integer", $id)
);
$ilDB->replace("notification", $fields, array());
}
}

+ 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 121 of file class.ilNotification.php.

References $ilDB.

Referenced by ilObjDataCollection\sendNotification(), ilObjBlog\sendNotification(), ilWikiUtil\sendNotification(), and ilObjPollGUI\sendNotifications().

{
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 25 of file class.ilNotification.php.

const ilNotification::TYPE_BLOG = 4
const ilNotification::TYPE_EXERCISE_SUBMISSION = 1
const ilNotification::TYPE_LM_BLOCKED_USERS = 7
const ilNotification::TYPE_POLL = 6

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