34 return print_r($this->vars,
true);
45 foreach($this->vars as $k=>&$v) {
48 foreach($v as $kk=>&$vv)
50 $err =
'Config: Need '.$k.
'->'.$kk.
' Parameter.';
52 $err =
'Config: Need '.$k.
' Parameter.';
70 public function init(array $prm) {
71 foreach($prm as $k=>$v) {
72 if (is_null($v) && (!array_key_exists($k, $this->vars) || is_null($this->vars[$k])))
73 throw new nException(
'Config: Need '.$k.
' Parameter.');
75 if (array_key_exists($k, $this->vars)) {
76 if (is_null($this->vars[$k]))
78 else if (is_array($this->vars[$k]) && is_array($v))
92 foreach($prm as $k=>$v) {
93 if (!array_key_exists($k, $this->vars))
94 $this->vars[$k] = array();
96 if (is_array($this->vars[$k]))
98 foreach($v as $kk=>$vv) {
100 $this->vars[$k][] = $vv;
101 else if (!array_key_exists($kk))
102 $this->vars[$k][$kk] = $vv;
105 $this->vars[$k][] = $v;
116 public function overload($className, $parent=
false) {
136 public function get($name) {
137 if ($this->
check($name))
138 return $this->vars[$name];
151 if ($this->
check($name) && is_array($this->vars[$name]) && array_key_exists($key, $this->vars[$name]))
152 return $this->vars[$name][$key];
164 return $this->
get($name);
175 if ($this->
check($name))
176 return $this->vars[$name];
199 foreach($vars as $k=>$v)
210 foreach($vars as $k=>&$v)
221 public function set($name, $val) {
222 $this->vars[$name] = $val;
234 $this->vars[$name][$key] = $val;
245 $this->vars[$name] = array_merge($this->vars[$name], $values);
256 $this->vars[$name] = &$val;
266 public function __set($name, $val) {
267 $this->
set($name, $val);
277 return array_key_exists($name, $this->vars);
288 return array_key_exists($name, $this->vars) && is_array($this->vars[$name]) && array_key_exists($key, $this->vars[$name]);
299 return $this->
check($name);
307 public function del($name) {
308 if ($this->
check($name))
309 unset($this->vars[$name]);
319 if ($this->
check($name) && is_array($this->vars[$name]) && array_key_exists($key, $this->vars[$name]))
320 unset($this->vars[$name][$key]);
344 foreach($init as $k=>&$v) {
345 if (!array_key_exists($k,$vars)) {
362 public static function initTabNum(array &
$vars, array $varsNum, $nameOther=
'other', $rtl=
true) {
363 if (!empty($vars) && !empty($varsNum)) {
364 $nbvars = count($vars);
365 $nbvarsNum = count($varsNum);
366 if ($nbvars < $nbvarsNum)
367 array_splice($varsNum, $nbvars);
368 else if ($nbvars > $nbvarsNum) {
370 for($i=$nbvarsNum; $i<$nbvars; $i++)
371 $tmp[] = $nameOther.round($i-$nbvarsNum+1);
373 $varsNum = array_merge($varsNum, $tmp);
375 $varsNum = array_merge($tmp, $varsNum);
377 $vars = array_combine($varsNum, $vars);
static initTab(array &$vars, array $init)
overload($className, $parent=false)
__construct(array $prm=array())
setInArrayA($name, array $values)
static loadCfg($className, $searchParent=true)
static mergeCfg(array &$prm, array $cfg)
setInArray($name, $key, $val)
static initTabNum(array &$vars, array $varsNum, $nameOther='other', $rtl=true)
checkInArray($name, $key)