ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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 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.

References array.

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

◆ addHandler()

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

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

References $handler, and array.

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

◆ addLocatorItems()

ilNotificationGUI::addLocatorItems ( )

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

References $_GET, $ilCtrl, and object.

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

◆ executeCommand()

ilNotificationGUI::executeCommand ( )

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

References $ilCtrl.

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

◆ getAvailableChannels()

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

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

References ilNotificationDatabaseHandler\getAvailableChannels().

Referenced by showSettingsObject().

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

References ilNotificationDatabaseHandler\getAvailableTypes().

Referenced by showSettingsObject().

53  {
55  }
+ 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.

References $type.

48  {
49  return $this->handler[$type];
50  }
$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.

ilUser $ilUser

Returns
string

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

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

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

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

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

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

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

◆ saveSettingsObject()

ilNotificationGUI::saveSettingsObject ( )
private

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

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

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

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

Referenced by saveCustomizingOptionObject(), and saveSettingsObject().

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 
133  $userTypes = ilNotificationDatabaseHandler::loadUserConfig($ilUser->getId());
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  }
This class represents a property form user interface.
$tpl
Definition: ilias.php:10
This class represents a checkbox property in a property form.
getAvailableChannels($types=array())
global $ilCtrl
Definition: ilias.php:18
if(isset($_POST['submit'])) $form
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
if(empty($password)) $table
Definition: pwgen.php:24
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 17 of file class.ilNotificationGUI.php.

Referenced by addHandler().


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