ILIAS  release_4-4 Revision
All Data Structures Namespaces Files Functions Variables Modules Pages
ilNotificationGUI Class Reference
+ Collaboration diagram for ilNotificationGUI:

Public Member Functions

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

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

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

Member Function Documentation

◆ _forwards()

ilNotificationGUI::_forwards ( )

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

32  {
33  return array();
34  }

◆ addHandler()

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

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

References $handler.

101  {
102  if (!array_key_exists($channel, $this->handler) || !is_array($this->handler[$channel]))
103  $this->handler[$channel] = array();
104 
105  $this->handler[$channel][] = $handler;
106  }

◆ addLocatorItems()

ilNotificationGUI::addLocatorItems ( )

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

References $_GET, and $ilCtrl.

168  {
169  global $ilLocator, $ilCtrl;
170 
171  if (is_object($this->object)) {
172  $ilLocator->addItem($this->object->getTitle(), $ilCtrl->getLinkTarget($this, ''), '', $_GET["ref_id"]);
173  }
174  }
$_GET["client_id"]
global $ilCtrl
Definition: ilias.php:18

◆ executeCommand()

ilNotificationGUI::executeCommand ( )

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

References $cmd, and $ilCtrl.

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

◆ getAvailableChannels()

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

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

References ilNotificationDatabaseHandler\getAvailableChannels().

Referenced by showSettingsObject().

55  {
57  }
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 51 of file class.ilNotificationGUI.php.

References ilNotificationDatabaseHandler\getAvailableTypes().

Referenced by showSettingsObject().

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

47  {
48  return $this->handler[$type];
49  }

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

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

68  {
69  global $ilUser;
70 
71  if ($ilUser->getId() == ANONYMOUS_USER_ID) {
72  return '{}';
73  }
74 
75  $GLOBALS['WEB_ACCESS_WITHOUT_SESSION'] = true;
76 
77  require_once 'Services/Notifications/classes/class.ilNotificationEchoHandler.php';
78  require_once 'Services/Notifications/classes/class.ilNotificationOSDHandler.php';
79 
80  $notifications = ilNotificationOSDHandler::getNotificationsForUser($ilUser->getId(), true, (int)$_REQUEST['max_age']);
81  $result = new stdClass();
82  $result->notifications = $notifications;
83  $result->server_time = time();
84  echo json_encode($result);
85  exit;
86  }
exit
Definition: login.php:54
$result
$GLOBALS['ct_recipient']
static getNotificationsForUser($user_id, $append_osd_id_to_link=true, $max_age_seconds=0)
global $ilUser
Definition: imgupload.php:15
if($_REQUEST['ilias_path']) define('ILIAS_HTTP_PATH' $_REQUEST['ilias_path']
Definition: index.php:7
+ Here is the call graph for this function:

◆ removeOSDNotificationsObject()

ilNotificationGUI::removeOSDNotificationsObject ( )

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

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

88  {
89  global $ilUser;
90 
91  $GLOBALS['WEB_ACCESS_WITHOUT_SESSION'] = true;
92 
93  require_once 'Services/Notifications/classes/class.ilNotificationEchoHandler.php';
94  require_once 'Services/Notifications/classes/class.ilNotificationOSDHandler.php';
95 
97 
98  exit;
99  }
static removeNotification($notification_osd_id)
Removes a notifcation and triggers a follow up notification to remove the notification from the brows...
exit
Definition: login.php:54
$GLOBALS['ct_recipient']
global $ilUser
Definition: imgupload.php:15
if($_REQUEST['ilias_path']) define('ILIAS_HTTP_PATH' $_REQUEST['ilias_path']
Definition: index.php:7
+ Here is the call graph for this function:

◆ saveCustomizingOptionObject()

ilNotificationGUI::saveCustomizingOptionObject ( )
private

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

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

108  {
109  global $ilUser;
110 
111  if ($_POST['enable_custom_notification_configuration']) {
112  $ilUser->writePref('use_custom_notification_setting', 1);
113  }
114  else {
115  $ilUser->writePref('use_custom_notification_setting', 0);
116  }
117 
118 
119  $this->showSettingsObject();
120  }
$_POST['username']
Definition: cron.php:12
global $ilUser
Definition: imgupload.php:15
+ Here is the call graph for this function:

◆ saveSettingsObject()

ilNotificationGUI::saveSettingsObject ( )
private

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

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

160  {
161  global $ilUser, $ilCtrl;
162  require_once 'Services/Notifications/classes/class.ilNotificationDatabaseHelper.php';
163 
164  ilNotificationDatabaseHandler::setUserConfig($ilUser->getId(), $_REQUEST['notification'] ? $_REQUEST['notification'] : array());
165  $this->showSettingsObject();
166  }
global $ilCtrl
Definition: ilias.php:18
global $ilUser
Definition: imgupload.php:15
static setUserConfig($userid, array $configArray)
Sets the configuration for all given configurations.
if($_REQUEST['ilias_path']) define('ILIAS_HTTP_PATH' $_REQUEST['ilias_path']
Definition: index.php:7
+ Here is the call graph for this function:

◆ showSettingsObject()

ilNotificationGUI::showSettingsObject ( )

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

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

Referenced by saveCustomizingOptionObject(), and saveSettingsObject().

122  {
123  global $tpl, $ilCtrl, $ilUser, $lng;
124 
125  require_once 'Services/Notifications/classes/class.ilNotificationSettingsTable.php';
126  require_once 'Services/Notifications/classes/class.ilNotificationDatabaseHelper.php';
127 
128  $userTypes = ilNotificationDatabaseHandler::loadUserConfig($ilUser->getId());
129 
130  $lng->loadLanguageModule('notification');
131 
132  require_once 'Services/Form/classes/class.ilPropertyFormGUI.php';
133  $form = new ilPropertyFormGUI();
134  $chk = new ilCheckboxInputGUI($lng->txt('enable_custom_notification_configuration'), 'enable_custom_notification_configuration');
135  $chk->setValue('1');
136  $chk->setChecked($ilUser->getPref('use_custom_notification_setting') == 1);
137  $form->addItem($chk);
138 
139  $form->setFormAction($ilCtrl->getFormAction($this, 'showSettingsObject'));
140  $form->addCommandButton('saveCustomizingOption', $lng->txt('save'));
141  $form->addCommandButton('showSettings', $lng->txt('cancel'));
142 
143  $table = new ilNotificationSettingsTable($this, 'a title', $this->getAvailableChannels(array('set_by_user')), $userTypes);
144 
145  $table->setFormAction($ilCtrl->getFormAction($this, 'saveSettings'));
146  $table->setData($this->getAvailableTypes(array('set_by_user')));
147 
148  if ($ilUser->getPref('use_custom_notification_setting') == 1) {
149  $table->addCommandButton('saveSettings', $lng->txt('save'));
150  $table->addCommandButton('showSettings', $lng->txt('cancel'));
151  $table->setEditable(true);
152  }
153  else {
154  $table->setEditable(false);
155  }
156 
157  $tpl->setContent($form->getHtml() . $table->getHTML());
158  }
This class represents a property form user interface.
This class represents a checkbox property in a property form.
getAvailableChannels($types=array())
global $ilCtrl
Definition: ilias.php:18
setValue($a_value)
Set Value.
if(isset($_FILES['img_file']['size']) && $_FILES['img_file']['size'] > 0) $tpl
global $ilUser
Definition: imgupload.php:15
global $lng
Definition: privfeed.php:40
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 20 of file class.ilNotificationGUI.php.

Referenced by addHandler().


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