1 |
<?php |
2 |
/** |
3 |
* This file contains the Application::ComponentRegistry class. |
4 |
* |
5 |
* @author Andreas Motl <andreas.motl@ilo.de> |
6 |
* @package org.netfrag.glib |
7 |
* @name Application::ComponentRegistry |
8 |
* |
9 |
*/ |
10 |
|
11 |
/** |
12 |
* <b>Cvs-Log:</b> |
13 |
* |
14 |
* <pre> |
15 |
* $Id: ComponentRegistry.php,v 1.5 2003/03/11 01:42:57 joko Exp $ |
16 |
* |
17 |
* $Log: ComponentRegistry.php,v $ |
18 |
* Revision 1.5 2003/03/11 01:42:57 joko |
19 |
* + fixed metadata for phpDocumentor |
20 |
* |
21 |
* Revision 1.4 2003/03/11 01:22:22 joko |
22 |
* + fixed metadata for phpDocumentor |
23 |
* |
24 |
* Revision 1.3 2003/03/10 23:25:02 joko |
25 |
* + fixed metadata for phpDocumentor |
26 |
* |
27 |
* Revision 1.2 2003/03/05 18:54:42 joko |
28 |
* updated docu - phpDocumentor is very strict about its 'blocks'... |
29 |
* |
30 |
* Revision 1.1 2003/03/01 15:29:11 joko |
31 |
* + initial commit |
32 |
* </pre> |
33 |
* |
34 |
*/ |
35 |
|
36 |
|
37 |
/** |
38 |
* This provides an infrastructure for having |
39 |
* components to be registered with. |
40 |
* |
41 |
* These components could be something which make up |
42 |
* parts, areas or pages on a large website (the level above |
43 |
* the widget-layer) or just simple plugins or shared code. |
44 |
* (similar to m$'s dll/com-system, but very lightweight) |
45 |
* |
46 |
* Currently, we are registering "Views" with this thing. |
47 |
* These "Views" should represent the "Views" in the MVC Model. |
48 |
* "Views" are components made up of phpHtmlLib widgets. |
49 |
* |
50 |
* They currently live in the "Page::" namespace, which should be |
51 |
* migrated to the "View::" namespace to actually represent this |
52 |
* stuff conveniently 1:1 in userspace. |
53 |
* |
54 |
* <ul> |
55 |
* references |
56 |
* <li>package=org.netfrag.glib, module=DesignPattern::MVC</li> |
57 |
* <li>package=lib.admin.frontend, module=TsBackend: $this->_mvc->add_view( ... )</li> |
58 |
* </ul> |
59 |
* |
60 |
* |
61 |
* @author Andreas Motl <andreas.motl@ilo.de> |
62 |
* @copyright (c) 2003 - All Rights reserved. |
63 |
* @license GNU LGPL (GNU Lesser General Public License) |
64 |
* |
65 |
* @link http://www.netfrag.org/~joko/ |
66 |
* @link http://www.gnu.org/licenses/lgpl.txt |
67 |
* |
68 |
* @package org.netfrag.glib |
69 |
* @subpackage Application |
70 |
* @name Application::ComponentRegistry |
71 |
* |
72 |
* @todo (o) Be able to *persistently* register new components. |
73 |
* By now the declaration (read-only) is included on each request. |
74 |
* No caching or similar stuff occours at this level!!! |
75 |
* |
76 |
*/ |
77 |
class Application_ComponentRegistry { |
78 |
|
79 |
/** |
80 |
* This var holds the locator metadata hash |
81 |
* that is used to feed metadata to a per-query-instance |
82 |
* of a Data::Driver::Proxy object. |
83 |
* |
84 |
*/ |
85 |
var $_regdb = NULL; |
86 |
|
87 |
var $_registry = NULL; |
88 |
var $_mode = NULL; |
89 |
|
90 |
|
91 |
/** |
92 |
* The constructor may be used to pass in the |
93 |
* complete registry as a payload chunk. |
94 |
* |
95 |
* @param registry |
96 |
*/ |
97 |
function Application_ComponentRegistry($registry = null, $mode = null) { |
98 |
|
99 |
$this->_registry = &$registry; |
100 |
|
101 |
if ($mode) { |
102 |
$this->set_mode($mode); |
103 |
|
104 |
// autodetect mode |
105 |
} else { |
106 |
|
107 |
if ($registry) { |
108 |
$this->set_mode('REGDB_PAYLOAD'); |
109 |
} else { |
110 |
$this->set_mode('REGDB_CONSTANT'); |
111 |
} |
112 |
|
113 |
} |
114 |
|
115 |
$this->read_regdb(); |
116 |
|
117 |
} |
118 |
|
119 |
function set_mode( $mode ) { |
120 |
$this->_mode = $mode; |
121 |
return $this->_mode; |
122 |
} |
123 |
|
124 |
function get_mode() { |
125 |
return $this->_mode; |
126 |
} |
127 |
|
128 |
function read_regdb() { |
129 |
switch ($this->get_mode()) { |
130 |
case 'REGDB_LOCAL': |
131 |
$this->_regdb = &$this->_registry; |
132 |
break; |
133 |
case 'REGDB_CONSTANT': |
134 |
$this->_regdb = COMPONENT_regdb; |
135 |
break; |
136 |
} |
137 |
|
138 |
} |
139 |
|
140 |
function getComponentByTopic($name) { |
141 |
|
142 |
} |
143 |
|
144 |
function getComponentByPage($name) { |
145 |
|
146 |
} |
147 |
|
148 |
|
149 |
} |
150 |
|
151 |
?> |