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