3 |
// $Id$ |
// $Id$ |
4 |
// --------------------------------------------------------------------------- |
// --------------------------------------------------------------------------- |
5 |
// $Log$ |
// $Log$ |
6 |
|
// Revision 1.4 2003/03/03 21:11:01 joko |
7 |
|
// mungled the namespaces |
8 |
|
// |
9 |
|
// Revision 1.3 2003/02/09 17:05:15 joko |
10 |
|
// + minor update related to new log level constants |
11 |
|
// + restructured get-/setter methods |
12 |
|
// |
13 |
// Revision 1.2 2003/02/03 14:42:28 joko |
// Revision 1.2 2003/02/03 14:42:28 joko |
14 |
// + logging (LOG_DEBUG) |
// + added logging |
15 |
// + methods for accessing configuration variables |
// + methods for accessing configuration variables |
16 |
// |
// |
17 |
// Revision 1.1 2003/02/03 05:00:01 joko |
// Revision 1.1 2003/02/03 05:00:01 joko |
54 |
|
|
55 |
*/ |
*/ |
56 |
|
|
57 |
|
loadModule('Class::Logger'); |
58 |
|
|
59 |
class Application_Core extends DesignPattern_Logger { |
class Application_Core extends Class_Logger { |
60 |
|
|
61 |
var $_config; |
var $_config; |
62 |
|
|
69 |
|
|
70 |
parent::constructor(); |
parent::constructor(); |
71 |
|
|
72 |
$this->log(get_class($this) . "->run: begin", LOG_INFO); |
$this->log("-----------------------------------------------------------------", PEAR_LOG_INFO); |
73 |
|
$this->log(get_class($this) . "->run: begin", PEAR_LOG_INFO); |
74 |
|
|
75 |
$cfg = $this->getConfig(); |
$cfg = $this->getConfig(); |
76 |
|
|
93 |
// run procedural functions |
// run procedural functions |
94 |
if (is_array($container[methods])) { |
if (is_array($container[methods])) { |
95 |
foreach ($container[methods] as $method) { |
foreach ($container[methods] as $method) { |
96 |
$this->log(get_class($this) . "->run: calling function in global namespace: '$method'", LOG_DEBUG); |
$this->log(get_class($this) . "->run: calling function in global namespace: '$method'", PEAR_LOG_DEBUG); |
97 |
call_user_func($method); |
call_user_func($method); |
98 |
} |
} |
99 |
} |
} |
100 |
|
|
101 |
} |
} |
102 |
|
|
103 |
$this->log(get_class($this) . "->run: end", LOG_INFO); |
$this->log(get_class($this) . "->run: end", PEAR_LOG_INFO); |
104 |
|
|
105 |
} |
} |
106 |
|
|
107 |
function getConfig($var = null) { |
function getConfig($var = null) { |
108 |
return $this->_config->getPart($var); |
return $this->_config->get($var); |
109 |
} |
} |
110 |
|
|
111 |
function _require_once_isolated($file) { |
function _require_once_isolated($file) { |
112 |
$this->log(get_class($this) . "->_require_once_isolated: $file", LOG_DEBUG); |
$this->log(get_class($this) . "->_require_once_isolated: $file", PEAR_LOG_DEBUG); |
113 |
if (require_once($file)) { |
if (require_once($file)) { |
114 |
return 1; |
return 1; |
115 |
} |
} |
117 |
|
|
118 |
function setConfigVar($var, $val) { |
function setConfigVar($var, $val) { |
119 |
//print "$var=$val<br>"; |
//print "$var=$val<br>"; |
120 |
$this->_config->setVar($var, $val); |
$this->_config->set_absolute($var, $val); |
121 |
} |
} |
122 |
|
|
123 |
function getConfigVar($var) { |
function getConfigVar($var) { |
124 |
return $this->_config->getVar($var); |
return $this->_config->get_absolute($var); |
125 |
} |
} |
126 |
|
|
127 |
} |
} |