ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
class.ilNotificationOSDGUI.php
Go to the documentation of this file.
1<?php
2
7{
11 protected $user;
12
16 protected $mainTemplate;
17
21 protected $lng;
22
30 {
31 $this->user = $user;
32 $this->mainTemplate = $mainTemplate;
33 $this->lng = $lng;
34 }
35
36 public function render()
37 {
38 $notificationSettings = new \ilSetting('notifications');
39 $chatSettings = new \ilSetting('chatroom');
40
41 $osdTemplate = new \ilTemplate('tpl.osd_notifications.js', true, true, 'Services/Notifications');
42
43 require_once 'Services/Notifications/classes/class.ilNotificationOSDHandler.php';
44 require_once 'Services/UIComponent/Glyph/classes/class.ilGlyphGUI.php';
45
46 $notifications = \ilNotificationOSDHandler::getNotificationsForUser($this->user->getId());
47 $osdTemplate->setVariable('NOTIFICATION_CLOSE_HTML', json_encode(ilGlyphGUI::get(ilGlyphGUI::CLOSE, $this->lng->txt('close'))));
48 $osdTemplate->setVariable('INITIAL_NOTIFICATIONS', json_encode($notifications));
49 $osdTemplate->setVariable('OSD_POLLING_INTERVALL', $notificationSettings->get('osd_polling_intervall') ? $notificationSettings->get('osd_polling_intervall') : '60');
50 $osdTemplate->setVariable('OSD_PLAY_SOUND', $chatSettings->get('play_invitation_sound') && $this->user->getPref('chat_play_invitation_sound') ? 'true' : 'false');
51
52 require_once "Services/jQuery/classes/class.iljQueryUtil.php";
54
55 require_once 'Services/MediaObjects/classes/class.ilPlayerUtil.php';
57
58 $this->mainTemplate->addJavaScript('Services/Notifications/templates/default/notifications.js');
59 $this->mainTemplate->addCSS('Services/Notifications/templates/default/osd.css');
60 $this->mainTemplate->addOnLoadCode($osdTemplate ->get());
61 }
62}
user()
Definition: user.php:4
An exception for terminatinating execution or to throw for unit testing.
static get($a_glyph, $a_text="")
Get glyph html.
language handling
Class ilNotificationOSDGUI.
__construct(\ilObjUser $user, \ilTemplate $mainTemplate, \ilLanguage $lng)
ilNotificationOSDGUI constructor.
static getNotificationsForUser($user_id, $append_osd_id_to_link=true, $max_age_seconds=0)
static initMediaElementJs($a_tpl=null)
Init mediaelement.js scripts.
special template class to simplify handling of ITX/PEAR
static initjQuery($a_tpl=null)
inits and adds the jQuery JS-File to the global or a passed template