ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ilNotificationGUI Class Reference
+ Collaboration diagram for ilNotificationGUI:

Public Member Functions

 __construct ()
 Constructor @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()
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilNotificationGUI::__construct ( )

Constructor @access public.

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

24 {
25 $this->type = "not";
26
27 require_once 'Services/Notifications/classes/class.ilNotificationSetupHelper.php';
28 }

Member Function Documentation

◆ _forwards()

static ilNotificationGUI::_forwards ( )
static

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

31 {
32 return array();
33 }

◆ addHandler()

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

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

105 {
106 if (!array_key_exists($channel, $this->handler) || !is_array($this->handler[$channel])) {
107 $this->handler[$channel] = array();
108 }
109
110 $this->handler[$channel][] = $handler;
111 }

References $handler.

◆ addLocatorItems()

ilNotificationGUI::addLocatorItems ( )

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

174 {
175 global $ilLocator, $ilCtrl;
176
177 if (is_object($this->object)) {
178 $ilLocator->addItem($this->object->getTitle(), $ilCtrl->getLinkTarget($this, ''), '', $_GET["ref_id"]);
179 }
180 }
$_GET["client_id"]
global $ilCtrl
Definition: ilias.php:18

References $_GET, and $ilCtrl.

◆ executeCommand()

ilNotificationGUI::executeCommand ( )

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

36 {
37 global $ilCtrl;
38
39 if (!$ilCtrl->getCmd()) {
40 return;
41 }
42
43 $cmd = $ilCtrl->getCmd() . 'Object';
44 $this->$cmd();
45 }

References $ilCtrl.

◆ getAvailableChannels()

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

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

58 {
60 }
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 52 of file class.ilNotificationGUI.php.

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 47 of file class.ilNotificationGUI.php.

48 {
49 return $this->handler[$type];
50 }
$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 69 of file class.ilNotificationGUI.php.

70 {
71 global $ilUser;
72
74
75 if ($ilUser->getId() == ANONYMOUS_USER_ID) {
76 return '{}';
77 }
78
79 require_once 'Services/Notifications/classes/class.ilNotificationEchoHandler.php';
80 require_once 'Services/Notifications/classes/class.ilNotificationOSDHandler.php';
81
82 $notifications = ilNotificationOSDHandler::getNotificationsForUser($ilUser->getId(), true, (int) $_REQUEST['max_age']);
83 $result = new stdClass();
84 $result->notifications = $notifications;
85 $result->server_time = time();
86 echo json_encode($result);
87 exit;
88 }
$result
static getNotificationsForUser($user_id, $append_osd_id_to_link=true, $max_age_seconds=0)
static enableWebAccessWithoutSession($enable_web_access_without_session)
$ilUser
Definition: imgupload.php:18

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

+ Here is the call graph for this function:

◆ removeOSDNotificationsObject()

ilNotificationGUI::removeOSDNotificationsObject ( )

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

91 {
92 global $ilUser;
93
95
96 require_once 'Services/Notifications/classes/class.ilNotificationEchoHandler.php';
97 require_once 'Services/Notifications/classes/class.ilNotificationOSDHandler.php';
98
99 ilNotificationOSDHandler::removeNotification($_REQUEST['notification_id']);
100
101 exit;
102 }
static removeNotification($notification_osd_id)
Removes a notifcation and triggers a follow up notification to remove the notification from the brows...

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

+ Here is the call graph for this function:

◆ saveCustomizingOptionObject()

ilNotificationGUI::saveCustomizingOptionObject ( )
private

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

114 {
115 global $ilUser;
116
117 if ($_POST['enable_custom_notification_configuration']) {
118 $ilUser->writePref('use_custom_notification_setting', 1);
119 } else {
120 $ilUser->writePref('use_custom_notification_setting', 0);
121 }
122
123 $this->showSettingsObject();
124 }
$_POST["username"]

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

+ Here is the call graph for this function:

◆ saveSettingsObject()

ilNotificationGUI::saveSettingsObject ( )
private

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

165 {
166 global $ilUser, $ilCtrl;
167 require_once 'Services/Notifications/classes/class.ilNotificationDatabaseHelper.php';
168
169 ilNotificationDatabaseHandler::setUserConfig($ilUser->getId(), $_REQUEST['notification'] ? $_REQUEST['notification'] : array());
170 $this->showSettingsObject();
171 }
static setUserConfig($userid, array $configArray)
Sets the configuration for all given configurations.

References $ilCtrl, $ilUser, ilNotificationDatabaseHandler\setUserConfig(), and showSettingsObject().

+ Here is the call graph for this function:

◆ showSettingsObject()

ilNotificationGUI::showSettingsObject ( )

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

127 {
128 global $tpl, $ilCtrl, $ilUser, $lng;
129
130 require_once 'Services/Notifications/classes/class.ilNotificationSettingsTable.php';
131 require_once 'Services/Notifications/classes/class.ilNotificationDatabaseHelper.php';
132
134
135 $lng->loadLanguageModule('notification');
136
137 require_once 'Services/Form/classes/class.ilPropertyFormGUI.php';
138 $form = new ilPropertyFormGUI();
139 $chk = new ilCheckboxInputGUI($lng->txt('enable_custom_notification_configuration'), 'enable_custom_notification_configuration');
140 $chk->setValue('1');
141 $chk->setChecked($ilUser->getPref('use_custom_notification_setting') == 1);
142 $form->addItem($chk);
143
144 $form->setFormAction($ilCtrl->getFormAction($this, 'showSettingsObject'));
145 $form->addCommandButton('saveCustomizingOption', $lng->txt('save'));
146 $form->addCommandButton('showSettings', $lng->txt('cancel'));
147
148 $table = new ilNotificationSettingsTable($this, 'a title', $this->getAvailableChannels(array('set_by_user')), $userTypes);
149
150 $table->setFormAction($ilCtrl->getFormAction($this, 'saveSettings'));
151 $table->setData($this->getAvailableTypes(array('set_by_user')));
152
153 if ($ilUser->getPref('use_custom_notification_setting') == 1) {
154 $table->addCommandButton('saveSettings', $lng->txt('save'));
155 $table->addCommandButton('showSettings', $lng->txt('cancel'));
156 $table->setEditable(true);
157 } else {
158 $table->setEditable(false);
159 }
160
161 $tpl->setContent($form->getHtml() . $table->getHTML());
162 }
$tpl
Definition: ilias.php:10
This class represents a checkbox property in a property form.
getAvailableTypes($types=array())
getAvailableChannels($types=array())
This class represents a property form user interface.
global $lng
Definition: privfeed.php:17
if(empty($password)) $table
Definition: pwgen.php:24
if(isset($_POST['submit'])) $form

References $form, $ilCtrl, $ilUser, $lng, $table, $tpl, getAvailableChannels(), getAvailableTypes(), and ilNotificationDatabaseHandler\loadUserConfig().

Referenced by saveCustomizingOptionObject(), and saveSettingsObject().

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

Field Documentation

◆ $handler

ilNotificationGUI::$handler = array()
private

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

Referenced by addHandler().


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