1 <?php
3 class configRegistry{
5 private $properties = array();
7 function __construct(){
8 $this->reload();
9 }
11 function reload()
12 {
13 global $class_mapping;
14 foreach ($class_mapping as $cname => $path){
15 $cmethods = get_class_methods($cname);
16 if (is_array($cmethods) && in_array_ics('plInfo',$cmethods)){
17 $def = call_user_func(array($cname, 'plInfo'));;
18 if(isset($def['plProperties'])){
19 foreach($def['plProperties'] as $property){
20 $this->register(
21 $property['name'],
22 $property['type'],
23 $property['default'],
24 $property['description'],
25 $property['check'],
26 $property['migrate'],
27 $property['mandatory']);
28 }
29 }
30 }
31 }
32 }
34 function register($name,$type,$default,$description,$check,$migrate,$mandatory)
35 {
36 $this->properties[$name] = new gosaProperty($name,$type,$default,$description,$check,$migrate,$mandatory);
37 }
39 function propertyExists($name)
40 {
41 return(isset($this->properties[$name]));
42 }
44 function getProperty($name)
45 {
46 if($this->propertyExists($name)){
47 return($this->properties[$name]);
48 }
49 return(NULL);
50 }
52 function getPropertyValue($name)
53 {
54 if($this->propertyExists($name)){
55 return($this->properties[$name]->getValue());
56 }
57 return("");
58 }
59 }
62 class gosaProperty
63 {
64 protected $name = "";
65 protected $type = "string";
66 protected $default = "";
67 protected $description = "";
68 protected $check = "";
69 protected $migrate = "";
70 protected $mandatory = FALSE;
72 function __construct($name,$type,$default,$description,$check,$migrate,$mandatory)
73 {
74 $this->name = $name;
75 $this->type = $type;
76 $this->default = $default;
77 $this->description = $description;
78 $this->check = $check;
79 $this->migrate = $migrate;
80 $this->mandatory = $mandatory;
81 }
83 function getValue() { return($this->default); }
84 function getName() { return($this->name); }
85 function getType() { return($this->type); }
86 function getDescription() { return($this->description); }
87 function getDefault() { return($this->default); }
89 function isValid()
90 {
91 return(TRUE);
92 }
93 }
95 ?>