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