35 : void
36 {
37 if ($this->
user->isAnonymous() || 0 === (
int) $this->user->getId()) {
38 return;
39 }
40
41 $notificationSettings = new \ilSetting('notifications');
42 $chatSettings = new \ilSetting('chatroom');
43
44 $osdTemplate = new \ilTemplate('tpl.osd_notifications.js', true, true, 'Services/Notifications');
45
47 $osdTemplate->setVariable(
48 'NOTIFICATION_CLOSE_HTML',
49 json_encode($this->
ui->renderer()->render($this->ui->factory()->symbol()->glyph()->close()))
50 );
51 $osdTemplate->setVariable('INITIAL_NOTIFICATIONS', json_encode($notifications));
52 $osdTemplate->setVariable(
53 'OSD_POLLING_INTERVALL',
54 $notificationSettings->get('osd_polling_intervall') ? $notificationSettings->get('osd_polling_intervall') : '60'
55 );
56 $osdTemplate->setVariable(
57 'OSD_PLAY_SOUND',
58 $chatSettings->get('play_invitation_sound') && $this->user->getPref('chat_play_invitation_sound') ? 'true' : 'false'
59 );
60
63
64 $this->page->addJavaScript('Services/Notifications/templates/default/notifications.js');
65 $this->page->addCSS('Services/Notifications/templates/default/osd.css');
66 $this->page->addOnLoadCode($osdTemplate->get());
67 }
static getNotificationsForUser($user_id, $append_osd_id_to_link=true, $max_age_seconds=0)
static initMediaElementJs($a_tpl=null)
Init mediaelement.js scripts.
static initjQuery(ilGlobalTemplateInterface $a_tpl=null)
inits and adds the jQuery JS-File to the global or a passed template