ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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 $instances = array();
10
11 private $storage = null;
12
13
14 private $server_id = 0;
19 private $mid = 0;
20
21 private $directory_active = false;
22 private $create_empty_containers = false;
23
27 private $course_active = false;
28 private $default_cat = 0;
29 private $allinone = false;
30 private $allinone_cat = 0;
31 private $attributes = false;
32 private $role_mappings = array();
33 private $auth_mode = null;
34
38 protected function __construct($a_server_id, $a_mid)
39 {
40 $this->server_id = $a_server_id;
41 $this->mid = $a_mid;
42
43 $this->initStorage();
44 $this->read();
45 }
46
51 public static function getInstance()
52 {
53 $GLOBALS['ilLog']->write(__METHOD__.': Deprecated call...');
54 $GLOBALS['ilLog']->logStack();
55
56 if(self::$instance)
57 {
58 return self::$instance;
59 }
60 return self::$instance = new ilECSNodeMappingSettings();
61 }
62
69 public static function getInstanceByServerMid($a_server_id, $a_mid)
70 {
71 if(self::$instances[$a_server_id.'_'.$a_mid])
72 {
73 return self::$instances[$a_server_id.'_'.$a_mid];
74 }
75 return self::$instances[$a_server_id.'_'.$a_mid] = new self($a_server_id,$a_mid);
76 }
77
82 public function getServerId()
83 {
84 return $this->server_id;
85 }
86
91 public function getMid()
92 {
93 return $this->mid;
94 }
95
101 {
103 }
104
109 public function enableDirectoryMapping($a_status)
110 {
111 $this->directory_active = $a_status;
112 }
113
118 public function enableEmptyContainerCreation($a_status)
119 {
120 $this->create_empty_containers = $a_status;
121 }
122
128 {
130 }
131
132 public function enableCourseAllocation($a_stat)
133 {
134 $this->course_active = $a_stat;
135 }
136
138 {
140 }
141
142 public function setDefaultCourseCategory($a_def)
143 {
144 $this->default_cat = $a_def;
145 }
146
147 public function getDefaultCourseCategory()
148 {
149 return $this->default_cat;
150 }
151
153 {
154 return $this->allinone;
155 }
156
157 public function enableAllInOne($a_stat)
158 {
159 $this->allinone = $a_stat;
160 }
161
162 public function setAllInOneCategory($a_cat)
163 {
164 $this->allinone_cat = $a_cat;
165 }
166
167 public function getAllInOneCategory()
168 {
169 return $this->allinone_cat;
170 }
171
172 public function enableAttributeMapping($a_stat)
173 {
174 $this->attributes = $a_stat;
175 }
176
178 {
179 return $this->attributes;
180 }
181
182 public function setRoleMappings($a_mappings)
183 {
184 $this->role_mappings = $a_mappings;
185 }
186
187 public function getRoleMappings()
188 {
190 }
191
196 public function setAuthMode($a_auth_mode)
197 {
198 $this->auth_mode = $a_auth_mode;
199 }
200
205 public function getAuthMode()
206 {
207 return $this->auth_mode;
208 }
209
213 public function update()
214 {
215 $this->getStorage()->set('directory_active', (int) $this->isDirectoryMappingEnabled());
216 $this->getStorage()->set('create_empty', $this->isEmptyContainerCreationEnabled());
217 $this->getStorage()->set('course_active', $this->isCourseAllocationEnabled());
218 $this->getStorage()->set('default_category', $this->getDefaultCourseCategory());
219 $this->getStorage()->set('allinone', $this->isAllInOneCategoryEnabled());
220 $this->getStorage()->set('allinone_cat', $this->getAllInOneCategory());
221 $this->getStorage()->set('attributes', $this->isAttributeMappingEnabled());
222 $this->getStorage()->set('role_mappings',serialize($this->getRoleMappings()));
223 $this->getStorage()->set('auth_mode', $this->getAuthMode());
224 return true;
225 }
226
231 protected function getStorage()
232 {
233 return $this->storage;
234 }
235
239 protected function initStorage()
240 {
241 global $ilSetting;
242
243 $this->storage = new ilSetting('ecs_node_mapping_'.$this->getServerId().'_'.$this->getMid());
244 }
245
249 protected function read()
250 {
251 $this->enableDirectoryMapping($this->getStorage()->get('directory_active', $this->directory_active));
252 $this->enableEmptyContainerCreation($this->getStorage()->get('create_empty'),$this->create_empty_containers);
253 $this->enableCourseAllocation($this->getStorage()->get('course_active'),$this->course_active);
254 $this->setDefaultCourseCategory($this->getStorage()->get('default_category'),$this->default_cat);
255 $this->enableAllInOne($this->getStorage()->get('allinone'),$this->allinone);
256 $this->setAllInOneCategory($this->getStorage()->get('allinone_cat'),$this->allinone_cat);
257 $this->enableAttributeMapping($this->getStorage()->get('attributes'),$this->attributes);
258 $this->setRoleMappings(unserialize($this->getStorage()->get('role_mappings')),serialize($this->role_mappings));
259 $this->setAuthMode($this->getStorage()->get('auth_mode', $this->auth_mode));
260 }
261}
262
263?>
An exception for terminatinating execution or to throw for unit testing.
isEmptyContainerCreationEnabled()
Check if the creation of empty containers (pathes without courses) is enabled.
isDirectoryMappingEnabled()
Check if node mapping is enabled.
__construct($a_server_id, $a_mid)
Singeleton constructor.
enableEmptyContainerCreation($a_status)
enable creation of empty containers
enableDirectoryMapping($a_status)
Enable node mapping.
static getInstance()
Get singeleton instance.
getServerId()
Get server id of setting.
setAuthMode($a_auth_mode)
Set user auth mode.
static getInstanceByServerMid($a_server_id, $a_mid)
Get instance.
ILIAS Setting Class.
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
global $ilSetting
Definition: privfeed.php:17