ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f870
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;
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 contacts
137 $cb_prop = new ilCheckboxInputGUI($lng->txt("pd_enable_contacts"), "enable_contacts");
138 $cb_prop->setValue("1");
139 $cb_prop->setChecked(($ilSetting->get("disable_contacts") ? "0" : "1"));
140
141 $cb_prop_requires_mail = new ilCheckboxInputGUI($lng->txt('pd_enable_contacts_requires_mail'), 'enable_contacts_require_mail');
142 $cb_prop_requires_mail->setValue("1");
143 $cb_prop_requires_mail->setChecked(($ilSetting->get("disable_contacts_require_mail") ? "0" : "1"));
144 $cb_prop->addSubItem($cb_prop_requires_mail);
145
146 $form->addItem($cb_prop);
147
148 // Enable notes
149 $cb_prop = new ilCheckboxInputGUI($lng->txt("pd_enable_notes"), "enable_notes");
150 $cb_prop->setValue("1");
151 $cb_prop->setChecked(($ilSetting->get("disable_notes") ? "0" : "1"));
152 $form->addItem($cb_prop);
153
154 // Enable notes
155 $cb_prop = new ilCheckboxInputGUI($lng->txt("pd_enable_comments"), "enable_comments");
156 $cb_prop->setValue("1");
157 $cb_prop->setChecked(($ilSetting->get("disable_comments") ? "0" : "1"));
158 $form->addItem($cb_prop);
159
160 $comm_del_user = new ilCheckboxInputGUI($lng->txt("pd_enable_comments_del_user"), "comm_del_user");
161 $comm_del_user->setChecked($ilSetting->get("comments_del_user", 0));
162 $cb_prop->addSubItem($comm_del_user);
163
164 $comm_del_tutor = new ilCheckboxInputGUI($lng->txt("pd_enable_comments_del_tutor"), "comm_del_tutor");
165 $comm_del_tutor->setChecked($ilSetting->get("comments_del_tutor", 1));
166 $cb_prop->addSubItem($comm_del_tutor);
167
168 // Enable Chatviewer
169 $cb_prop = new ilCheckboxInputGUI($lng->txt("pd_enable_chatviewer"), "block_activated_chatviewer");
170 $cb_prop->setValue("1");
171 $cb_prop->setChecked(($ilSetting->get("block_activated_chatviewer")));
172 $form->addItem($cb_prop);
173
174 // Enable block moving
175 $cb_prop = new ilCheckboxInputGUI($lng->txt("pd_enable_block_moving"),
176 "enable_block_moving");
177 $cb_prop->setValue("1");
178 $cb_prop->setInfo($lng->txt("pd_enable_block_moving_info"));
179 $cb_prop->setChecked($enable_block_moving);
180 $form->addItem($cb_prop);
181
182 // Enable active users block
183 $cb_prop = new ilCheckboxInputGUI($lng->txt("pd_enable_active_users"),
184 "block_activated_pdusers");
185 $cb_prop->setValue("1");
186 $cb_prop->setChecked($enable_active_users);
187
188 // maximum inactivity time
189 $ti_prop = new ilNumberInputGUI($lng->txt("pd_time_before_removal"),
190 "time_removal");
191 $ti_prop->setValue($pd_set->get("user_activity_time"));
192 $ti_prop->setInfo($lng->txt("pd_time_before_removal_info"));
193 $ti_prop->setMaxLength(3);
194 $ti_prop->setSize(3);
195 $cb_prop->addSubItem($ti_prop);
196
197 // osi host
198 // see http://www.onlinestatus.org
199 $ti_prop = new ilTextInputGUI($lng->txt("pd_osi_host"),
200 "osi_host");
201 $ti_prop->setValue($pd_set->get("osi_host"));
202 $ti_prop->setInfo($lng->txt("pd_osi_host_info").
203 ' <a href="http://www.onlinestatus.org" target="_blank">http://www.onlinestatus.org</a>');
204 $cb_prop->addSubItem($ti_prop);
205
206 $form->addItem($cb_prop);
207
208 // Enable 'My Offers' (default personal items)
209 $cb_prop = new ilCheckboxInputGUI($lng->txt('pd_enable_my_offers'), 'enable_my_offers');
210 $cb_prop->setValue('1');
211 $cb_prop->setInfo($lng->txt('pd_enable_my_offers_info'));
212 $cb_prop->setChecked(($ilSetting->get('disable_my_offers') ? '0' : '1'));
213 $form->addItem($cb_prop);
214
215 // Enable 'My Memberships'
216 $cb_prop = new ilCheckboxInputGUI($lng->txt('pd_enable_my_memberships'), 'enable_my_memberships');
217 $cb_prop->setValue('1');
218 $cb_prop->setInfo($lng->txt('pd_enable_my_memberships_info'));
219 $cb_prop->setChecked(($ilSetting->get('disable_my_memberships') ? '0' : '1'));
220 $form->addItem($cb_prop);
221
222 if($ilSetting->get('disable_my_offers') == 0 &&
223 $ilSetting->get('disable_my_memberships') == 0)
224 {
225 // Default view of personal items
226 $sb_prop = new ilSelectInputGUI($lng->txt('pd_personal_items_default_view'), 'personal_items_default_view');
227 $sb_prop->setInfo($lng->txt('pd_personal_items_default_view_info'));
228 $option = array();
229 $option[0] = $lng->txt('pd_my_offers');
230 $option[1] = $lng->txt('my_courses_groups');
231 $sb_prop->setOptions($option);
232 $sb_prop->setValue((int)$ilSetting->get('personal_items_default_view'));
233 $form->addItem($sb_prop);
234 }
235
236 // command buttons
237 $form->addCommandButton("saveSettings", $lng->txt("save"));
238 $form->addCommandButton("view", $lng->txt("cancel"));
239
240 $this->tpl->setContent($form->getHTML());
241 }
242
246 public function saveSettings()
247 {
248 global $ilCtrl, $ilSetting;
249
250 $pd_set = new ilSetting("pd");
251
252 ilCalendarSettings::_getInstance()->setEnabled( $_POST["enable_calendar"]);
254
255 #$ilSetting->set("enable_calendar", $_POST["enable_calendar"]);
256 $ilSetting->set("disable_bookmarks", (int) ($_POST["enable_bookmarks"] ? 0 : 1));
257
258 $ilSetting->set("disable_contacts", (int) ($_POST["enable_contacts"] ? 0 : 1));
259 $ilSetting->set("disable_contacts_require_mail", (int) ($_POST["enable_contacts_require_mail"] ? 0 : 1));
260
261 $ilSetting->set("disable_notes", (int) ($_POST["enable_notes"] ? 0 : 1));
262 $ilSetting->set("disable_comments", (int) ($_POST["enable_comments"] ? 0 : 1));
263
264 $ilSetting->set("comments_del_user", (int) ($_POST["comm_del_user"] ? 1 : 0));
265 $ilSetting->set("comments_del_tutor", (int) ($_POST["comm_del_tutor"] ? 1 : 0));
266
267 $ilSetting->set("block_activated_chatviewer", (int) ($_POST["block_activated_chatviewer"]));
268
269 $ilSetting->set("block_activated_pdusers", $_POST["block_activated_pdusers"]);
270 $pd_set->set("enable_block_moving", $_POST["enable_block_moving"]);
271 $pd_set->set("user_activity_time", (int) $_POST["time_removal"]);
272 $pd_set->set("osi_host", $_POST["osi_host"]);
273
274 // Validate personal desktop view
275 if(!(int)$_POST['enable_my_offers'] && !(int)$_POST['enable_my_memberships'])
276 {
277 ilUtil::sendFailure($this->lng->txt('pd_view_select_at_least_one'), true);
278 $ilCtrl->redirect($this, 'view');
279 }
280
281 // Enable 'My Offers' (default personal items)
282 $ilSetting->set('disable_my_offers', (int)($_POST['enable_my_offers'] ? 0 : 1));
283
284 // Enable 'My Memberships'
285 $ilSetting->set('disable_my_memberships', (int)($_POST['enable_my_memberships'] ? 0 : 1));
286
287 if((int)$_POST['enable_my_offers'] && !(int)$_POST['enable_my_memberships'])
288 $_POST['personal_items_default_view'] = 0;
289 else if(!(int)$_POST['enable_my_offers'] && (int)$_POST['enable_my_memberships'])
290 $_POST['personal_items_default_view'] = 1;
291 else if(!isset($_POST['personal_items_default_view']))
292 $_POST['personal_items_default_view'] = $ilSetting->get('personal_items_default_view');
293
294 // Default view of personal items
295 $ilSetting->set('personal_items_default_view', (int)$_POST['personal_items_default_view']);
296
297 ilUtil::sendSuccess($this->lng->txt("settings_saved"), true);
298 $ilCtrl->redirect($this, "view");
299 }
300
304 public function editWsp()
305 {
306 global $ilCtrl, $lng, $ilSetting;
307
308 include_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
309 $form = new ilPropertyFormGUI();
310 $form->setFormAction($ilCtrl->getFormAction($this, "saveWsp"));
311 $form->setTitle($lng->txt("pd_personal_workspace"));
312
313 // Enable 'Personal Workspace'
314 $wsp_prop = new ilCheckboxInputGUI($lng->txt('pd_enable_personal_workspace'), 'wsp');
315 $wsp_prop->setValue('1');
316 $wsp_prop->setChecked(($ilSetting->get('disable_personal_workspace') ? '0' : '1'));
317 $form->addItem($wsp_prop);
318
319 // Enable 'Blogs'
320 $blog_prop = new ilCheckboxInputGUI($lng->txt('pd_enable_wsp_blogs'), 'blog');
321 $blog_prop->setValue('1');
322 $blog_prop->setChecked(($ilSetting->get('disable_wsp_blogs') ? '0' : '1'));
323 $wsp_prop->addSubItem($blog_prop);
324
325 // Enable 'Files'
326 $file_prop = new ilCheckboxInputGUI($lng->txt('pd_enable_wsp_files'), 'file');
327 $file_prop->setValue('1');
328 $file_prop->setChecked(($ilSetting->get('disable_wsp_files') ? '0' : '1'));
329 $wsp_prop->addSubItem($file_prop);
330
331 // Enable 'Certificates'
332 $cert_prop = new ilCheckboxInputGUI($lng->txt('pd_enable_wsp_certificates'), 'cert');
333 $cert_prop->setValue('1');
334 $cert_prop->setChecked(($ilSetting->get('disable_wsp_certificates') ? '0' : '1'));
335 $wsp_prop->addSubItem($cert_prop);
336
337 // Enable 'Links'
338 $link_prop = new ilCheckboxInputGUI($lng->txt('pd_enable_wsp_links'), 'link');
339 $link_prop->setValue('1');
340 $link_prop->setChecked(($ilSetting->get('disable_wsp_links') ? '0' : '1'));
341 $wsp_prop->addSubItem($link_prop);
342
343 /*
344 // Enable 'Portfolios'
345 $lng->loadLanguageModule('user');
346 $prtf_prop = new ilCheckboxInputGUI($lng->txt('pd_enable_prtf'), 'prtf');
347 $prtf_prop->setValue('1');
348 $prtf_prop->setInfo($lng->txt('user_portfolios_desc'));
349 $prtf_prop->setChecked(($ilSetting->get('user_portfolios') ? '1' : '0'));
350 $form->addItem($prtf_prop);
351 */
352
353 // Load the disk quota settings object
354 require_once 'Services/WebDAV/classes/class.ilObjDiskQuotaSettings.php';
355 $disk_quota_obj = ilObjDiskQuotaSettings::getInstance();
356
357 // Enable disk quota
358 $lng->loadLanguageModule("file");
359 $cb_prop = new ilCheckboxInputGUI($lng->txt("personal_workspace_disk_quota"), "enable_personal_workspace_disk_quota");
360 $cb_prop->setValue('1');
361 $cb_prop->setChecked($disk_quota_obj->isPersonalWorkspaceDiskQuotaEnabled());
362 $cb_prop->setInfo($lng->txt('enable_personal_workspace_disk_quota_info'));
363 $form->addItem($cb_prop);
364
365 require_once 'Services/Administration/classes/class.ilAdministrationSettingsFormHandler.php';
368 $form,
369 $this
370 );
371
372 // command buttons
373 $form->addCommandButton("saveWsp", $lng->txt("save"));
374 $form->addCommandButton("editWsp", $lng->txt("cancel"));
375
376 $this->tpl->setContent($form->getHTML());
377 }
378
382 public function saveWsp()
383 {
384 global $ilCtrl, $ilSetting;
385
386 // without personal workspace we have to disable to sub-items
387 if(!$_POST["wsp"])
388 {
389 $_POST["blog"] = 0;
390 $_POST["file"] = 0;
391 $_POST["cert"] = 0;
392 $_POST["link"] = 0;
393 }
394
395 $ilSetting->set('disable_personal_workspace', (int)($_POST['wsp'] ? 0 : 1));
396 $ilSetting->set('disable_wsp_blogs', (int)($_POST['blog'] ? 0 : 1));
397 $ilSetting->set('disable_wsp_files', (int)($_POST['file'] ? 0 : 1));
398 $ilSetting->set('disable_wsp_certificates', (int)($_POST['cert'] ? 0 : 1));
399 $ilSetting->set('disable_wsp_links', (int)($_POST['link'] ? 0 : 1));
400 // $ilSetting->set('user_portfolios', (int)($_POST['prtf'] ? 1 : 0));
401
402 // Load the disk quota settings object
403 require_once 'Services/WebDAV/classes/class.ilObjDiskQuotaSettings.php';
404 $disk_quota_obj = ilObjDiskQuotaSettings::getInstance();
405 $disk_quota_obj->setPersonalWorkspaceDiskQuotaEnabled($_POST['enable_personal_workspace_disk_quota'] == '1');
406 $disk_quota_obj->update();
407
408 ilUtil::sendSuccess($this->lng->txt("settings_saved"), true);
409 $ilCtrl->redirect($this, "editWsp");
410 }
411
412 public function addToExternalSettingsForm($a_form_id)
413 {
414 switch($a_form_id)
415 {
417
418 require_once 'Services/WebDAV/classes/class.ilObjDiskQuotaSettings.php';
419 $disk_quota_obj = ilObjDiskQuotaSettings::getInstance();
420
421 $fields = array('personal_workspace_disk_quota' => array($disk_quota_obj->isPersonalWorkspaceDiskQuotaEnabled(), ilAdministrationSettingsFormHandler::VALUE_BOOL));
422
423 return array(array("editWsp", $fields));
424 }
425 }
426}
427
428?>
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.
This class represents a number 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.
$_POST['username']
Definition: cron.php:12
global $ilCtrl
Definition: ilias.php:18
global $ilSetting
Definition: privfeed.php:40
$cmd
Definition: sahs_server.php:35