ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
class.ilObjFileAccessSettings.php
Go to the documentation of this file.
1<?php
2// BEGIN WebDAV
3/*
4 +-----------------------------------------------------------------------------+
5 | ILIAS open source |
6 +-----------------------------------------------------------------------------+
7 | Copyright (c) 1998-2001 ILIAS open source, University of Cologne |
8 | |
9 | This program is free software; you can redistribute it and/or |
10 | modify it under the terms of the GNU General Public License |
11 | as published by the Free Software Foundation; either version 2 |
12 | of the License, or (at your option) any later version. |
13 | |
14 | This program is distributed in the hope that it will be useful, |
15 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
17 | GNU General Public License for more details. |
18 | |
19 | You should have received a copy of the GNU General Public License |
20 | along with this program; if not, write to the Free Software |
21 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
22 +-----------------------------------------------------------------------------+
23*/
24
39include_once "./Services/Object/classes/class.ilObject.php";
40
42{
43
81
82
89 public function __construct($a_id = 0, $a_call_by_reference = true)
90 {
91 $this->type = "facs";
92 parent::__construct($a_id, $a_call_by_reference);
93 }
94
95
103 public function setWebdavEnabled($newValue)
104 {
105 $this->webdavEnabled = $newValue;
106 }
107
108
114 public function isWebdavEnabled()
115 {
117 }
118
119
120 public function setWebdavVersioningEnabled($newValue)
121 {
122 $this->webdavVersioningEnabled = $newValue;
123 }
124
125
127 {
129 }
130
131
139 public function setWebdavActionsVisible($newValue)
140 {
141 $this->webdavActionsVisible = $newValue;
142 }
143
144
150 public function isWebdavActionsVisible()
151 {
153 }
154
162 {
164 }
165
166
173 {
175 }
176
177
185 public function setCustomWebfolderInstructionsEnabled($newValue)
186 {
187 $this->customWebfolderInstructionsEnabled = $newValue;
188 }
189
190
198 public function setInlineFileExtensions($newValue)
199 {
200 $this->inlineFileExtensions = $newValue;
201 }
202
203
209 public function getInlineFileExtensions()
210 {
212 }
213
214
222 public function setDownloadWithUploadedFilename($newValue)
223 {
224 $this->downloadWithUploadedFilename = $newValue;
225 }
226
227
234 {
236 }
237
238
246 public function create()
247 {
248 parent::create();
249 $this->write();
250 }
251
252
258 public function update()
259 {
260 parent::update();
261 $this->write();
262 }
263
264
270 private function write()
271 {
272 global $DIC;
273 $ilClientIniFile = $DIC['ilClientIniFile'];
274 $settings = new ilSetting('file_access');
275
276 // Clear any old error messages
277 $ilClientIniFile->error(null);
278
279 if (!$ilClientIniFile->groupExists('file_access')) {
280 $ilClientIniFile->addGroup('file_access');
281 }
282 $ilClientIniFile->setVariable('file_access', 'webdav_enabled', $this->webdavEnabled ? '1' : '0');
283 $settings->set('webdav_versioning_enabled', $this->webdavVersioningEnabled ? '1' : '0');
284 $ilClientIniFile->setVariable('file_access', 'webdav_actions_visible', $this->webdavActionsVisible ? '1' : '0');
285 $ilClientIniFile->setVariable('file_access', 'download_with_uploaded_filename', $this->downloadWithUploadedFilename ? '1' : '0');
286 $ilClientIniFile->write();
287
288 if ($ilClientIniFile->getError()) {
289 global $DIC;
290 $ilErr = $DIC['ilErr'];
291 $ilErr->raiseError($ilClientIniFile->getError(), $ilErr->WARNING);
292 }
293
294 require_once 'Services/Administration/classes/class.ilSetting.php';
295 $settings->set('inline_file_extensions', $this->inlineFileExtensions);
296 }
297
298
302 public function read()
303 {
304 parent::read();
305
306 global $DIC;
307 $settings = new ilSetting('file_access');
308 $ilClientIniFile = $DIC['ilClientIniFile'];
309 $this->webdavEnabled = $ilClientIniFile->readVariable('file_access', 'webdav_enabled') == '1';
310 // default_value = 1 for versionigEnabled because it was already standard before ilias5.4
311 $this->webdavVersioningEnabled = $settings->get('webdav_versioning_enabled', '1') == '1';
312 $this->webdavActionsVisible = $ilClientIniFile->readVariable('file_access', 'webdav_actions_visible') == '1';
313 $this->downloadWithUploadedFilename = $ilClientIniFile->readVariable('file_access', 'download_with_uploaded_filename') == '1';
314 $ilClientIniFile->ERROR = false;
315
316 require_once 'Services/Administration/classes/class.ilSetting.php';
317 $this->inlineFileExtensions = $settings->get('inline_file_extensions', '');
318 }
319
320
332 public static function _getDefaultWebfolderInstructions()
333 {
334 global $lng;
335
336 return $lng->txt('webfolder_instructions_text');
337 }
338
339
347 private function getUploadMaxFilesize()
348 {
349 $val = ini_get('upload_max_filesize');
350
351 $val = trim($val);
352 $last = strtolower($val[strlen($val) - 1]);
353 switch ($last) {
354 // The 'G' modifier is available since PHP 5.1.0
355 case 'g':
356 $val *= 1024;
357 // no break
358 case 'm':
359 $val *= 1024;
360 // no break
361 case 'k':
362 $val *= 1024;
363 }
364
365 return $val;
366 }
367} // END class.ilObjFileAccessSettings
368// END WebDAV
An exception for terminatinating execution or to throw for unit testing.
getUploadMaxFilesize()
TODO: Check if needed and refactor.
getInlineFileExtensions()
Gets the inlineFileExtensions property.
write()
write object data into db
setCustomWebfolderInstructionsEnabled($newValue)
Sets the customWebfolderInstructionsEnabled property.
isWebdavEnabled()
Gets the webdavEnabled property.
isCustomWebfolderInstructionsEnabled()
Gets the customWebfolderInstructionsEnabled property.
isDownloadWithUploadedFilename()
Gets the downloadWithUploadedFilename property.
static _getDefaultWebfolderInstructions()
TODO: Check if needed and refactor.
setWebdavActionsVisible($newValue)
Sets the webdavActionsVisible property.
setWebdavEnabled($newValue)
Sets the webdavEnabled property.
setInlineFileExtensions($newValue)
Sets the inlineFileExtensions property.
read()
read object data from db into object
$customWebfolderInstructionsEnabled
Boolean property.
isWebdavActionsVisible()
Gets the webdavActionsVisible property.
__construct($a_id=0, $a_call_by_reference=true)
Constructor.
getDefaultWebfolderInstructions()
Gets the defaultWebfolderInstructions property.
setDownloadWithUploadedFilename($newValue)
Sets the downloadWithUploadedFilename property.
Class ilObject Basic functions for all objects.
ILIAS Setting Class.
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
$ilErr
Definition: raiseError.php:18
$DIC
Definition: xapitoken.php:46