ILIAS  Release_3_10_x_branch Revision 61812
 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 "classes/class.ilObject.php";
40 
42 {
46  private $webdavEnabled;
47 
52 
58 
63 
70 
77  public function ilObjFileAccessSettings($a_id = 0,$a_call_by_reference = true)
78  {
79  $this->type = "facs";
80  $this->ilObject($a_id,$a_call_by_reference);
81  }
82 
89  public function setWebdavEnabled($newValue)
90  {
91  $this->webdavEnabled = $newValue;
92  }
98  public function isWebdavEnabled()
99  {
100  return $this->webdavEnabled;
101  }
108  public function setWebdavActionsVisible($newValue)
109  {
110  $this->webdavActionsVisible = $newValue;
111  }
117  public function isWebdavActionsVisible()
118  {
120  }
121 
122 
133  public function setCustomWebfolderInstructions($newValue)
134  {
135  $this->customWebfolderInstructions = $newValue;
136  }
143  {
144  if (strlen($this->customWebfolderInstructions) == 0)
145  {
146  require_once 'Services/WebDAV/classes/class.ilDAVServer.php';
147  $this->customWebfolderInstructions = ilDAVServer::_getDefaultWebfolderInstructions();
148  }
150  }
158  {
160  }
167  {
169  }
176  public function setCustomWebfolderInstructionsEnabled($newValue)
177  {
178  $this->customWebfolderInstructionsEnabled = $newValue;
179  }
180 
181 
188  public function setInlineFileExtensions($newValue)
189  {
190  $this->inlineFileExtensions = $newValue;
191  }
197  public function getInlineFileExtensions()
198  {
200  }
201 
209  public function create()
210  {
211  parent::create();
212  $this->write();
213  }
219  public function update()
220  {
221  parent::update();
222  $this->write();
223  }
228  private function write()
229  {
230  global $ilClientIniFile;
231 
232  if (! $ilClientIniFile->groupExists('file_access'))
233  {
234  $ilClientIniFile->addGroup('file_access');
235  }
236  $ilClientIniFile->setVariable('file_access', 'webdav_enabled', $this->webdavEnabled ? '1' : '0');
237  $ilClientIniFile->setVariable('file_access', 'webdav_actions_visible', $this->webdavActionsVisible ? '1' : '0');
238  $ilClientIniFile->write();
239 
240  if ($ilClientIniFile->getError()) {
241  global $ilErr;
242  $ilErr->raiseError($ilClientIniFile->getError(),$ilErr->WARNING);
243  }
244 
245  require_once 'Services/Administration/classes/class.ilSetting.php';
246  $settings = new ilSetting('file_access');
247  $settings->set('inline_file_extensions', $this->inlineFileExtensions);
248  $settings->set('custom_webfolder_instructions_enabled', $this->customWebfolderInstructionsEnabled ? '1' : '0');
249  $settings->set('custom_webfolder_instructions', $this->customWebfolderInstructions);
250  }
255  public function read($a_force_db = false)
256  {
257  parent::read($a_force_db);
258 
259  global $ilClientIniFile;
260  $this->webdavEnabled = $ilClientIniFile->readVariable('file_access','webdav_enabled') == '1';
261  $this->webdavActionsVisible = $ilClientIniFile->readVariable('file_access','webdav_actions_visible') == '1';
262  $ilClientIniFile->ERROR = false;
263 
264  require_once 'Services/Administration/classes/class.ilSetting.php';
265  $settings = new ilSetting('file_access');
266  $this->inlineFileExtensions = $settings->get('inline_file_extensions','');
267  $this->customWebfolderInstructionsEnabled = $settings->get('custom_webfolder_instructions_enabled', '0') == '1';
268  $this->customWebfolderInstructions = $settings->get('custom_webfolder_instructions', '');
269  }
270 
271 
272 
273 } // END class.ilObjFileAccessSettings
274 // END WebDAV
275 ?>