ILIAS  Release_4_4_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
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 ilObjFileAccessSettings($a_id = 0,$a_call_by_reference = true)
88  {
89  $this->type = "facs";
90  $this->ilObject($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 $ilClientIniFile;
261 
262  // Clear any old error messages
263  $ilClientIniFile->error(null);
264 
265  if (! $ilClientIniFile->groupExists('file_access'))
266  {
267  $ilClientIniFile->addGroup('file_access');
268  }
269  $ilClientIniFile->setVariable('file_access', 'webdav_enabled', $this->webdavEnabled ? '1' : '0');
270  $ilClientIniFile->setVariable('file_access', 'webdav_actions_visible', $this->webdavActionsVisible ? '1' : '0');
271  $ilClientIniFile->setVariable('file_access', 'download_with_uploaded_filename', $this->downloadWithUploadedFilename ? '1' : '0');
272  $ilClientIniFile->write();
273 
274  if ($ilClientIniFile->getError()) {
275  global $ilErr;
276  $ilErr->raiseError($ilClientIniFile->getError(),$ilErr->WARNING);
277  }
278 
279  require_once 'Services/Administration/classes/class.ilSetting.php';
280  $settings = new ilSetting('file_access');
281  $settings->set('inline_file_extensions', $this->inlineFileExtensions);
282  $settings->set('custom_webfolder_instructions_enabled', $this->customWebfolderInstructionsEnabled ? '1' : '0');
283  $settings->set('custom_webfolder_instructions', $this->customWebfolderInstructions);
284  }
289  public function read($a_force_db = false)
290  {
291  parent::read($a_force_db);
292 
293  global $ilClientIniFile;
294  $this->webdavEnabled = $ilClientIniFile->readVariable('file_access','webdav_enabled') == '1';
295  $this->webdavActionsVisible = $ilClientIniFile->readVariable('file_access','webdav_actions_visible') == '1';
296  $this->downloadWithUploadedFilename = $ilClientIniFile->readVariable('file_access','download_with_uploaded_filename') == '1';
297  $ilClientIniFile->ERROR = false;
298 
299  require_once 'Services/Administration/classes/class.ilSetting.php';
300  $settings = new ilSetting('file_access');
301  $this->inlineFileExtensions = $settings->get('inline_file_extensions','');
302  $this->customWebfolderInstructionsEnabled = $settings->get('custom_webfolder_instructions_enabled', '0') == '1';
303  $this->customWebfolderInstructions = $settings->get('custom_webfolder_instructions', '');
304  }
305 
306 
307 
308 } // END class.ilObjFileAccessSettings
309 // END WebDAV
310 ?>