ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
ilNotificationGUI Class Reference
+ Collaboration diagram for ilNotificationGUI:

Public Member Functions

 __construct (\ilUser $user=null, \ilTemplate $template=null, \ilCtrl $controller=null, \ilLanguage $language=null, \ilLocatorGUI $locatorGUI=null, \ILIAS\DI\Container $dic=null)
 @access public More...
 
 executeCommand ()
 
 getHandler ($type)
 
 getOSDNotificationsObject ()
 Returns the pending on screen notifications for a user request. More...
 
 removeOSDNotificationsObject ()
 
 addHandler ($channel, ilNotificationHandler $handler)
 
 showSettingsObject ()
 
 addLocatorItems ()
 

Static Public Member Functions

static _forwards ()
 

Private Member Functions

 getAvailableTypes ($types=array())
 
 getAvailableChannels ($types=array())
 
 saveCustomizingOptionObject ()
 
 saveSettingsObject ()
 

Private Attributes

 $handler = array()
 
 $user
 
 $template
 
 $controller
 
 $language
 
 $locatorGUI
 

Detailed Description

Author
Jan Posselt jposs.nosp@m.elt@.nosp@m.datab.nosp@m.ay.d.nosp@m.e.de
Version
$Id$ @ilCtrl_Calls ilNotificationGUI: @ilCtrl_IsCalledBy ilNotificationGUI: ilPersonalProfileGUI, ilDashboardGUI

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

Constructor & Destructor Documentation

◆ __construct()

ilNotificationGUI::__construct ( \ilUser  $user = null,
\ilTemplate  $template = null,
\ilCtrl  $controller = null,
\ilLanguage  $language = null,
\ilLocatorGUI  $locatorGUI = null,
\ILIAS\DI\Container  $dic = null 
)

@access public

Parameters
ilUser | null$user
ilTemplate | null$template
ilCtrl | null$controller
ilLanguage | null$language
ilLocatorGUI | null$locatorGUI
\ILIAS\DI\Container | null$dic

Definition at line 43 of file class.ilNotificationGUI.php.

50 {
51 if ($dic === null) {
52 global $DIC;
53 $dic = $DIC;
54 }
55
56 if ($user === null) {
57 $user = $dic->user();
58 }
59 $this->user = $user;
60
61 if ($template === null) {
62 $template = $dic->ui()->mainTemplate();
63 }
64 $this->template = $template;
65
66 if ($controller === null) {
67 $controller = $dic->ctrl();
68 }
69 $this->controller = $controller;
70
71 if ($language === null) {
72 $language = $dic->language();
73 }
74 $this->language = $language;
75
76 if ($locatorGUI === null) {
77 $locatorGUI = $dic['ilLocator'];
78 }
79 $this->locatorGUI = $locatorGUI;
80
81 $this->type = "not";
82
83 require_once 'Services/Notifications/classes/class.ilNotificationSetupHelper.php';
84 }
user()
Definition: user.php:4
language()
Definition: language.php:2
$dic
Definition: result.php:13
$DIC
Definition: xapitoken.php:46

References $controller, $DIC, $dic, $language, $locatorGUI, $template, $user, language(), and user().

+ Here is the call graph for this function:

Member Function Documentation

◆ _forwards()

static ilNotificationGUI::_forwards ( )
static

Definition at line 86 of file class.ilNotificationGUI.php.

87 {
88 return array();
89 }

◆ addHandler()

ilNotificationGUI::addHandler (   $channel,
ilNotificationHandler  $handler 
)

Definition at line 159 of file class.ilNotificationGUI.php.

160 {
161 if (!array_key_exists($channel, $this->handler) || !is_array($this->handler[$channel])) {
162 $this->handler[$channel] = array();
163 }
164
165 $this->handler[$channel][] = $handler;
166 }

References $handler.

◆ addLocatorItems()

ilNotificationGUI::addLocatorItems ( )

Definition at line 215 of file class.ilNotificationGUI.php.

216 {
217 if (is_object($this->object)) {
218 $this->locatorGUI->addItem(
219 $this->object->getTitle(),
220 $this->controller->getLinkTarget($this, ''),
221 '',
222 $_GET["ref_id"]
223 );
224 }
225 }
$_GET["client_id"]

References $_GET.

◆ executeCommand()

ilNotificationGUI::executeCommand ( )

Definition at line 91 of file class.ilNotificationGUI.php.

92 {
93 if (!$this->controller->getCmd()) {
94 return;
95 }
96
97 $cmd = $this->controller->getCmd() . 'Object';
98 $this->$cmd();
99 }

◆ getAvailableChannels()

ilNotificationGUI::getAvailableChannels (   $types = array())
private

Definition at line 111 of file class.ilNotificationGUI.php.

112 {
114 }
static getAvailableChannels($config_types=array(), $includeDisabled=false)

References ilNotificationDatabaseHandler\getAvailableChannels().

Referenced by showSettingsObject().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getAvailableTypes()

ilNotificationGUI::getAvailableTypes (   $types = array())
private

Definition at line 106 of file class.ilNotificationGUI.php.

107 {
109 }

References ilNotificationDatabaseHandler\getAvailableTypes().

Referenced by showSettingsObject().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getHandler()

ilNotificationGUI::getHandler (   $type)

Definition at line 101 of file class.ilNotificationGUI.php.

102 {
103 return $this->handler[$type];
104 }
$type

References $type.

◆ getOSDNotificationsObject()

ilNotificationGUI::getOSDNotificationsObject ( )

Returns the pending on screen notifications for a user request.

Todo:
this method should move to a better place as it handels channel sprecific things. @global ilUser $ilUser
Returns
string

Definition at line 123 of file class.ilNotificationGUI.php.

124 {
126
127 if ($this->user->getId() == ANONYMOUS_USER_ID) {
128 return '{}';
129 }
130
131 require_once 'Services/Notifications/classes/class.ilNotificationEchoHandler.php';
132 require_once 'Services/Notifications/classes/class.ilNotificationOSDHandler.php';
133
135 $this->user->getId(),
136 true,
137 (int) $_REQUEST['max_age']
138 );
139
140 $result = new stdClass();
141 $result->notifications = $notifications;
142 $result->server_time = time();
143 echo json_encode($result);
144 exit;
145 }
$result
static getNotificationsForUser($user_id, $append_osd_id_to_link=true, $max_age_seconds=0)
static enableWebAccessWithoutSession($enable_web_access_without_session)
exit
Definition: login.php:29

References $result, ilSession\enableWebAccessWithoutSession(), exit, ilNotificationOSDHandler\getNotificationsForUser(), and user().

+ Here is the call graph for this function:

◆ removeOSDNotificationsObject()

ilNotificationGUI::removeOSDNotificationsObject ( )

Definition at line 147 of file class.ilNotificationGUI.php.

148 {
150
151 require_once 'Services/Notifications/classes/class.ilNotificationEchoHandler.php';
152 require_once 'Services/Notifications/classes/class.ilNotificationOSDHandler.php';
153
154 ilNotificationOSDHandler::removeNotification($_REQUEST['notification_id']);
155
156 exit;
157 }
static removeNotification($notification_osd_id)
Removes a notifcation and triggers a follow up notification to remove the notification from the brows...

References ilSession\enableWebAccessWithoutSession(), exit, and ilNotificationOSDHandler\removeNotification().

+ Here is the call graph for this function:

◆ saveCustomizingOptionObject()

ilNotificationGUI::saveCustomizingOptionObject ( )
private

Definition at line 168 of file class.ilNotificationGUI.php.

169 {
170 if ($_POST['enable_custom_notification_configuration']) {
171 $this->user->writePref('use_custom_notification_setting', 1);
172 } else {
173 $this->user->writePref('use_custom_notification_setting', 0);
174 }
175
176 $this->showSettingsObject();
177 }
$_POST["username"]

References $_POST, showSettingsObject(), and user().

+ Here is the call graph for this function:

◆ saveSettingsObject()

ilNotificationGUI::saveSettingsObject ( )
private

Definition at line 227 of file class.ilNotificationGUI.php.

228 {
229 require_once 'Services/Notifications/classes/class.ilNotificationDatabaseHelper.php';
230
232 $this->user->getId(),
233 $_REQUEST['notification'] ? $_REQUEST['notification'] : array()
234 );
235
236 $this->showSettingsObject();
237 }
static setUserConfig($userid, array $configArray)
Sets the configuration for all given configurations.

References ilNotificationDatabaseHandler\setUserConfig(), showSettingsObject(), and user().

+ Here is the call graph for this function:

◆ showSettingsObject()

ilNotificationGUI::showSettingsObject ( )

Definition at line 179 of file class.ilNotificationGUI.php.

180 {
181 require_once 'Services/Notifications/classes/class.ilNotificationSettingsTable.php';
182 require_once 'Services/Notifications/classes/class.ilNotificationDatabaseHelper.php';
183
184 $userTypes = ilNotificationDatabaseHandler::loadUserConfig($this->user->getId());
185
186 $this->language->loadLanguageModule('notification');
187
188 require_once 'Services/Form/classes/class.ilPropertyFormGUI.php';
189 $form = new ilPropertyFormGUI();
190 $chk = new ilCheckboxInputGUI($this->language->txt('enable_custom_notification_configuration'), 'enable_custom_notification_configuration');
191 $chk->setValue('1');
192 $chk->setChecked($this->user->getPref('use_custom_notification_setting') == 1);
193 $form->addItem($chk);
194
195 $form->setFormAction($this->controller->getFormAction($this, 'showSettingsObject'));
196 $form->addCommandButton('saveCustomizingOption', $this->language->txt('save'));
197 $form->addCommandButton('showSettings', $this->language->txt('cancel'));
198
199 $table = new ilNotificationSettingsTable($this, 'a title', $this->getAvailableChannels(array('set_by_user')), $userTypes);
200
201 $table->setFormAction($this->controller->getFormAction($this, 'saveSettings'));
202 $table->setData($this->getAvailableTypes(array('set_by_user')));
203
204 if ($this->user->getPref('use_custom_notification_setting') == 1) {
205 $table->addCommandButton('saveSettings', $this->language->txt('save'));
206 $table->addCommandButton('showSettings', $this->language->txt('cancel'));
207 $table->setEditable(true);
208 } else {
209 $table->setEditable(false);
210 }
211
212 $this->template->setContent($form->getHtml() . $table->getHTML());
213 }
This class represents a checkbox property in a property form.
getAvailableTypes($types=array())
getAvailableChannels($types=array())
This class represents a property form user interface.

References getAvailableChannels(), getAvailableTypes(), language(), ilNotificationDatabaseHandler\loadUserConfig(), and user().

Referenced by saveCustomizingOptionObject(), and saveSettingsObject().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $controller

ilNotificationGUI::$controller
private

Definition at line 26 of file class.ilNotificationGUI.php.

Referenced by __construct().

◆ $handler

ilNotificationGUI::$handler = array()
private

Definition at line 17 of file class.ilNotificationGUI.php.

Referenced by addHandler().

◆ $language

ilNotificationGUI::$language
private

Definition at line 29 of file class.ilNotificationGUI.php.

Referenced by __construct().

◆ $locatorGUI

ilNotificationGUI::$locatorGUI
private

Definition at line 32 of file class.ilNotificationGUI.php.

Referenced by __construct().

◆ $template

ilNotificationGUI::$template
private

Definition at line 23 of file class.ilNotificationGUI.php.

Referenced by __construct().

◆ $user

ilNotificationGUI::$user
private

Definition at line 20 of file class.ilNotificationGUI.php.

Referenced by __construct().


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