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