ILIAS  release_8 Revision v8.24
ilNotificationOSDGUI.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
21namespace ILIAS\Notifications;
22
25use iljQueryUtil;
26use ilLanguage;
27use ilObjUser;
28use ilPlayerUtil;
29use ilSetting;
30use ilTemplate;
31
36{
37 public const DEFAULT_POLLING_INTERVAL = 60000;
38
39 protected ilObjUser $user;
41 protected ilLanguage $lng;
42
44 {
45 global $DIC;
46
47 $this->user = $DIC->user();
48 $this->page = $page;
49 $this->lng = $language;
50 }
51
52 public function populatePage(): void
53 {
54 if ($this->user->isAnonymous() || 0 === $this->user->getId()) {
55 return;
56 }
57
58 $notificationSettings = new ilSetting('notifications');
59
60 if ($notificationSettings->get('enable_osd', '0') === '1') {
61 $osdTemplate = new ilTemplate('tpl.osd_notifications.js', true, true, 'Services/Notifications');
62
63 $osdTemplate->setVariable(
64 'OSD_INTERVAL',
65 $notificationSettings->get('osd_interval', (string) self::DEFAULT_POLLING_INTERVAL)
66 );
67 $osdTemplate->setVariable(
68 'OSD_PLAY_SOUND',
69 $notificationSettings->get('osd_play_sound') && $this->user->getPref('osd_play_sound') ? 'true' : 'false'
70 );
71
72 iljQueryUtil::initjQuery($this->page);
74
75 $this->page->addJavaScript('Services/Notifications/templates/default/notifications.js');
76 $this->page->addCSS('Services/Notifications/templates/default/osd.css');
77 $this->page->addOnLoadCode($osdTemplate->get());
78 }
79 }
80}
Provides fluid interface to RBAC services.
Definition: UIServices.php:24
__construct(ilGlobalTemplateInterface $page, ilLanguage $language)
language handling
User class.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static initMediaElementJs(ilGlobalTemplateInterface $a_tpl=null)
Init mediaelement.js scripts.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
special template class to simplify handling of ITX/PEAR
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static initjQuery(ilGlobalTemplateInterface $a_tpl=null)
inits and adds the jQuery JS-File to the global or a passed template
global $DIC
Definition: feed.php:28
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...