3 require_once
'Services/Notifications/classes/class.ilNotificationSetupHelper.php';
4 require_once
'Services/Notifications/classes/class.ilNotificationEchoHandler.php';
21 'notification_osd_id' =>
array(
'integer',
$id),
22 'usr_id' =>
array(
'integer', $notification->user->getId()),
23 'serialized' =>
array(
'text', serialize($notification)),
24 'valid_until' =>
array(
'integer', $notification->baseNotification->getValidForSeconds() ? ($notification->baseNotification->getValidForSeconds() +
time()) : 0),
25 'visible_for' =>
array(
'integer', $notification->baseNotification->getVisibleForSeconds() ? $notification->baseNotification->getVisibleForSeconds() : 0),
26 'type' =>
array(
'text', $notification->baseNotification->getType()),
36 $txt->setRequired(
true);
37 $txt->setInfo($lng->txt(
'polling_in_seconds'));
38 $txt->setValue(
'300');
40 $item->addSubItem(
$txt);
42 return array(
'osd_polling_intervall');
50 .
' WHERE usr_id = %s AND (valid_until = 0 OR valid_until > ' . $ilDB->quote(
time(),
'integer') .
') AND time_added > %s';
52 $types =
array(
'integer',
'integer');
53 $values =
array($user_id, $max_age_seconds ? (
time() - $max_age_seconds) : 0);
55 $rset = $ilDB->queryF(
$query, $types, $values);
56 $notifications =
array();
58 while (
$row = $ilDB->fetchAssoc($rset)) {
59 $row[
'data'] = unserialize(
$row[
'serialized']);
60 unset(
$row[
'serialized']);
62 $row[
'data']->handlerParams =
array(
'general' =>
$row[
'data']->handlerParams[
''],
'osd' =>
$row[
'data']->handlerParams[
'osd']);
64 if ($append_osd_id_to_link) {
65 if (
$row[
'data']->link) {
66 $row[
'data']->link = self::appendParamToLink(
$row[
'data']->link,
'osd_id',
$row[
'notification_osd_id']);
69 $row[
'data']->shortDescription = self::appendOsdIdToLinks(
$row[
'data']->shortDescription,
$row[
'notification_osd_id']);
70 $row[
'data']->longDescription = self::appendOsdIdToLinks(
$row[
'data']->longDescription,
$row[
'notification_osd_id']);
72 $notifications[] =
$row;
75 self::cleanupOnRandom();
77 return $notifications;
83 preg_match_all(
'/href="(.*?)"/', $subject, $matches);
85 foreach ($matches[1] as $match) {
86 $match_appended = self::appendParamToLink($match,
'osd_id', $osd_id);
87 $subject = str_replace($match, $match_appended, $subject);
105 $types =
array(
'integer');
106 $values =
array($notification_osd_id);
108 $rset = $ilDB->queryF(
$query, $types, $values);
110 if (
$row = $ilDB->fetchAssoc($rset)) {
112 $types =
array(
'integer');
113 $values =
array($notification_osd_id);
115 $ilDB->manipulateF(
$query, $types, $values);
139 $ilDB->manipulate(
$query);
147 $rnd = rand(0, 10000);
163 if (strpos($link,
'?') !==
false) {
164 $link .=
'&' . $param .
'=' . $value;
166 $link .=
'?' . $param .
'=' . $value;
static removeNotification($notification_osd_id)
Removes a notifcation and triggers a follow up notification to remove the notification from the brows...
A concrete notification based on the ilNotificationConfiguration and returned by ilNotificationConfig...
if(!array_key_exists('StateId', $_REQUEST)) $id
static appendParamToLink($link, $param, $value)
Helper to append an additional parameter to an existing url.
static $tbl_notification_osd_handler
This class represents a text property in a property form.
Basic notification handler that dumps basic notification information to stdout.
Create styles array
The data for the language used.
static cleanup()
Remove orphaned notifications.
static getNotificationsForUser($user_id, $append_osd_id_to_link=true, $max_age_seconds=0)
notify(ilNotificationObject $notification)
Add data(end) time
Method that wraps PHPs time in order to allow simulations with the workflow.
static appendOsdIdToLinks($subject, $osd_id)
static cleanupOnRandom()
Exec self::clean with a probability of 1%.