ILIAS  Release_4_2_x_branch Revision 61807
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilECSNodeMappingSettings.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
8 {
9  private static $instance = null;
10 
11  private $storage = null;
12 
13  private $active = false;
14  private $create_empty_containers = false;
15 
19  protected function __construct()
20  {
21  $this->initStorage();
22  $this->read();
23  }
24 
29  public static function getInstance()
30  {
31  if(self::$instance)
32  {
33  return self::$instance;
34  }
35  return self::$instance = new ilECSNodeMappingSettings();
36  }
37 
42  public function isEnabled()
43  {
44  return $this->active;
45  }
46 
51  public function enable($a_status)
52  {
53  $this->active = $a_status;
54  }
55 
60  public function enableEmptyContainerCreation($a_status)
61  {
62  $this->create_empty_containers = $a_status;
63  }
64 
70  {
72  }
73 
77  public function update()
78  {
79  $this->getStorage()->set('active', (int) $this->isEnabled());
80  $this->getStorage()->set('create_empty', $this->isEmptyContainerCreationEnabled());
81  return true;
82  }
83 
88  protected function getStorage()
89  {
90  return $this->storage;
91  }
92 
96  protected function initStorage()
97  {
98  global $ilSetting;
99 
100  $this->storage = new ilSetting('ecs_node_mapping');
101  }
102 
106  protected function read()
107  {
108  $this->enable($this->getStorage()->get('active', $this->active));
109  $this->enableEmptyContainerCreation($this->getStorage()->get('create_empty'),$this->create_empty_containers);
110  }
111 }
112 
113 ?>