ILIAS  release_7 Revision v7.30-3-g800a261c036
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 {
147 $ilCtrl = $this->ctrl;
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 'Links'
178 $link_prop = new ilCheckboxInputGUI($lng->txt('pwsp_enable_wsp_links'), 'link');
179 $link_prop->setValue('1');
180 $link_prop->setChecked(($ilSetting->get('disable_wsp_links') ? '0' : '1'));
181 $wsp_prop->addSubItem($link_prop);
182
183 if ($this->rbacsystem->checkAccess('write', $this->object->getRefId())) {
184 // command buttons
185 $form->addCommandButton("saveSettings", $lng->txt("save"));
186 $form->addCommandButton("editSettings", $lng->txt("cancel"));
187 }
188
189 $this->tpl->setContent($form->getHTML());
190 }
191
195 public function saveSettings()
196 {
197 $ilCtrl = $this->ctrl;
199 $ilAccess = $this->access;
200
201 if (!$ilAccess->checkAccess('write', '', $this->object->getRefId())) {
202 $ilCtrl->redirect($this, "view");
203 }
204
205 // without personal workspace we have to disable to sub-items
206 if (!$_POST["wsp"]) {
207 $_POST["blog"] = 0;
208 $_POST["file"] = 0;
209 $_POST["link"] = 0;
210 }
211
212 $ilSetting->set('disable_personal_workspace', (int) ($_POST['wsp'] ? 0 : 1));
213 $ilSetting->set('disable_wsp_blogs', (int) ($_POST['blog'] ? 0 : 1));
214 $ilSetting->set('disable_wsp_files', (int) ($_POST['file'] ? 0 : 1));
215 $ilSetting->set('disable_wsp_links', (int) ($_POST['link'] ? 0 : 1));
216 // $ilSetting->set('user_portfolios', (int)($_POST['prtf'] ? 1 : 0));
217
218 ilUtil::sendSuccess($this->lng->txt("settings_saved"), true);
219 $ilCtrl->redirect($this, "editSettings");
220 }
221}
$_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.
__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 $DIC
Definition: goto.php:24
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
global $ilSetting
Definition: privfeed.php:17
ui()
Definition: ui.php:5