ILIAS  release_4-3 Revision
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilFMSettings.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
10 {
11  private static $instance = null;
12 
13  private $storage = null;
14  private $enabled = false;
15  private $localFS = true;
16  private $maxFileSize = 64;
17 
21  private function __construct()
22  {
23  $this->storage = new ilSetting('fm');
24  $this->read();
25  }
26 
31  public static function getInstance()
32  {
33  if(self::$instance)
34  {
35  return self::$instance;
36  }
37  return self::$instance = new ilFMSettings();
38  }
39 
44  protected function getStorage()
45  {
46  return $this->storage;
47  }
48 
53  public function enable($a_status)
54  {
55  $this->enabled = $a_status;
56  }
57 
62  public function isEnabled()
63  {
64  return $this->enabled;
65  }
66 
71  public function enableLocalFS($a_stat)
72  {
73  $this->localFS = $a_stat;
74  }
75 
80  public function isLocalFSEnabled()
81  {
82  return $this->localFS;
83  }
84 
85  public function setMaxFileSize($a_size)
86  {
87  $this->maxFileSize = $a_size;
88  }
89 
90  public function getMaxFileSize()
91  {
92  return $this->maxFileSize;
93  }
94 
95 
99  public function update()
100  {
101  $this->getStorage()->set('enabled',(int) $this->isEnabled());
102  $this->getStorage()->set('local',(int) $this->isLocalFSEnabled());
103  $this->getStorage()->set('maxFileSize', (int) $this->getMaxFileSize());
104  }
105 
109  protected function read()
110  {
111  $this->enable($this->getStorage()->get('enabled', $this->enabled));
112  $this->enableLocalFS($this->getStorage()->get('local'), $this->localFS);
113  $this->setMaxFileSize($this->getStorage()->get('maxFileSize',$this->maxFileSize));
114 
115  }
116 }
117 ?>