ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
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. More...
 
static getNotificationsForObject ($type, $id, $page_id=null, $ignore_threshold=false)
 Get all users for given object. More...
 
static setNotification ($type, $user_id, $id, $status=true)
 Set notification status for object and user. More...
 
static updateNotificationTime ($type, $id, array $user_ids, $page_id=false)
 Update the last mail timestamp for given object and users. More...
 
static removeForObject ($type, $id)
 Remove all notifications for given object. More...
 
static removeForUser ($user_id)
 Remove all notifications for given user. More...
 

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

@ilCtrl_Calls ilNotification:

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

Member Function Documentation

◆ getNotificationsForObject()

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.

56 {
57 global $ilDB;
58
59 $sql = "SELECT user_id FROM notification".
60 " WHERE type = ".$ilDB->quote($type, "integer").
61 " AND id = ".$ilDB->quote($id, "integer");
62 if(!$ignore_threshold)
63 {
64 $sql .= " AND (last_mail < ".$ilDB->quote(date("Y-m-d H:i:s",
65 strtotime("-".self::THRESHOLD."minutes")), "timestamp").
66 " OR last_mail IS NULL";
67 if($page_id)
68 {
69 $sql .= " OR page_id <> ".$ilDB->quote($page_id, "integer");
70 }
71 $sql .= ")";
72 }
73 $user = array();
74 $set = $ilDB->query($sql);
75 while($row = $ilDB->fetchAssoc($set))
76 {
77 $user[] = $row["user_id"];
78 }
79 return $user;
80 }
global $ilDB

References $ilDB, and $row.

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

+ Here is the caller graph for this function:

◆ hasNotification()

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.

36 {
37 global $ilDB;
38
39 $set = $ilDB->query("SELECT user_id FROM notification".
40 " WHERE type = ".$ilDB->quote($type, "integer").
41 " AND user_id = ".$ilDB->quote($user_id, "integer").
42 " AND id = ".$ilDB->quote($id, "integer"));
43 return (bool)$ilDB->numRows($set);
44 }

References $ilDB.

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

+ Here is the caller graph for this function:

◆ removeForObject()

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.

147 {
148 global $ilDB;
149
150 $ilDB->query("DELETE FROM notification".
151 " WHERE type = ".$ilDB->quote($type, "integer").
152 " AND id = ".$ilDB->quote($id, "integer"));
153 }

References $ilDB.

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

+ Here is the caller graph for this function:

◆ removeForUser()

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.

161 {
162 global $ilDB;
163
164 $ilDB->query("DELETE FROM notification".
165 " WHERE user_id = ".$ilDB->quote($user_id, "integer"));
166 }

References $ilDB.

Referenced by ilObjUser\delete().

+ Here is the caller graph for this function:

◆ setNotification()

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.

92 {
93 global $ilDB;
94
95 if(!$status)
96 {
97 $ilDB->query("DELETE FROM notification".
98 " WHERE type = ".$ilDB->quote($type, "integer").
99 " AND user_id = ".$ilDB->quote($user_id, "integer").
100 " AND id = ".$ilDB->quote($id, "integer"));
101 }
102 else
103 {
104 $fields = array(
105 "type" => array("integer", $type),
106 "user_id" => array("integer", $user_id),
107 "id" => array("integer", $id)
108 );
109 $ilDB->replace("notification", $fields, array());
110 }
111 }

References $ilDB.

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

+ Here is the caller graph for this function:

◆ updateNotificationTime()

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.

122 {
123 global $ilDB;
124
125 $sql = "UPDATE notification".
126 " SET last_mail = ".$ilDB->quote(date("Y-m-d H:i:s"), "timestamp");
127
128 if($page_id)
129 {
130 $sql .= ", page_id = ".$ilDB->quote($page_id, "integer");
131 }
132
133 $sql .= " WHERE type = ".$ilDB->quote($type, "integer").
134 " AND id = ".$ilDB->quote($id, "integer").
135 " AND ".$ilDB->in("user_id", $user_ids, false, "integer");
136
137 $ilDB->query($sql);
138 }

References $ilDB.

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

+ Here is the caller graph for this function:

Field Documentation

◆ THRESHOLD

const ilNotification::THRESHOLD = 180

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

◆ TYPE_BLOG

const ilNotification::TYPE_BLOG = 4

◆ TYPE_DATA_COLLECTION

◆ TYPE_EXERCISE_SUBMISSION

const ilNotification::TYPE_EXERCISE_SUBMISSION = 1

◆ TYPE_LM_BLOCKED_USERS

const ilNotification::TYPE_LM_BLOCKED_USERS = 7

◆ TYPE_POLL

const ilNotification::TYPE_POLL = 6

◆ TYPE_WIKI

◆ TYPE_WIKI_PAGE


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