ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
ilNotificationOSDGUI Class Reference

Class ilNotificationOSDGUI. More...

+ Collaboration diagram for ilNotificationOSDGUI:

Public Member Functions

 __construct (\ilGlobalTemplateInterface $page, \ilLanguage $language)
 ilNotificationOSDGUI constructor. More...
 
 populatePage ()
 

Protected Attributes

 $user
 
 $page
 
 $lng
 

Private Attributes

 $ui
 

Detailed Description

Class ilNotificationOSDGUI.

Definition at line 6 of file class.ilNotificationOSDGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilNotificationOSDGUI::__construct ( \ilGlobalTemplateInterface  $page,
\ilLanguage  $language 
)

ilNotificationOSDGUI constructor.

Parameters
ilGlobalTemplateInterface$page
ilLanguage$language

Definition at line 22 of file class.ilNotificationOSDGUI.php.

23 {
24 global $DIC;
25
26 $this->user = $DIC->user();
27 $this->page = $page;
28 $this->lng = $language;
29 $this->ui = $DIC->ui();
30 }
user()
Definition: user.php:4
ui()
Definition: ui.php:5
$DIC
Definition: xapitoken.php:46

References $DIC, $page, ui(), and user().

+ Here is the call graph for this function:

Member Function Documentation

◆ populatePage()

ilNotificationOSDGUI::populatePage ( )

Definition at line 35 of file class.ilNotificationOSDGUI.php.

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
46 $notifications = \ilNotificationOSDHandler::getNotificationsForUser($this->user->getId());
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
61 iljQueryUtil::initjQuery($this->page);
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

References ilNotificationOSDHandler\getNotificationsForUser(), iljQueryUtil\initjQuery(), ilPlayerUtil\initMediaElementJs(), ui(), and user().

+ Here is the call graph for this function:

Field Documentation

◆ $lng

ilNotificationOSDGUI::$lng
protected

Definition at line 13 of file class.ilNotificationOSDGUI.php.

◆ $page

ilNotificationOSDGUI::$page
protected

Definition at line 11 of file class.ilNotificationOSDGUI.php.

Referenced by __construct().

◆ $ui

ilNotificationOSDGUI::$ui
private

Definition at line 15 of file class.ilNotificationOSDGUI.php.

◆ $user

ilNotificationOSDGUI::$user
protected

Definition at line 9 of file class.ilNotificationOSDGUI.php.


The documentation for this class was generated from the following file: