3 require_once
'Services/Notifications/classes/class.ilNotificationSetupHelper.php';
4 require_once
'Services/Notifications/classes/class.ilNotificationEchoHandler.php';
50 $this->database->insert(
53 'notification_osd_id' => array(
'integer',
$id),
54 'usr_id' => array(
'integer', $notification->user->getId()),
55 'serialized' => array(
'text', serialize($notification)),
56 'valid_until' => array(
'integer', $notification->baseNotification->getValidForSeconds() ? ($notification->baseNotification->getValidForSeconds() + time()) : 0),
57 'visible_for' => array(
'integer', $notification->baseNotification->getVisibleForSeconds() ? $notification->baseNotification->getVisibleForSeconds() : 0),
58 'type' => array(
'text', $notification->baseNotification->getType()),
59 'time_added' => array(
'integer', time()),
67 $txt->setRequired(
true);
68 $txt->setInfo($this->
language->txt(
'polling_in_seconds'));
69 $txt->setValue(
'300');
71 $item->addSubItem(
$txt);
73 return array(
'osd_polling_intervall');
80 $ilDB = $DIC->database();
83 .
' WHERE usr_id = %s AND (valid_until = 0 OR valid_until > ' .
$ilDB->quote(time(),
'integer') .
') AND time_added > %s';
85 $types = array(
'integer',
'integer');
86 $values = array($user_id, $max_age_seconds ? (time() - $max_age_seconds) : 0);
89 $notifications = array();
92 $row[
'data'] = unserialize(
$row[
'serialized']);
93 unset(
$row[
'serialized']);
95 $row[
'data']->handlerParams = array(
'general' =>
$row[
'data']->handlerParams[
''],
'osd' =>
$row[
'data']->handlerParams[
'osd']);
97 if ($append_osd_id_to_link) {
98 if (
$row[
'data']->link) {
99 $row[
'data']->link = self::appendParamToLink(
$row[
'data']->link,
'osd_id',
$row[
'notification_osd_id']);
102 $row[
'data']->shortDescription = self::appendOsdIdToLinks(
$row[
'data']->shortDescription,
$row[
'notification_osd_id']);
103 $row[
'data']->longDescription = self::appendOsdIdToLinks(
$row[
'data']->longDescription,
$row[
'notification_osd_id']);
105 $notifications[] =
$row;
108 self::cleanupOnRandom();
110 return $notifications;
116 preg_match_all(
'/href="(.*?)"/', $subject, $matches);
118 foreach ($matches[1] as $match) {
119 $match_appended = self::appendParamToLink($match,
'osd_id', $osd_id);
120 $subject = str_replace($match, $match_appended, $subject);
137 $ilDB = $DIC->database();
140 $types = array(
'integer');
141 $values = array($notification_osd_id);
147 $types = array(
'integer');
148 $values = array($notification_osd_id);
163 $ilDB = $DIC->database();
174 $rnd = rand(0, 10000);
190 if (strpos($link,
'?') !==
false) {
191 $link .=
'&' . $param .
'=' . $value;
193 $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
__construct(\ilDBInterface $database=null, \ilLanguage $language=null, \ILIAS\DI\Container $dic=null)
ilNotificationOSDHandler constructor.
This class represents a text property in a property form.
Basic notification handler that dumps basic notification information to stdout.
static cleanup()
Remove orphaned notifications.
static getNotificationsForUser($user_id, $append_osd_id_to_link=true, $max_age_seconds=0)
notify(ilNotificationObject $notification)
static appendOsdIdToLinks($subject, $osd_id)
static cleanupOnRandom()
Exec self::clean with a probability of 1%.