ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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 public function __construct($a_data, $a_id = 0, $a_call_by_reference = true, $a_prepare_output = true)
26 {
27 $this->type = "nota";
28 parent::__construct($a_data, $a_id, $a_call_by_reference, false);
29 $this->lng->loadLanguageModule('notification');
30 }
31
32 public static function _forwards()
33 {
34 return array();
35 }
36
37 public function executeCommand()
38 {
39 $next_class = $this->ctrl->getNextClass($this);
40 $cmd = $this->ctrl->getCmd();
41
42 $this->prepareOutput();
43
44 switch ($next_class) {
45 case 'ilpermissiongui':
46 include_once("Services/AccessControl/classes/class.ilPermissionGUI.php");
47 $perm_gui = new ilPermissionGUI($this);
48 $ret = &$this->ctrl->forwardCommand($perm_gui);
49 break;
50
51 default:
52 $this->__initSubTabs();
53 $this->tabs_gui->activateTab("view");
54
55 if (empty($cmd) || $cmd == 'view') {
56 $cmd = 'showTypes';
57 }
58
59 $cmd .= "Object";
60 $this->$cmd();
61 break;
62 }
63 }
64
70 public static function saveObject2($params = array())
71 {
72 global $objDefinition, $ilUser;
73
74 // create and insert file in grp_tree
75 require_once 'Services/Notifications/classes/class.ilObjNotificationAdmin.php';
76 $fileObj = new ilObjNotificationAdmin();
77 $fileObj->setTitle('notification admin');
78 $fileObj->create();
79 $fileObj->createReference();
80 $fileObj->putInTree(SYSTEM_FOLDER_ID);
81 //$fileObj->setPermissions($params['ref_id']);
82 // upload file to filesystem
83 }
84
85 public function setTabs()
86 {
87 $this->ctrl->setParameter($this, "ref_id", $this->ref_id);
88
89 if ($this->access->checkAccess("visible", "", $this->ref_id)) {
90 $this->ilTabs->addTab(
91 "id_info",
92 $this->lng->txt("info_short"),
93 $this->ctrl->getLinkTargetByClass(array("ilobjfilegui", "ilinfoscreengui"), "showSummary")
94 );
95 }
96
97 if ($this->access->checkAccess("edit_permission", "", $this->ref_id)) {
98 $this->tabs_gui->addTab(
99 "id_permissions",
100 $this->lng->txt("perm_settings"),
101 $this->ctrl->getLinkTargetByClass(array(get_class($this),'ilpermissiongui'), "perm")
102 );
103 }
104 }
105
106 // init sub tabs
107 public function __initSubTabs()
108 {
109 $this->tabs_gui->addSubTabTarget(
110 "notification_general",
111 $this->ctrl->getLinkTargetByClass('ilObjNotificationAdminGUI', "showGeneralSettings")
112 );
113
114 $this->tabs_gui->addSubTabTarget(
115 "notification_admin_types",
116 $this->ctrl->getLinkTargetByClass('ilObjNotificationAdminGUI', "showTypes")
117 );
118
119 $this->tabs_gui->addSubTabTarget(
120 "notification_admin_matrix",
121 $this->ctrl->getLinkTargetByClass('ilObjNotificationAdminGUI', "showConfigMatrix")
122 );
123 }
124
125 public function addLocatorItems()
126 {
127 if (is_object($this->object)) {
128 $this->locator->addItem($this->object->getTitle(), $this->ctrl->getLinkTarget($this, ""), "", $_GET["ref_id"]);
129 }
130 }
131
132 public function showGeneralSettingsObject($form = null)
133 {
134 require_once 'Services/Notifications/classes/class.ilNotificationAdminSettingsForm.php';
135
136 if ($form == null) {
138 $settings = new ilSetting('notifications');
139
146 $form->setValuesByArray(array_merge($settings->getAll(), $form->restored_values));
147 }
148
149 $form->setFormAction($this->ctrl->getFormAction($this, 'saveGeneralSettings'));
150 $form->addCommandButton('saveGeneralSettings', 'save');
151 $form->addCommandButton('showGeneralSettings', 'cancel');
152
153 $this->tpl->setContent($form->getHtml());
154 }
155
157 {
158 require_once 'Services/Notifications/classes/class.ilNotificationAdminSettingsForm.php';
159
160 $settings = new ilSetting('notifications');
161
163 $form->setValuesByPost();
164 if (!$form->checkInput()) {
166 } else {
173 $values = $form->store_values;//array('enable_osd', 'osd_polling_intervall', 'enable_mail');
174
175 // handle custom channel settings
176 foreach ($values as $v) {
177 $settings->set($v, $_POST[$v]);
178 }
179
180 foreach ($_REQUEST['notifications'] as $type => $value) {
182 }
183
185 }
186 }
187
188 public function showTypesObject()
189 {
190 $this->tabs_gui->activateSubTab('notification_admin_types');
191
192 require_once 'Services/Notifications/classes/class.ilNotificationDatabaseHelper.php';
193 require_once 'Services/Notifications/classes/class.ilNotificationAdminSettingsForm.php';
194
196 $form->setFormAction($this->ctrl->getFormAction($this, 'showTypes'));
197 $form->addCommandButton('saveTypes', $this->lng->txt('save'));
198 $form->addCommandButton('showTypes', $this->lng->txt('cancel'));
199 $this->tpl->setContent($form->getHtml());
200 }
201
202 public function showChannelsObject()
203 {
204 $this->tabs_gui->activateSubTab('notification_admin_channels');
205
206 require_once 'Services/Notifications/classes/class.ilNotificationDatabaseHelper.php';
207 require_once 'Services/Notifications/classes/class.ilNotificationAdminSettingsForm.php';
208
210 $form->setFormAction($this->ctrl->getFormAction($this, 'showChannels'));
211 $form->addCommandButton('saveChannels', $this->lng->txt('save'));
212 $form->addCommandButton('showChannels', $this->lng->txt('cancel'));
213 $this->tpl->setContent($form->getHtml());
214 }
215
216 public function saveTypesObject()
217 {
218 require_once 'Services/Notifications/classes/class.ilNotificationDatabaseHelper.php';
219 foreach ($_REQUEST['notifications'] as $type => $value) {
221 }
222 $this->showTypesObject();
223 }
224
225 public function saveChannelsObject()
226 {
227 require_once 'Services/Notifications/classes/class.ilNotificationDatabaseHelper.php';
228 foreach ($_REQUEST['notifications'] as $type => $value) {
230 }
231 $this->showChannelsObject();
232 }
233
234 public function showConfigMatrixObject()
235 {
236 $this->tabs_gui->activateSubTab('notification_admin_matrix');
237
238 require_once 'Services/Notifications/classes/class.ilNotificationDatabaseHelper.php';
239 require_once 'Services/Notifications/classes/class.ilNotificationSettingsTable.php';
240
242
244 $table->setFormAction($this->ctrl->getFormAction($this, 'saveConfigMatrix'));
246 $table->setDescription($this->lng->txt('notification_admin_matrix_settings_table_desc'));
247 $table->addCommandButton('saveConfigMatrix', $this->lng->txt('save'));
248 $table->addCommandButton('showConfigMatrix', $this->lng->txt('cancel'));
249
250 $this->tpl->setContent($table->getHtml());
251 }
252
253 private function saveConfigMatrixObject()
254 {
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
$_GET["client_id"]
$_POST["username"]
An exception for terminatinating execution or to throw for unit testing.
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
setTabs()
set admin tabs @access public
addLocatorItems()
should be overwritten to add object specific items (repository items are preloaded)
__construct($a_data, $a_id=0, $a_call_by_reference=true, $a_prepare_output=true)
Constructor @access public.
Class ilObjNotificationAdmin.
Class ilObjectGUI Basic methods of all Output classes.
prepareOutput($a_show_subobjects=true)
prepare output
New PermissionGUI (extends from old ilPermission2GUI) RBAC related output.
ILIAS Setting Class.
$ret
Definition: parser.php:6
$type
if(empty($password)) $table
Definition: pwgen.php:24
if(isset($_POST['submit'])) $form
$values
$ilUser
Definition: imgupload.php:18