ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
ilNotificationGUI Class Reference
+ Collaboration diagram for ilNotificationGUI:

Public Member Functions

 __construct ()
 Constructor @access public. More...
 
 _forwards ()
 
 executeCommand ()
 
 getHandler ($type)
 
 getOSDNotificationsObject ()
 Returns the pending on screen notifications for a user request. More...
 
 removeOSDNotificationsObject ()
 
 addHandler ($channel, ilNotificationHandler $handler)
 
 showSettingsObject ()
 
 addLocatorItems ()
 

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

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

Member Function Documentation

◆ _forwards()

ilNotificationGUI::_forwards ( )

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

32 {
33 return array();
34 }

◆ addHandler()

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

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

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

References $handler.

◆ addLocatorItems()

ilNotificationGUI::addLocatorItems ( )

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

181 {
182 global $ilLocator, $ilCtrl;
183
184 if(is_object($this->object))
185 {
186 $ilLocator->addItem($this->object->getTitle(), $ilCtrl->getLinkTarget($this, ''), '', $_GET["ref_id"]);
187 }
188 }
$_GET["client_id"]
global $ilCtrl
Definition: ilias.php:18

References $_GET, and $ilCtrl.

◆ executeCommand()

ilNotificationGUI::executeCommand ( )

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

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

References $cmd, and $ilCtrl.

◆ getAvailableChannels()

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

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

59 {
61 }
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 53 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 48 of file class.ilNotificationGUI.php.

49 {
50 return $this->handler[$type];
51 }

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

71 {
72 global $ilUser;
73
75
76 if($ilUser->getId() == ANONYMOUS_USER_ID)
77 {
78 return '{}';
79 }
80
81 require_once 'Services/Notifications/classes/class.ilNotificationEchoHandler.php';
82 require_once 'Services/Notifications/classes/class.ilNotificationOSDHandler.php';
83
84 $notifications = ilNotificationOSDHandler::getNotificationsForUser($ilUser->getId(), true, (int)$_REQUEST['max_age']);
85 $result = new stdClass();
86 $result->notifications = $notifications;
87 $result->server_time = time();
88 echo json_encode($result);
89 exit;
90 }
$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:54
if($_REQUEST['ilias_path']) define('ILIAS_HTTP_PATH' $_REQUEST['ilias_path']
Definition: index.php:7
global $ilUser
Definition: imgupload.php:15

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

+ Here is the call graph for this function:

◆ removeOSDNotificationsObject()

ilNotificationGUI::removeOSDNotificationsObject ( )

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

93 {
94 global $ilUser;
95
97
98 require_once 'Services/Notifications/classes/class.ilNotificationEchoHandler.php';
99 require_once 'Services/Notifications/classes/class.ilNotificationOSDHandler.php';
100
102
103 exit;
104 }
static removeNotification($notification_osd_id)
Removes a notifcation and triggers a follow up notification to remove the notification from the brows...

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

+ Here is the call graph for this function:

◆ saveCustomizingOptionObject()

ilNotificationGUI::saveCustomizingOptionObject ( )
private

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

115 {
116 global $ilUser;
117
118 if($_POST['enable_custom_notification_configuration'])
119 {
120 $ilUser->writePref('use_custom_notification_setting', 1);
121 }
122 else
123 {
124 $ilUser->writePref('use_custom_notification_setting', 0);
125 }
126
127 $this->showSettingsObject();
128 }
$_POST['username']
Definition: cron.php:12

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

+ Here is the call graph for this function:

◆ saveSettingsObject()

ilNotificationGUI::saveSettingsObject ( )
private

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

172 {
173 global $ilUser, $ilCtrl;
174 require_once 'Services/Notifications/classes/class.ilNotificationDatabaseHelper.php';
175
176 ilNotificationDatabaseHandler::setUserConfig($ilUser->getId(), $_REQUEST['notification'] ? $_REQUEST['notification'] : array());
177 $this->showSettingsObject();
178 }
static setUserConfig($userid, array $configArray)
Sets the configuration for all given configurations.

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

+ Here is the call graph for this function:

◆ showSettingsObject()

ilNotificationGUI::showSettingsObject ( )

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

131 {
132 global $tpl, $ilCtrl, $ilUser, $lng;
133
134 require_once 'Services/Notifications/classes/class.ilNotificationSettingsTable.php';
135 require_once 'Services/Notifications/classes/class.ilNotificationDatabaseHelper.php';
136
138
139 $lng->loadLanguageModule('notification');
140
141 require_once 'Services/Form/classes/class.ilPropertyFormGUI.php';
142 $form = new ilPropertyFormGUI();
143 $chk = new ilCheckboxInputGUI($lng->txt('enable_custom_notification_configuration'), 'enable_custom_notification_configuration');
144 $chk->setValue('1');
145 $chk->setChecked($ilUser->getPref('use_custom_notification_setting') == 1);
146 $form->addItem($chk);
147
148 $form->setFormAction($ilCtrl->getFormAction($this, 'showSettingsObject'));
149 $form->addCommandButton('saveCustomizingOption', $lng->txt('save'));
150 $form->addCommandButton('showSettings', $lng->txt('cancel'));
151
152 $table = new ilNotificationSettingsTable($this, 'a title', $this->getAvailableChannels(array('set_by_user')), $userTypes);
153
154 $table->setFormAction($ilCtrl->getFormAction($this, 'saveSettings'));
155 $table->setData($this->getAvailableTypes(array('set_by_user')));
156
157 if($ilUser->getPref('use_custom_notification_setting') == 1)
158 {
159 $table->addCommandButton('saveSettings', $lng->txt('save'));
160 $table->addCommandButton('showSettings', $lng->txt('cancel'));
161 $table->setEditable(true);
162 }
163 else
164 {
165 $table->setEditable(false);
166 }
167
168 $tpl->setContent($form->getHtml() . $table->getHTML());
169 }
global $tpl
Definition: ilias.php:8
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:40

References $ilCtrl, $ilUser, $lng, $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 18 of file class.ilNotificationGUI.php.

Referenced by addHandler().


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