ILIAS  release_7 Revision v7.30-3-g800a261c036
class.ilObjWebDAVGUI.php
Go to the documentation of this file.
1<?php
2
6
16{
17 const CMD_EDIT_SETTINGS = 'editSettings';
18 const CMD_SAVE_SETTINGS = 'saveSettings';
19
23 protected $ctrl;
27 protected $db;
35 protected $filesystem;
39 protected $http;
43 public $lng;
47 protected $logger;
51 protected $rbacsystem;
55 protected $settings;
59 protected $tabs;
63 public $tpl;
67 protected $ui_factory;
71 protected $ui_renderer;
75 protected $upload;
76
77
83 public function __construct($a_data, $a_id, $a_call_by_reference)
84 {
85 global $DIC;
86
87 $this->type = "wbdv";
88 parent::__construct($a_data, $a_id, $a_call_by_reference, false);
89
90 $this->ctrl = $DIC['ilCtrl'];
91 $this->db = $DIC->database();
92 $this->error_handling = $DIC["ilErr"];
93 $this->filesystem = $DIC->filesystem();
94 $this->http = $DIC->http();
95 $this->lng = $DIC->language();
96 $this->logger = $DIC->logger()->root();
97 $this->rbacsystem = $DIC['rbacsystem'];
98 $this->settings = $DIC['ilSetting'];
99 $this->tabs = $DIC['ilTabs'];
100 $this->tpl = $DIC['tpl'];
101 $this->tree = $DIC['tree'];
102 $this->ui_factory = $DIC->ui()->factory();
103 $this->ui_renderer = $DIC->ui()->renderer();
104 $this->upload = $DIC->upload();
105 }
106
107
114 public function executeCommand()
115 {
116 $next_class = $this->ctrl->getNextClass($this);
117 $cmd = $this->ctrl->getCmd();
118
119 $this->prepareOutput();
120
121 if (!$this->access->checkAccess('read', '', $this->object->getRefId())) {
122 $this->error_handling->raiseError(
123 $this->lng->txt('no_permission'),
124 $this->error_handling->error_obj->MESSAGE
125 );
126 }
127
128 switch ($next_class) {
129 case strtolower(ilWebDAVMountInstructionsUploadGUI::class):
130 $document_gui = new ilWebDAVMountInstructionsUploadGUI(
131 $this->object,
132 $this->tpl,
133 $this->user,
134 $this->ctrl,
135 $this->lng,
136 $this->rbacsystem,
137 $this->error_handling,
138 $this->logger,
139 $this->toolbar,
140 $this->http,
141 $this->ui_factory,
142 $this->ui_renderer,
143 $this->filesystem,
144 $this->upload,
146 );
147 $this->tabs_gui->activateTab('webdav_upload_instructions');
148 $this->ctrl->forwardCommand($document_gui);
149 break;
150
151 default:
152 if (!$cmd || $cmd == 'view') {
154 }
155 $this->$cmd();
156 break;
157 }
158
159 return true;
160 }
161
162
166 public function getAdminTabs()
167 {
168 if ($this->rbacsystem->checkAccess("visible,read", $this->object->getRefId())) {
169 $this->tabs_gui->addTab(
170 'webdav_general_settings',
171 $this->lng->txt("webdav_general_settings"),
172 $this->ctrl->getLinkTarget($this, self::CMD_EDIT_SETTINGS)
173 );
174 $this->tabs_gui->addTab(
175 'webdav_upload_instructions',
176 $this->lng->txt("webdav_upload_instructions"),
177 $this->ctrl->getLinkTargetByClass(ilWebDAVMountInstructionsUploadGUI::class)
178 );
179 }
180 }
181
182
186 public function setTitleAndDescription()
187 {
188 parent::setTitleAndDescription();
189 $this->tpl->setDescription($this->object->getDescription());
190 }
191
192
193 protected function initSettingsForm()
194 {
195 $form = new ilPropertyFormGUI();
196 $form->setFormAction($this->ctrl->getFormAction($this));
197 $form->setTitle($this->lng->txt("settings"));
198
199 // Enable webdav
200 $cb_prop = new ilCheckboxInputGUI($this->lng->txt("enable_webdav"), "enable_webdav");
201 $cb_prop->setValue('1');
202 $cb_prop->setChecked($this->object->isWebdavEnabled());
203 $form->addItem($cb_prop);
204
205 // Enable versioning
206 $cb_prop = new ilCheckboxInputGUI($this->lng->txt("webdav_enable_versioning"), "enable_versioning_webdav");
207 $cb_prop->setValue('1');
208 $cb_prop->setInfo($this->lng->txt("webdav_versioning_info"));
209 $cb_prop->setChecked($this->object->isWebdavVersioningEnabled());
210 $form->addItem($cb_prop);
211
212 // command buttons
213 $form->addCommandButton(self::CMD_SAVE_SETTINGS, $this->lng->txt('save'));
214
215 return $form;
216 }
217
221 public function editSettings()
222 {
223 $this->tabs_gui->activateTab('webdav_general_settings');
224
225 if (!$this->rbacsystem->checkAccess("visible,read", $this->object->getRefId())) {
226 $this->error_handling->raiseError(
227 $this->lng->txt("no_permission"),
228 $this->error_handling->WARNING
229 );
230 }
231
232 $form = $this->initSettingsForm();
233
234 $this->tpl->setContent($form->getHTML());
235 }
236
237
241 public function saveSettings()
242 {
243 if (!$this->rbacsystem->checkAccess("write", $this->object->getRefId())) {
244 ilUtil::sendFailure($this->lng->txt('no_permission'), true);
245 $this->ctrl->redirect($this, self::CMD_EDIT_SETTINGS);
246 }
247
248 $form = $this->initSettingsForm();
249 if ($form->checkInput()) {
250 $this->object->setWebdavEnabled($_POST['enable_webdav'] == '1');
251 $this->object->setWebdavVersioningEnabled($_POST['enable_versioning_webdav'] == '1');
252 $this->object->update();
253 ilUtil::sendSuccess($this->lng->txt('settings_saved'), true);
254 $this->ctrl->redirect($this, self::CMD_EDIT_SETTINGS);
255 } else {
256 $form->setValuesByPost();
257 $this->tpl->setContent($form->getHTML());
258 }
259 }
260}
user()
Definition: user.php:4
$_POST["username"]
An exception for terminatinating execution or to throw for unit testing.
This class represents a checkbox property in a property form.
editSettings()
Edit settings.
executeCommand()
Execute command.
__construct($a_data, $a_id, $a_call_by_reference)
Constructor.
saveSettings()
Save settings.
setTitleAndDescription()
called by prepare output
Class ilObjectGUI Basic methods of all Output classes.
prepareOutput($a_show_subobjects=true)
prepare output
This class represents a property form user interface.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
global $DIC
Definition: goto.php:24
static http()
Fetches the global http state from ILIAS.
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
settings()
Definition: settings.php:2