/[cvs]/nfo/php/libs/org.netfrag.glib/Application/Config.php
ViewVC logotype

Diff of /nfo/php/libs/org.netfrag.glib/Application/Config.php

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.1 by joko, Mon Feb 3 03:51:36 2003 UTC revision 1.3 by joko, Mon Feb 3 14:41:21 2003 UTC
# Line 3  Line 3 
3  //  $Id$  //  $Id$
4  // ---------------------------------------------------------------------------  // ---------------------------------------------------------------------------
5  //  $Log$  //  $Log$
6    //  Revision 1.3  2003/02/03 14:41:21  joko
7    //  + get- and set-methods to access configuration variables
8    //  + recursive merging mechanism
9    //
10    //  Revision 1.2  2003/02/03 04:59:29  joko
11    //  + fixed: constructor can now get passed variable of *any type*
12    //
13  //  Revision 1.1  2003/02/03 03:51:36  joko  //  Revision 1.1  2003/02/03 03:51:36  joko
14  //  + initial commit  //  + initial commit
15  //  //
# Line 11  Line 18 
18    
19  /*  /*
20    
21    How to use this?    ------------------------------------------------------------
22        How to use this?
23      ------------------------------------------------------------
24    
25      require_once("../etc/defaults.php");      require_once("../etc/defaults.php");
26      require_once("../etc/includes.php");      require_once("../etc/includes.php");
# Line 19  Line 28 
28      $appConfig = mkObject('Application::Config');      $appConfig = mkObject('Application::Config');
29      print "appConfig:<br/>" . Dumper($appConfig) . "<hr/>";      print "appConfig:<br/>" . Dumper($appConfig) . "<hr/>";
30    
31      ------------------------------------------------------------
32    
33  */  */
34    
35    
36  class Application_Config {  class Application_Config {
37    function Application_Config($initCfg = array()) {    
38      print "Hello World!<hr/>";    var $_store;
39      print "initCfg:<br/>" . Dumper($initCfg) . "<hr/>";    
40      function Application_Config($initCfg = null) {
41        //print "Hello World!<hr/>";
42        //print "initCfg:<br/>" . Dumper($initCfg) . "<hr/>";
43        $this->_store = $initCfg;
44      }
45      
46      function merge() {
47        //$this->_store[run] = array_merge($this->_store['default'], $this->_store['init']);
48        foreach ($this->_store[_init][configkeys] as $configKey) {
49          //$this->_store[runtime] = array_merge($this->_store[runtime], $this->_store[$configKey]);
50          //$this->_store[runtime] = array_merge_recursive($this->_store[runtime], $this->_store[$configKey]);
51          $this->_store[runtime] = array_join_merge($this->_store[runtime], $this->_store[$configKey]);
52        }
53        //print Dumper($this);
54      }
55      
56      function getPart($var = null) {
57        //$this->merge();
58        if ($var) {
59          return $this->getVar("runtime.$var");
60        } else {
61          return $this->getVar("runtime");
62        }
63      }
64      
65      function setVar($var, $val) {
66        //$this->_store[runtime][$var] = $val;
67        //$deep = new Data_Deep($this->_store[runtime]);
68        $deep = new Data_Deep($this->_store);
69        $deep->set($var, $val);
70      }
71      
72      function getVar($var) {
73        //$this->_store[runtime][$var] = $val;
74        //$deep = new Data_Deep($this->_store[runtime]);
75        $deep = new Data_Deep($this->_store);
76        return $deep->get($var);
77    }    }
78      
79  }  }
80    
81  ?>  ?>

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.3

MailToCvsAdmin">MailToCvsAdmin
ViewVC Help
Powered by ViewVC 1.1.26 RSS 2.0 feed