ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
ilNotificationGUI Class Reference
+ Collaboration diagram for ilNotificationGUI:

Public Member Functions

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

static ilNotificationGUI::_forwards ( )
static

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

References array.

32  {
33  return array();
34  }
Create styles array
The data for the language used.

◆ addHandler()

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

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

References $handler, and array.

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  }
Create styles array
The data for the language used.

◆ addLocatorItems()

ilNotificationGUI::addLocatorItems ( )

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

References $_GET, $ilCtrl, and object.

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
Create new PHPExcel object
obj_idprivate

◆ executeCommand()

ilNotificationGUI::executeCommand ( )

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

References $cmd, and $ilCtrl.

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
global $ilCtrl
Definition: ilias.php:18

◆ getAvailableChannels()

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

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

References ilNotificationDatabaseHandler\getAvailableChannels().

Referenced by showSettingsObject().

59  {
61  }
static getAvailableChannels($config_types=array(), $includeDisabled=false)
+ 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().

54  {
56  }
+ 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.

ilUser $ilUser

Returns
string

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

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

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  }
static enableWebAccessWithoutSession($enable_web_access_without_session)
$result
$ilUser
Definition: imgupload.php:18
static getNotificationsForUser($user_id, $append_osd_id_to_link=true, $max_age_seconds=0)
Add data(end) time
Method that wraps PHPs time in order to allow simulations with the workflow.
+ Here is the call graph for this function:

◆ removeOSDNotificationsObject()

ilNotificationGUI::removeOSDNotificationsObject ( )

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

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

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 
101  ilNotificationOSDHandler::removeNotification($_REQUEST['notification_id']);
102 
103  exit;
104  }
static enableWebAccessWithoutSession($enable_web_access_without_session)
static removeNotification($notification_osd_id)
Removes a notifcation and triggers a follow up notification to remove the notification from the brows...
$ilUser
Definition: imgupload.php:18
+ Here is the call graph for this function:

◆ saveCustomizingOptionObject()

ilNotificationGUI::saveCustomizingOptionObject ( )
private

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

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

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  }
$ilUser
Definition: imgupload.php:18
$_POST["username"]
+ Here is the call graph for this function:

◆ saveSettingsObject()

ilNotificationGUI::saveSettingsObject ( )
private

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

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

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  }
global $ilCtrl
Definition: ilias.php:18
$ilUser
Definition: imgupload.php:18
Create styles array
The data for the language used.
static setUserConfig($userid, array $configArray)
Sets the configuration for all given configurations.
+ Here is the call graph for this function:

◆ showSettingsObject()

ilNotificationGUI::showSettingsObject ( )

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

References $ilCtrl, $ilUser, $lng, $tpl, array, getAvailableChannels(), getAvailableTypes(), ilNotificationDatabaseHandler\loadUserConfig(), and ilCheckboxInputGUI\setValue().

Referenced by saveCustomizingOptionObject(), and saveSettingsObject().

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 
137  $userTypes = ilNotificationDatabaseHandler::loadUserConfig($ilUser->getId());
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  }
This class represents a property form user interface.
This class represents a checkbox property in a property form.
getAvailableChannels($types=array())
global $tpl
Definition: ilias.php:8
global $ilCtrl
Definition: ilias.php:18
setValue($a_value)
Set Value.
$ilUser
Definition: imgupload.php:18
Create styles array
The data for the language used.
global $lng
Definition: privfeed.php:17
getAvailableTypes($types=array())
+ 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: