ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
class.ilObjNotificationAdminGUI.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2010 ILIAS open source, Extended GPL, see docs/LICENSE */
3
4require_once "./Services/Object/classes/class.ilObjectGUI.php";
5require_once "./Services/Notifications/classes/class.ilObjNotificationAdmin.php";
6require_once "./Services/Notifications/classes/class.ilObjNotificationAdminAccess.php";
7
20{
25 function __construct($a_data,$a_id,$a_call_by_reference = true, $a_prepare_output = true) {
26 $this->type = "nota";
27 $this->ilObjectGUI($a_data,$a_id,$a_call_by_reference, false);
28 $this->lng->loadLanguageModule('notification');
29 }
30
31 function _forwards()
32 {
33 return array();
34 }
35
36 function executeCommand()
37 {
38 global $ilAccess, $ilNavigationHistory, $ilCtrl, $ilUser, $ilTabs;
39
40 $next_class = $this->ctrl->getNextClass($this);
41 $cmd = $this->ctrl->getCmd();
42
43 $this->prepareOutput();
44
45 switch ($next_class)
46 {
47 case 'ilpermissiongui':
48 //$ilTabs->activateTab("id_permissions");
49 include_once("Services/AccessControl/classes/class.ilPermissionGUI.php");
50 $perm_gui =& new ilPermissionGUI($this);
51 $ret =& $this->ctrl->forwardCommand($perm_gui);
52 break;
53
54 default:
55 $this->__initSubTabs();
56 $ilTabs->activateTab("view");
57
58 if (empty($cmd) || $cmd == 'view') {
59 $cmd = 'showTypes';
60 }
61
62 $cmd .= "Object";
63 $this->$cmd();
64 break;
65 }
66 }
67
73 static function saveObject2($params = array()) {
74 global $objDefinition, $ilUser;
75
76 // create and insert file in grp_tree
77 require_once 'Services/Notifications/classes/class.ilObjNotificationAdmin.php';
78 $fileObj = new ilObjNotificationAdmin();
79 $fileObj->setTitle('notification admin');
80 $fileObj->create();
81 $fileObj->createReference();
82 $fileObj->putInTree(SYSTEM_FOLDER_ID);
83 //$fileObj->setPermissions($params['ref_id']);
84 // upload file to filesystem
85 }
86
87 function setTabs() {
88 global $ilAccess, $ilTabs, $lng;
89
90 $this->ctrl->setParameter($this,"ref_id",$this->ref_id);
91
92 if ($ilAccess->checkAccess("visible", "", $this->ref_id))
93 {
94 $ilTabs->addTab("id_info",
95 $lng->txt("info_short"),
96 $this->ctrl->getLinkTargetByClass(array("ilobjfilegui", "ilinfoscreengui"), "showSummary"));
97 }
98
99 if ($ilAccess->checkAccess("edit_permission", "", $this->ref_id))
100 {
101 $ilTabs->addTab("id_permissions",
102 $lng->txt("perm_settings"),
103 $this->ctrl->getLinkTargetByClass(array(get_class($this),'ilpermissiongui'), "perm"));
104 }
105 }
106
107 // init sub tabs
108 function __initSubTabs() {
109 global $ilTabs, $ilSetting, $ilCtrl;
110
111 $ilTabs->addSubTabTarget("notification_general", $this->ctrl->getLinkTargetByClass('ilObjNotificationAdminGUI', "showGeneralSettings"));
112 //$ilTabs->addSubTabTarget("notification_admin_channels", $this->ctrl->getLinkTargetByClass('ilObjNotificationAdminGUI', "showChannels"));
113 $ilTabs->addSubTabTarget("notification_admin_types", $this->ctrl->getLinkTargetByClass('ilObjNotificationAdminGUI', "showTypes"));
114 $ilTabs->addSubTabTarget("notification_admin_matrix", $this->ctrl->getLinkTargetByClass('ilObjNotificationAdminGUI', "showConfigMatrix"));
115 }
116
118 {
119 global $ilLocator;
120
121 if (is_object($this->object)) {
122 $ilLocator->addItem($this->object->getTitle(), $this->ctrl->getLinkTarget($this, ""), "", $_GET["ref_id"]);
123 }
124 }
125
126 function showGeneralSettingsObject($form = null) {
127 require_once 'Services/Notifications/classes/class.ilNotificationAdminSettingsForm.php';
128
129 if ($form == null) {
131 $settings = new ilSetting('notifications');
132
139 $form->setValuesByArray(array_merge($settings->getAll(), $form->restored_values));
140 }
141
142 $form->setFormAction($this->ctrl->getFormAction($this, 'saveGeneralSettings'));
143 $form->addCommandButton('saveGeneralSettings', 'save');
144 $form->addCommandButton('showGeneralSettings', 'cancel');
145
146 $this->tpl->setContent($form->getHtml());
147 }
148
150 require_once 'Services/Notifications/classes/class.ilNotificationAdminSettingsForm.php';
151 #require_once 'Services/Administration/classes/class.ilSetting.php';
152
153 $settings = new ilSetting('notifications');
154
156 $form->setValuesByPost();
157 if (!$form->checkInput()) {
158 $this->showGeneralSettingsObject($form);
159 }
160 else {
167 $values = $form->store_values;//array('enable_osd', 'osd_polling_intervall', 'enable_mail');
168
169 // handle custom channel settings
170 foreach($values as $v) {
171 $settings->set($v, $_POST[$v]);
172 }
173
174 foreach($_REQUEST['notifications'] as $type => $value) {
176 }
177
179 }
180
181 }
182
183 public function showTypesObject() {
184 global $ilTabs;
185
186 $ilTabs->activateSubTab('notification_admin_types');
187
188 require_once 'Services/Notifications/classes/class.ilNotificationDatabaseHelper.php';
189 require_once 'Services/Notifications/classes/class.ilNotificationAdminSettingsForm.php';
190
192 $form->setFormAction($this->ctrl->getFormAction($this, 'showTypes'));
193 $form->addCommandButton('saveTypes', $this->lng->txt('save'));
194 $form->addCommandButton('showTypes', $this->lng->txt('cancel'));
195 $this->tpl->setContent($form->getHtml());
196
197 }
198
199 public function showChannelsObject() {
200 global $ilTabs;
201
202 $ilTabs->activateSubTab('notification_admin_channels');
203
204 require_once 'Services/Notifications/classes/class.ilNotificationDatabaseHelper.php';
205 require_once 'Services/Notifications/classes/class.ilNotificationAdminSettingsForm.php';
206
208 $form->setFormAction($this->ctrl->getFormAction($this, 'showChannels'));
209 $form->addCommandButton('saveChannels', $this->lng->txt('save'));
210 $form->addCommandButton('showChannels', $this->lng->txt('cancel'));
211 $this->tpl->setContent($form->getHtml());
212
213 }
214
215 public function saveTypesObject() {
216 require_once 'Services/Notifications/classes/class.ilNotificationDatabaseHelper.php';
217 foreach($_REQUEST['notifications'] as $type => $value) {
219 }
220 $this->showTypesObject();
221 }
222
223 public function saveChannelsObject() {
224 require_once 'Services/Notifications/classes/class.ilNotificationDatabaseHelper.php';
225 foreach($_REQUEST['notifications'] as $type => $value) {
227 }
228 $this->showChannelsObject();
229 }
230
231 public function showConfigMatrixObject() {
232 global $ilTabs;
233
234 $ilTabs->activateSubTab('notification_admin_matrix');
235
236 require_once 'Services/Notifications/classes/class.ilNotificationDatabaseHelper.php';
237 require_once 'Services/Notifications/classes/class.ilNotificationSettingsTable.php';
238
239 global $ilCtrl, $lng;
240
242
243 $table = new ilNotificationSettingsTable($this, 'a title', ilNotificationDatabaseHandler::getAvailableChannels(), $userdata, true);
244 $table->setFormAction($ilCtrl->getFormAction($this, 'saveConfigMatrix'));
246 $table->setDescription($lng->txt('notification_admin_matrix_settings_table_desc'));
247 $table->addCommandButton('saveConfigMatrix', $lng->txt('save'));
248 $table->addCommandButton('showConfigMatrix', $lng->txt('cancel'));
249
250 $this->tpl->setContent($table->getHtml());
251 }
252
253 private function saveConfigMatrixObject() {
254 global $ilUser, $ilCtrl;
255 require_once 'Services/Notifications/classes/class.ilNotificationDatabaseHelper.php';
256
257 ilNotificationDatabaseHandler::setUserConfig(-1, $_REQUEST['notification'] ? $_REQUEST['notification'] : array());
258 $this->showConfigMatrixObject();
259 }
260} // END class.ilObjFileGUI
261?>
$_GET["client_id"]
static getAvailableChannels($config_types=array(), $includeDisabled=false)
static setConfigTypeForType($type_name, $config_name)
static setUserConfig($userid, array $configArray)
Sets the configuration for all given configurations.
static setConfigTypeForChannel($channel_name, $config_name)
GUI class for notification objects.
static saveObject2($params=array())
save object
__construct($a_data, $a_id, $a_call_by_reference=true, $a_prepare_output=true)
Constructor @access public.
setTabs()
set admin tabs @access public
addLocatorItems()
should be overwritten to add object specific items (repository items are preloaded)
Class ilObjNotificationAdmin.
Class ilObjectGUI Basic methods of all Output classes.
ilObjectGUI($a_data, $a_id=0, $a_call_by_reference=true, $a_prepare_output=true)
Constructor @access public.
prepareOutput()
prepare output
New PermissionGUI (extends from old ilPermission2GUI) RBAC related output.
ILIAS Setting Class.
$_POST['username']
Definition: cron.php:12
$params
Definition: example_049.php:96
global $ilCtrl
Definition: ilias.php:18
global $ilSetting
Definition: privfeed.php:40
$cmd
Definition: sahs_server.php:35
if($_REQUEST['ilias_path']) define('ILIAS_HTTP_PATH' $_REQUEST['ilias_path']
Definition: index.php:7
global $ilUser
Definition: imgupload.php:15