ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
class.ilObjPersonalDesktopSettingsGUI.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
3include_once("./Services/Object/classes/class.ilObjectGUI.php");
4include_once('./Services/Calendar/classes/class.ilCalendarSettings.php');
5
17{
18 private static $ERROR_MESSAGE;
24 public function __construct($a_data, $a_id, $a_call_by_reference = true, $a_prepare_output = true)
25 {
26 global $lng;
27
28 $this->type = 'pdts';
29 parent::ilObjectGUI($a_data, $a_id, $a_call_by_reference, $a_prepare_output);
30
31 $lng->loadLanguageModule("pd");
32 }
33
40 public function executeCommand()
41 {
42 global $rbacsystem,$ilErr,$ilAccess;
43
44 $next_class = $this->ctrl->getNextClass($this);
45 $cmd = $this->ctrl->getCmd();
46
47 $this->prepareOutput();
48
49 if(!$ilAccess->checkAccess('read','',$this->object->getRefId()))
50 {
51 $ilErr->raiseError($this->lng->txt('no_permission'),$ilErr->WARNING);
52 }
53
54 switch($next_class)
55 {
56 case 'ilpermissiongui':
57 $this->tabs_gui->setTabActive('perm_settings');
58 include_once("Services/AccessControl/classes/class.ilPermissionGUI.php");
59 $perm_gui =& new ilPermissionGUI($this);
60 $ret =& $this->ctrl->forwardCommand($perm_gui);
61 break;
62
63 default:
64 if(!$cmd || $cmd == 'view')
65 {
66 $cmd = "editSettings";
67 }
68
69 $this->$cmd();
70 break;
71 }
72 return true;
73 }
74
81 public function getAdminTabs()
82 {
83 global $rbacsystem, $ilAccess;
84
85 if ($rbacsystem->checkAccess("visible,read",$this->object->getRefId()))
86 {
87 $this->tabs_gui->addTarget("pd_settings",
88 $this->ctrl->getLinkTarget($this, "editSettings"),
89 array("editSettings", "view"));
90
91 $this->tabs_gui->addTarget("pd_personal_workspace",
92 $this->ctrl->getLinkTarget($this, "editWsp"),
93 array("editWsp"));
94 }
95
96 if ($rbacsystem->checkAccess('edit_permission',$this->object->getRefId()))
97 {
98 $this->tabs_gui->addTarget("perm_settings",
99 $this->ctrl->getLinkTargetByClass('ilpermissiongui',"perm"),
100 array(),'ilpermissiongui');
101 }
102 }
103
107 public function editSettings()
108 {
109 global $ilCtrl, $lng, $ilSetting, $ilAccess;
110
111 $pd_set = new ilSetting("pd");
112
113 $enable_calendar = ilCalendarSettings::_getInstance()->isEnabled();
114 #$enable_calendar = $ilSetting->get("enable_calendar");
115 $enable_block_moving = $pd_set->get("enable_block_moving");
116 $enable_active_users = $ilSetting->get("block_activated_pdusers");
117
118 include_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
119 $form = new ilPropertyFormGUI();
120 $form->setFormAction($ilCtrl->getFormAction($this));
121 $form->setTitle($lng->txt("pd_settings"));
122
123 // Enable calendar
124 $cb_prop = new ilCheckboxInputGUI($lng->txt("enable_calendar"), "enable_calendar");
125 $cb_prop->setValue("1");
126 //$cb_prop->setInfo($lng->txt("pd_enable_block_moving_info"));
127 $cb_prop->setChecked($enable_calendar);
128 $form->addItem($cb_prop);
129
130 // Enable bookmarks
131 $cb_prop = new ilCheckboxInputGUI($lng->txt("pd_enable_bookmarks"), "enable_bookmarks");
132 $cb_prop->setValue("1");
133 $cb_prop->setChecked(($ilSetting->get("disable_bookmarks") ? "0" : "1"));
134 $form->addItem($cb_prop);
135
136 // Enable notes
137 $cb_prop = new ilCheckboxInputGUI($lng->txt("pd_enable_notes"), "enable_notes");
138 $cb_prop->setValue("1");
139 $cb_prop->setChecked(($ilSetting->get("disable_notes") ? "0" : "1"));
140 $form->addItem($cb_prop);
141
142 // Enable notes
143 $cb_prop = new ilCheckboxInputGUI($lng->txt("pd_enable_comments"), "enable_comments");
144 $cb_prop->setValue("1");
145 $cb_prop->setChecked(($ilSetting->get("disable_comments") ? "0" : "1"));
146 $form->addItem($cb_prop);
147
148 $comm_del_user = new ilCheckboxInputGUI($lng->txt("pd_enable_comments_del_user"), "comm_del_user");
149 $comm_del_user->setChecked($ilSetting->get("comments_del_user", 0));
150 $cb_prop->addSubItem($comm_del_user);
151
152 $comm_del_tutor = new ilCheckboxInputGUI($lng->txt("pd_enable_comments_del_tutor"), "comm_del_tutor");
153 $comm_del_tutor->setInfo($lng->txt("pd_enable_comments_del_tutor_info"));
154 $comm_del_tutor->setChecked($ilSetting->get("comments_del_tutor", 1));
155 $cb_prop->addSubItem($comm_del_tutor);
156
157 $ti = new ilTextInputGUI($this->lng->txt("pd_comments_notification"), "comments_noti_recip");
158 $ti->setValue($ilSetting->get("comments_noti_recip"));
159 $ti->setMaxLength(200);
160 $ti->setInfo($this->lng->txt("pd_comments_notification_info"));
161 $cb_prop->addSubItem($ti);
162
163 // Enable Chatviewer
164 $cb_prop = new ilCheckboxInputGUI($lng->txt("pd_enable_chatviewer"), "block_activated_chatviewer");
165 $cb_prop->setValue("1");
166 $cb_prop->setChecked(($ilSetting->get("block_activated_chatviewer")));
167 $form->addItem($cb_prop);
168
169 // Enable block moving
170 $cb_prop = new ilCheckboxInputGUI($lng->txt("pd_enable_block_moving"),
171 "enable_block_moving");
172 $cb_prop->setValue("1");
173 $cb_prop->setInfo($lng->txt("pd_enable_block_moving_info"));
174 $cb_prop->setChecked($enable_block_moving);
175 $form->addItem($cb_prop);
176
177 // Enable active users block
178/*
179 $cb_prop = new ilCheckboxInputGUI($lng->txt("pd_enable_active_users"),
180 "block_activated_pdusers");
181 $cb_prop->setValue("1");
182 $cb_prop->setChecked($enable_active_users);
183
184 // maximum inactivity time
185 $ti_prop = new ilNumberInputGUI($lng->txt("pd_time_before_removal"),
186 "time_removal");
187 $ti_prop->setValue($pd_set->get("user_activity_time"));
188 $ti_prop->setInfo($lng->txt("pd_time_before_removal_info"));
189 $ti_prop->setMaxLength(3);
190 $ti_prop->setSize(3);
191 $cb_prop->addSubItem($ti_prop);
192
193 // osi host
194 // see http://www.onlinestatus.org
195 $ti_prop = new ilTextInputGUI($lng->txt("pd_osi_host"),
196 "osi_host");
197 $ti_prop->setValue($pd_set->get("osi_host"));
198 $ti_prop->setInfo($lng->txt("pd_osi_host_info").
199 ' <a href="http://www.onlinestatus.org" target="_blank">http://www.onlinestatus.org</a>');
200 $cb_prop->addSubItem($ti_prop);
201
202 $form->addItem($cb_prop);
203*/
204 // Enable 'My Offers' (default personal items)
205 $cb_prop = new ilCheckboxInputGUI($lng->txt('pd_enable_my_offers'), 'enable_my_offers');
206 $cb_prop->setValue('1');
207 $cb_prop->setInfo($lng->txt('pd_enable_my_offers_info'));
208 $cb_prop->setChecked(($ilSetting->get('disable_my_offers') ? '0' : '1'));
209 $form->addItem($cb_prop);
210
211 // Enable 'My Memberships'
212 $cb_prop = new ilCheckboxInputGUI($lng->txt('pd_enable_my_memberships'), 'enable_my_memberships');
213 $cb_prop->setValue('1');
214 $cb_prop->setInfo($lng->txt('pd_enable_my_memberships_info'));
215 $cb_prop->setChecked(($ilSetting->get('disable_my_memberships') ? '0' : '1'));
216 $form->addItem($cb_prop);
217
218 if($ilSetting->get('disable_my_offers') == 0 &&
219 $ilSetting->get('disable_my_memberships') == 0)
220 {
221 // Default view of personal items
222 $sb_prop = new ilSelectInputGUI($lng->txt('pd_personal_items_default_view'), 'personal_items_default_view');
223 $sb_prop->setInfo($lng->txt('pd_personal_items_default_view_info'));
224 $option = array();
225 $option[0] = $lng->txt('pd_my_offers');
226 $option[1] = $lng->txt('my_courses_groups');
227 $sb_prop->setOptions($option);
228 $sb_prop->setValue((int)$ilSetting->get('personal_items_default_view'));
229 $form->addItem($sb_prop);
230 }
231
232 if($ilAccess->checkAccess('write','',$this->object->getRefId()))
233 {
234 // command buttons
235 $form->addCommandButton("saveSettings", $lng->txt("save"));
236 $form->addCommandButton("view", $lng->txt("cancel"));
237 }
238
239 $this->tpl->setContent($form->getHTML());
240 }
241
245 public function saveSettings()
246 {
247 global $ilCtrl, $ilSetting, $ilAccess;
248
249 if(!$ilAccess->checkAccess('write','',$this->object->getRefId()))
250 {
251 $ilCtrl->redirect($this, "view");
252 }
253
254 $pd_set = new ilSetting("pd");
255
256 ilCalendarSettings::_getInstance()->setEnabled( $_POST["enable_calendar"]);
258
259 #$ilSetting->set("enable_calendar", $_POST["enable_calendar"]);
260 $ilSetting->set("disable_bookmarks", (int) ($_POST["enable_bookmarks"] ? 0 : 1));
261
262 $ilSetting->set("disable_notes", (int) ($_POST["enable_notes"] ? 0 : 1));
263 $ilSetting->set("disable_comments", (int) ($_POST["enable_comments"] ? 0 : 1));
264
265 $ilSetting->set("comments_del_user", (int) ($_POST["comm_del_user"] ? 1 : 0));
266 $ilSetting->set("comments_del_tutor", (int) ($_POST["comm_del_tutor"] ? 1 : 0));
267 $ilSetting->set("comments_noti_recip", ilUtil::stripSlashes($_POST["comments_noti_recip"]));
268
269 $ilSetting->set("block_activated_chatviewer", (int) ($_POST["block_activated_chatviewer"]));
270
271// $ilSetting->set("block_activated_pdusers", $_POST["block_activated_pdusers"]);
272 $pd_set->set("enable_block_moving", $_POST["enable_block_moving"]);
273// $pd_set->set("user_activity_time", (int) $_POST["time_removal"]);
274// $pd_set->set("osi_host", $_POST["osi_host"]);
275
276 // Validate personal desktop view
277 if(!(int)$_POST['enable_my_offers'] && !(int)$_POST['enable_my_memberships'])
278 {
279 ilUtil::sendFailure($this->lng->txt('pd_view_select_at_least_one'), true);
280 $ilCtrl->redirect($this, 'view');
281 }
282
283 // Enable 'My Offers' (default personal items)
284 $ilSetting->set('disable_my_offers', (int)($_POST['enable_my_offers'] ? 0 : 1));
285
286 // Enable 'My Memberships'
287 $ilSetting->set('disable_my_memberships', (int)($_POST['enable_my_memberships'] ? 0 : 1));
288
289 if((int)$_POST['enable_my_offers'] && !(int)$_POST['enable_my_memberships'])
290 $_POST['personal_items_default_view'] = 0;
291 else if(!(int)$_POST['enable_my_offers'] && (int)$_POST['enable_my_memberships'])
292 $_POST['personal_items_default_view'] = 1;
293 else if(!isset($_POST['personal_items_default_view']))
294 $_POST['personal_items_default_view'] = $ilSetting->get('personal_items_default_view');
295
296 // Default view of personal items
297 $ilSetting->set('personal_items_default_view', (int)$_POST['personal_items_default_view']);
298
299 ilUtil::sendSuccess($this->lng->txt("settings_saved"), true);
300 $ilCtrl->redirect($this, "view");
301 }
302
306 public function editWsp()
307 {
308 global $ilCtrl, $lng, $ilSetting, $ilAccess;
309
310 include_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
311 $form = new ilPropertyFormGUI();
312 $form->setFormAction($ilCtrl->getFormAction($this, "saveWsp"));
313 $form->setTitle($lng->txt("pd_personal_workspace"));
314
315 // Enable 'Personal Workspace'
316 $wsp_prop = new ilCheckboxInputGUI($lng->txt('pd_enable_personal_workspace'), 'wsp');
317 $wsp_prop->setValue('1');
318 $wsp_prop->setChecked(($ilSetting->get('disable_personal_workspace') ? '0' : '1'));
319 $form->addItem($wsp_prop);
320
321 // Enable 'Blogs'
322 $blog_prop = new ilCheckboxInputGUI($lng->txt('pd_enable_wsp_blogs'), 'blog');
323 $blog_prop->setValue('1');
324 $blog_prop->setChecked(($ilSetting->get('disable_wsp_blogs') ? '0' : '1'));
325 $wsp_prop->addSubItem($blog_prop);
326
327 // Enable 'Files'
328 $file_prop = new ilCheckboxInputGUI($lng->txt('pd_enable_wsp_files'), 'file');
329 $file_prop->setValue('1');
330 $file_prop->setChecked(($ilSetting->get('disable_wsp_files') ? '0' : '1'));
331 $wsp_prop->addSubItem($file_prop);
332
333 // Enable 'Certificates'
334 $cert_prop = new ilCheckboxInputGUI($lng->txt('pd_enable_wsp_certificates'), 'cert');
335 $cert_prop->setValue('1');
336 $cert_prop->setChecked(($ilSetting->get('disable_wsp_certificates') ? '0' : '1'));
337 $wsp_prop->addSubItem($cert_prop);
338
339 // Enable 'Links'
340 $link_prop = new ilCheckboxInputGUI($lng->txt('pd_enable_wsp_links'), 'link');
341 $link_prop->setValue('1');
342 $link_prop->setChecked(($ilSetting->get('disable_wsp_links') ? '0' : '1'));
343 $wsp_prop->addSubItem($link_prop);
344
345 /*
346 // Enable 'Portfolios'
347 $lng->loadLanguageModule('user');
348 $prtf_prop = new ilCheckboxInputGUI($lng->txt('pd_enable_prtf'), 'prtf');
349 $prtf_prop->setValue('1');
350 $prtf_prop->setInfo($lng->txt('user_portfolios_desc'));
351 $prtf_prop->setChecked(($ilSetting->get('user_portfolios') ? '1' : '0'));
352 $form->addItem($prtf_prop);
353 */
354
355 // Load the disk quota settings object
356 require_once 'Services/WebDAV/classes/class.ilObjDiskQuotaSettings.php';
357 $disk_quota_obj = ilObjDiskQuotaSettings::getInstance();
358
359 // Enable disk quota
360 $lng->loadLanguageModule("file");
361 $cb_prop = new ilCheckboxInputGUI($lng->txt("personal_workspace_disk_quota"), "enable_personal_workspace_disk_quota");
362 $cb_prop->setValue('1');
363 $cb_prop->setChecked($disk_quota_obj->isPersonalWorkspaceDiskQuotaEnabled());
364 $cb_prop->setInfo($lng->txt('enable_personal_workspace_disk_quota_info'));
365 $form->addItem($cb_prop);
366
367 require_once 'Services/Administration/classes/class.ilAdministrationSettingsFormHandler.php';
370 $form,
371 $this
372 );
373
374 if($ilAccess->checkAccess('write','',$this->object->getRefId()))
375 {
376 // command buttons
377 $form->addCommandButton("saveWsp", $lng->txt("save"));
378 $form->addCommandButton("editWsp", $lng->txt("cancel"));
379 }
380
381 $this->tpl->setContent($form->getHTML());
382 }
383
387 public function saveWsp()
388 {
389 global $ilCtrl, $ilSetting, $ilAccess;
390
391 if(!$ilAccess->checkAccess('write','',$this->object->getRefId()))
392 {
393 $ilCtrl->redirect($this, "view");
394 }
395
396 // without personal workspace we have to disable to sub-items
397 if(!$_POST["wsp"])
398 {
399 $_POST["blog"] = 0;
400 $_POST["file"] = 0;
401 $_POST["cert"] = 0;
402 $_POST["link"] = 0;
403 }
404
405 $ilSetting->set('disable_personal_workspace', (int)($_POST['wsp'] ? 0 : 1));
406 $ilSetting->set('disable_wsp_blogs', (int)($_POST['blog'] ? 0 : 1));
407 $ilSetting->set('disable_wsp_files', (int)($_POST['file'] ? 0 : 1));
408 $ilSetting->set('disable_wsp_certificates', (int)($_POST['cert'] ? 0 : 1));
409 $ilSetting->set('disable_wsp_links', (int)($_POST['link'] ? 0 : 1));
410 // $ilSetting->set('user_portfolios', (int)($_POST['prtf'] ? 1 : 0));
411
412 // Load the disk quota settings object
413 require_once 'Services/WebDAV/classes/class.ilObjDiskQuotaSettings.php';
414 $disk_quota_obj = ilObjDiskQuotaSettings::getInstance();
415 $disk_quota_obj->setPersonalWorkspaceDiskQuotaEnabled($_POST['enable_personal_workspace_disk_quota'] == '1');
416 $disk_quota_obj->update();
417
418 ilUtil::sendSuccess($this->lng->txt("settings_saved"), true);
419 $ilCtrl->redirect($this, "editWsp");
420 }
421
422 public function addToExternalSettingsForm($a_form_id)
423 {
424 switch($a_form_id)
425 {
427
428 require_once 'Services/WebDAV/classes/class.ilObjDiskQuotaSettings.php';
429 $disk_quota_obj = ilObjDiskQuotaSettings::getInstance();
430
431 $fields = array('personal_workspace_disk_quota' => array($disk_quota_obj->isPersonalWorkspaceDiskQuotaEnabled(), ilAdministrationSettingsFormHandler::VALUE_BOOL));
432
433 return array(array("editWsp", $fields));
434 }
435 }
436}
437
438?>
static addFieldsToForm($a_form_id, ilPropertyFormGUI $a_form, ilObjectGUI $a_parent_gui)
static _getInstance()
get singleton instance
This class represents a checkbox property in a property form.
static getInstance()
Get settings instance.
__construct($a_data, $a_id, $a_call_by_reference=true, $a_prepare_output=true)
Contructor.
Class ilObjectGUI Basic methods of all Output classes.
prepareOutput()
prepare output
New PermissionGUI (extends from old ilPermission2GUI) RBAC related output.
This class represents a property form user interface.
This class represents a selection list property in a property form.
ILIAS Setting Class.
This class represents a text property in a property form.
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
$_POST['username']
Definition: cron.php:12
global $ilCtrl
Definition: ilias.php:18
global $ilSetting
Definition: privfeed.php:40
$cmd
Definition: sahs_server.php:35