ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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 
39 include_once "./Services/Object/classes/class.ilObject.php";
40 
42 {
46  private $webdavEnabled;
47 
52 
58 
63 
70 
80 
87  public function __construct($a_id = 0,$a_call_by_reference = true)
88  {
89  $this->type = "facs";
90  parent::__construct($a_id,$a_call_by_reference);
91  }
92 
99  public function setWebdavEnabled($newValue)
100  {
101  $this->webdavEnabled = $newValue;
102  }
108  public function isWebdavEnabled()
109  {
110  return $this->webdavEnabled;
111  }
118  public function setWebdavActionsVisible($newValue)
119  {
120  $this->webdavActionsVisible = $newValue;
121  }
127  public function isWebdavActionsVisible()
128  {
130  }
131 
132 
143  public function setCustomWebfolderInstructions($newValue)
144  {
145  $this->customWebfolderInstructions = $newValue;
146  }
153  {
154  if (strlen($this->customWebfolderInstructions) == 0)
155  {
156  require_once 'Services/WebDAV/classes/class.ilDAVServer.php';
157  $this->customWebfolderInstructions = ilDAVServer::_getDefaultWebfolderInstructions();
158  }
160  }
168  {
170  }
177  {
179  }
186  public function setCustomWebfolderInstructionsEnabled($newValue)
187  {
188  $this->customWebfolderInstructionsEnabled = $newValue;
189  }
190 
191 
198  public function setInlineFileExtensions($newValue)
199  {
200  $this->inlineFileExtensions = $newValue;
201  }
207  public function getInlineFileExtensions()
208  {
210  }
217  public function setDownloadWithUploadedFilename($newValue)
218  {
219  $this->downloadWithUploadedFilename = $newValue;
220  }
227  {
229  }
230 
231 
239  public function create()
240  {
241  parent::create();
242  $this->write();
243  }
249  public function update()
250  {
251  parent::update();
252  $this->write();
253  }
258  private function write()
259  {
260  global $DIC;
261  $ilClientIniFile = $DIC['ilClientIniFile'];
262 
263  // Clear any old error messages
264  $ilClientIniFile->error(null);
265 
266  if (! $ilClientIniFile->groupExists('file_access'))
267  {
268  $ilClientIniFile->addGroup('file_access');
269  }
270  $ilClientIniFile->setVariable('file_access', 'webdav_enabled', $this->webdavEnabled ? '1' : '0');
271  $ilClientIniFile->setVariable('file_access', 'webdav_actions_visible', $this->webdavActionsVisible ? '1' : '0');
272  $ilClientIniFile->setVariable('file_access', 'download_with_uploaded_filename', $this->downloadWithUploadedFilename ? '1' : '0');
273  $ilClientIniFile->write();
274 
275  if ($ilClientIniFile->getError()) {
276  global $DIC;
277  $ilErr = $DIC['ilErr'];
278  $ilErr->raiseError($ilClientIniFile->getError(),$ilErr->WARNING);
279  }
280 
281  require_once 'Services/Administration/classes/class.ilSetting.php';
282  $settings = new ilSetting('file_access');
283  $settings->set('inline_file_extensions', $this->inlineFileExtensions);
284  $settings->set('custom_webfolder_instructions_enabled', $this->customWebfolderInstructionsEnabled ? '1' : '0');
285  $settings->set('custom_webfolder_instructions', $this->customWebfolderInstructions);
286  }
290  public function read()
291  {
292  parent::read();
293 
294  global $DIC;
295  $ilClientIniFile = $DIC['ilClientIniFile'];
296  $this->webdavEnabled = $ilClientIniFile->readVariable('file_access','webdav_enabled') == '1';
297  $this->webdavActionsVisible = $ilClientIniFile->readVariable('file_access','webdav_actions_visible') == '1';
298  $this->downloadWithUploadedFilename = $ilClientIniFile->readVariable('file_access','download_with_uploaded_filename') == '1';
299  $ilClientIniFile->ERROR = false;
300 
301  require_once 'Services/Administration/classes/class.ilSetting.php';
302  $settings = new ilSetting('file_access');
303  $this->inlineFileExtensions = $settings->get('inline_file_extensions','');
304  $this->customWebfolderInstructionsEnabled = $settings->get('custom_webfolder_instructions_enabled', '0') == '1';
305  $this->customWebfolderInstructions = $settings->get('custom_webfolder_instructions', '');
306  }
307 
308 
309 
310 } // END class.ilObjFileAccessSettings
311 // END WebDAV
312 ?>
global $ilErr
Definition: raiseError.php:16
ILIAS Setting Class.
setDownloadWithUploadedFilename($newValue)
Sets the downloadWithUploadedFilename property.
setInlineFileExtensions($newValue)
Sets the inlineFileExtensions property.
setCustomWebfolderInstructions($newValue)
Sets the customWebfolderInstructions property.
$customWebfolderInstructionsEnabled
Boolean property.
setCustomWebfolderInstructionsEnabled($newValue)
Sets the customWebfolderInstructionsEnabled property.
Class ilObject Basic functions for all objects.
static _getDefaultWebfolderInstructions()
Gets instructions for the usage of webfolders.
getDefaultWebfolderInstructions()
Gets the defaultWebfolderInstructions property.
isWebdavEnabled()
Gets the webdavEnabled property.
setWebdavEnabled($newValue)
Sets the webdavEnabled property.
setWebdavActionsVisible($newValue)
Sets the webdavActionsVisible property.
isCustomWebfolderInstructionsEnabled()
Gets the customWebfolderInstructionsEnabled property.
getInlineFileExtensions()
Gets the inlineFileExtensions property.
getCustomWebfolderInstructions()
Gets the customWebfolderInstructions property.
isWebdavActionsVisible()
Gets the webdavActionsVisible property.
__construct($a_id=0, $a_call_by_reference=true)
Constructor.
write()
write object data into db
global $DIC
isDownloadWithUploadedFilename()
Gets the downloadWithUploadedFilename property.
read()
read object data from db into object