ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
class.ilObjPersonalWorkspaceSettingsGUI.php
Go to the documentation of this file.
1<?php
2
3/* Copyright (c) 1998-2019 ILIAS open source, Extended GPL, see docs/LICENSE */
4
14{
18 protected $rbacsystem;
19
23 protected $error;
24
28 protected $request;
29
33 protected $tabs;
34
38 protected $ui;
39
40
44 protected $setting;
45
49 protected $main_tpl;
50
51
57 public function __construct($a_data, $a_id, $a_call_by_reference = true, $a_prepare_output = true)
58 {
59 global $DIC;
60
61 $this->lng = $DIC->language();
62 $this->rbacsystem = $DIC->rbac()->system();
63 $this->error = $DIC["ilErr"];
64 $this->ctrl = $DIC->ctrl();
65 $this->request = $DIC->http()->request();
66 $this->tabs = $DIC->tabs();
67 $this->ui = $DIC->ui();
68 $this->setting = $DIC->settings();
69 $this->main_tpl = $DIC->ui()->mainTemplate();
70
71 $this->type = 'prss';
72
73 parent::__construct($a_data, $a_id, $a_call_by_reference, $a_prepare_output);
74
75 $this->lng->loadLanguageModule("pwsp");
76 }
77
82 public function executeCommand()
83 {
87
88 $next_class = $ctrl->getNextClass($this);
89 $cmd = $ctrl->getCmd("editSettings");
90
91 if (!$rbacsystem->checkAccess("visible,read", $this->object->getRefId())) {
92 $this->error->raiseError($this->lng->txt('no_permission'), $this->error->WARNING);
93 }
94
95 $this->prepareOutput();
96
97 switch ($next_class) {
98 case 'ilpermissiongui':
99 $tabs->activateTab('perm_settings');
100 $perm_gui = new ilPermissionGUI($this);
101 $ctrl->forwardCommand($perm_gui);
102 break;
103
104 default:
105 if ($cmd == "view") {
106 $cmd = "editSettings";
107 }
108 if (in_array($cmd, ["editSettings", "saveSettings"])) {
109 $this->$cmd();
110 }
111 break;
112 }
113 }
114
118 public function getAdminTabs()
119 {
124
125 if ($rbacsystem->checkAccess("visible,read", $this->object->getRefId())) {
126 $tabs->addTab(
127 "settings",
128 $lng->txt("settings"),
129 $ctrl->getLinkTarget($this, "editSettings")
130 );
131 }
132
133 if ($rbacsystem->checkAccess('edit_permission', $this->object->getRefId())) {
134 $tabs->addTab(
135 "perm_settings",
136 $lng->txt("perm_settings"),
137 $ctrl->getLinkTargetByClass('ilpermissiongui', "perm")
138 );
139 }
140 }
141
145 public function editSettings()
146 {
151
152 $tabs->activateTab("settings");
153
154 include_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
155 $form = new ilPropertyFormGUI();
156 $form->setFormAction($ilCtrl->getFormAction($this, "saveWsp"));
157 $form->setTitle($lng->txt("obj_prss"));
158
159 // Enable 'Personal Workspace'
160 $wsp_prop = new ilCheckboxInputGUI($lng->txt('pwsp_enable_personal_resources'), 'wsp');
161 $wsp_prop->setValue('1');
162 $wsp_prop->setChecked(($ilSetting->get('disable_personal_workspace') ? '0' : '1'));
163 $form->addItem($wsp_prop);
164
165 // Enable 'Blogs'
166 $blog_prop = new ilCheckboxInputGUI($lng->txt('pwsp_enable_wsp_blogs'), 'blog');
167 $blog_prop->setValue('1');
168 $blog_prop->setChecked(($ilSetting->get('disable_wsp_blogs') ? '0' : '1'));
169 $wsp_prop->addSubItem($blog_prop);
170
171 // Enable 'Files'
172 $file_prop = new ilCheckboxInputGUI($lng->txt('pwsp_enable_wsp_files'), 'file');
173 $file_prop->setValue('1');
174 $file_prop->setChecked(($ilSetting->get('disable_wsp_files') ? '0' : '1'));
175 $wsp_prop->addSubItem($file_prop);
176
177 // Enable 'Certificates'
178 $cert_prop = new ilCheckboxInputGUI($lng->txt('pwsp_enable_wsp_certificates'), 'cert');
179 $cert_prop->setValue('1');
180 $cert_prop->setChecked(($ilSetting->get('disable_wsp_certificates') ? '0' : '1'));
181 $wsp_prop->addSubItem($cert_prop);
182
183 // Enable 'Links'
184 $link_prop = new ilCheckboxInputGUI($lng->txt('pwsp_enable_wsp_links'), 'link');
185 $link_prop->setValue('1');
186 $link_prop->setChecked(($ilSetting->get('disable_wsp_links') ? '0' : '1'));
187 $wsp_prop->addSubItem($link_prop);
188
189 // Load the disk quota settings object
190 $disk_quota_obj = ilObjDiskQuotaSettings::getInstance();
191
192 // Enable disk quota
193 $lng->loadLanguageModule("file");
194 $cb_prop = new ilCheckboxInputGUI($lng->txt("personal_resources_disk_quota"), "enable_personal_workspace_disk_quota");
195 $cb_prop->setValue('1');
196 $cb_prop->setChecked($disk_quota_obj->isPersonalWorkspaceDiskQuotaEnabled());
197 $cb_prop->setInfo($lng->txt('personal_resources_disk_quota_info'));
198 $form->addItem($cb_prop);
199
200 if ($this->rbacsystem->checkAccess('write', $this->object->getRefId())) {
201 // command buttons
202 $form->addCommandButton("saveSettings", $lng->txt("save"));
203 $form->addCommandButton("editSettings", $lng->txt("cancel"));
204 }
205
206 $this->tpl->setContent($form->getHTML());
207 }
208
212 public function saveSettings()
213 {
216 $ilAccess = $this->access;
217
218 if (!$ilAccess->checkAccess('write', '', $this->object->getRefId())) {
219 $ilCtrl->redirect($this, "view");
220 }
221
222 // without personal workspace we have to disable to sub-items
223 if (!$_POST["wsp"]) {
224 $_POST["blog"] = 0;
225 $_POST["file"] = 0;
226 $_POST["cert"] = 0;
227 $_POST["link"] = 0;
228 }
229
230 $ilSetting->set('disable_personal_workspace', (int) ($_POST['wsp'] ? 0 : 1));
231 $ilSetting->set('disable_wsp_blogs', (int) ($_POST['blog'] ? 0 : 1));
232 $ilSetting->set('disable_wsp_files', (int) ($_POST['file'] ? 0 : 1));
233 $ilSetting->set('disable_wsp_certificates', (int) ($_POST['cert'] ? 0 : 1));
234 $ilSetting->set('disable_wsp_links', (int) ($_POST['link'] ? 0 : 1));
235 // $ilSetting->set('user_portfolios', (int)($_POST['prtf'] ? 1 : 0));
236
237 // Load the disk quota settings object
238 $disk_quota_obj = ilObjDiskQuotaSettings::getInstance();
239 $disk_quota_obj->setPersonalWorkspaceDiskQuotaEnabled($_POST['enable_personal_workspace_disk_quota'] == '1');
240 $disk_quota_obj->update();
241
242 ilUtil::sendSuccess($this->lng->txt("settings_saved"), true);
243 $ilCtrl->redirect($this, "editSettings");
244 }
245
246 public function addToExternalSettingsForm($a_form_id)
247 {
248 switch ($a_form_id) {
250
251 $disk_quota_obj = ilObjDiskQuotaSettings::getInstance();
252
253 $fields = array('personal_workspace_disk_quota' => array($disk_quota_obj->isPersonalWorkspaceDiskQuotaEnabled(), ilAdministrationSettingsFormHandler::VALUE_BOOL));
254
255 return array(array("editSettings", $fields));
256 }
257 }
258}
$_POST["username"]
An exception for terminatinating execution or to throw for unit testing.
error($a_errmsg)
set error message @access public
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($a_show_subobjects=true)
prepare output
New PermissionGUI (extends from old ilPermission2GUI) RBAC related output.
This class represents a property form user interface.
global $ilCtrl
Definition: ilias.php:18
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
global $ilSetting
Definition: privfeed.php:17
ui()
Definition: ui.php:5
$DIC
Definition: xapitoken.php:46