39 $ilDB = $DIC->database();
40 $tree = $DIC->repositoryTree();
42 $notification =
false;
44 include_once(
"./Services/Notification/classes/class.ilObjNotificationSettings.php");
49 $grp_ref_id = $tree->checkForParentType($ref_id,
'grp');
50 if ($grp_ref_id > 0) {
51 include_once(
"./Modules/Group/classes/class.ilGroupParticipants.php");
56 $crs_ref_id = $tree->checkForParentType($ref_id,
'crs');
57 if ($crs_ref_id > 0) {
58 include_once(
"./Modules/Course/classes/class.ilCourseParticipants.php");
66 $set =
$ilDB->query(
"SELECT user_id FROM notification" .
67 " WHERE type = " .
$ilDB->quote(
$type,
"integer") .
68 " AND user_id = " .
$ilDB->quote($user_id,
"integer") .
69 " AND id = " .
$ilDB->quote(
$id,
"integer") .
70 " AND activated = " .
$ilDB->quote(0,
"integer"));
71 $rec =
$ilDB->fetchAssoc($set);
73 if ($rec[
"user_id"] == $user_id) {
85 $set =
$ilDB->query(
"SELECT user_id FROM notification" .
86 " WHERE type = " .
$ilDB->quote(
$type,
"integer") .
87 " AND user_id = " .
$ilDB->quote($user_id,
"integer") .
88 " AND id = " .
$ilDB->quote(
$id,
"integer") .
89 " AND activated = " .
$ilDB->quote(1,
"integer"));
91 return (
bool)
$ilDB->numRows($set);
102 include_once(
"./Services/Notification/classes/class.ilObjNotificationSettings.php");
123 $ilDB = $DIC->database();
124 $tree = $DIC->repositoryTree();
126 include_once(
"./Services/Notification/classes/class.ilObjNotificationSettings.php");
129 $recipients =
array();
133 $grp_ref_id = $tree->checkForParentType($ref_id,
'grp');
134 if ($grp_ref_id > 0) {
135 include_once(
"./Modules/Group/classes/class.ilGroupParticipants.php");
137 foreach ($p->getMembers() as $user_id) {
138 if (!in_array($user_id, $recipients)) {
139 $recipients[$user_id] = $user_id;
143 $crs_ref_id = $tree->checkForParentType($ref_id,
'crs');
144 if ($crs_ref_id > 0) {
145 include_once(
"./Modules/Course/classes/class.ilCourseParticipants.php");
147 foreach ($p->getMembers() as $user_id) {
148 if (!in_array($user_id, $recipients)) {
149 $recipients[$user_id] = $user_id;
158 $sql =
"SELECT user_id FROM notification" .
159 " WHERE type = " .
$ilDB->quote(
$type,
"integer") .
160 " AND id = " .
$ilDB->quote(
$id,
"integer") .
161 " AND activated = " .
$ilDB->quote(0,
"integer") .
162 " AND " .
$ilDB->in(
"user_id", $recipients,
false,
"integer");
163 $set =
$ilDB->query($sql);
164 while ($rec =
$ilDB->fetchAssoc($set)) {
165 unset($recipients[$rec[
"user_id"]]);
171 $sql =
"SELECT user_id FROM notification" .
172 " WHERE type = " .
$ilDB->quote(
$type,
"integer") .
173 " AND id = " .
$ilDB->quote(
$id,
"integer") .
174 " AND activated = " .
$ilDB->quote(1,
"integer") .
175 " AND " .
$ilDB->in(
"user_id", $recipients,
false,
"integer");
176 $sql .=
" AND (last_mail > " .
$ilDB->quote(
date(
178 strtotime(
"-" . self::THRESHOLD .
"minutes")
181 $sql .=
" AND page_id = " .
$ilDB->quote($page_id,
"integer");
185 $set =
$ilDB->query($sql);
186 while ($rec =
$ilDB->fetchAssoc($set)) {
187 unset($recipients[$rec[
"user_id"]]);
193 $sql =
"SELECT user_id FROM notification" .
194 " WHERE type = " .
$ilDB->quote(
$type,
"integer") .
195 " AND id = " .
$ilDB->quote(
$id,
"integer") .
196 " AND activated = " .
$ilDB->quote(1,
"integer");
197 if (!$ignore_threshold) {
198 $sql .=
" AND (last_mail < " .
$ilDB->quote(
date(
200 strtotime(
"-" . self::THRESHOLD .
"minutes")
202 " OR last_mail IS NULL";
204 $sql .=
" OR page_id <> " .
$ilDB->quote($page_id,
"integer");
208 $set =
$ilDB->query($sql);
210 $recipients[
$row[
"user_id"]] = $row[
"user_id"];
229 $ilDB = $DIC->database();
233 "user_id" =>
array(
"integer", $user_id),
236 $ilDB->replace(
"notification", $fields,
array(
"activated" =>
array(
"integer", (
int) $status)));
251 $ilDB = $DIC->database();
253 $sql =
"UPDATE notification" .
254 " SET last_mail = " .
$ilDB->quote(
date(
"Y-m-d H:i:s"),
"timestamp");
257 $sql .=
", page_id = " .
$ilDB->quote($page_id,
"integer");
260 $sql .=
" WHERE type = " .
$ilDB->quote(
$type,
"integer") .
261 " AND id = " .
$ilDB->quote(
$id,
"integer") .
262 " AND " .
$ilDB->in(
"user_id", $user_ids,
false,
"integer");
277 $ilDB = $DIC->database();
279 $ilDB->query(
"DELETE FROM notification" .
280 " WHERE type = " .
$ilDB->quote(
$type,
"integer") .
281 " AND id = " .
$ilDB->quote(
$id,
"integer"));
293 $ilDB = $DIC->database();
295 $ilDB->query(
"DELETE FROM notification" .
296 " WHERE user_id = " .
$ilDB->quote($user_id,
"integer"));
static _isParticipant($a_ref_id, $a_usr_id)
Static function to check if a user is a participant of the container object.
static hasNotification($type, $user_id, $id)
Check notification status for object and user.
static _isParticipant($a_ref_id, $a_usr_id)
Static function to check if a user is a participant of the container object.
static removeForObject($type, $id)
Remove all notifications for given object.
const TYPE_LM_BLOCKED_USERS
Handles general object notification settings, see e.g.
static _getInstanceByObjId($a_obj_id)
Get singleton instance.
if(!array_key_exists('StateId', $_REQUEST)) $id
static hasOptOut($obj_id)
Is opt out (disable notification) allowed?
static updateNotificationTime($type, $id, array $user_ids, $page_id=false)
Update the last mail timestamp for given object and users.
const MODE_DEF_ON_OPT_OUT
static _getAllReferences($a_id)
get all reference ids of object
static getNotificationsForObject($type, $id, $page_id=null, $ignore_threshold=false)
Get all users for given object.
static _lookupObjectId($a_ref_id)
lookup object id
const TYPE_DATA_COLLECTION
static removeForUser($user_id)
Remove all notifications for given user.
date( 'd-M-Y', $objPHPExcel->getProperties() ->getCreated())
static setNotification($type, $user_id, $id, $status=true)
Set notification status for object and user.
const MODE_DEF_OFF_USER_ACTIVATION
const TYPE_EXERCISE_SUBMISSION
static _getInstanceByObjId($a_obj_id)
Get singleton instance.
Create styles array
The data for the language used.
const MODE_DEF_ON_NO_OPT_OUT