1 |
<? |
2 |
/** |
3 |
* This file contains the abstract MVCPage class. |
4 |
* It inherits from phpHtmlLib's abstract PageWidget |
5 |
* class to seamlessly integrate into its render queue. |
6 |
* |
7 |
* @author Andreas Motl <andreas.motl@ilo.de> |
8 |
* @package org.netfrag.glib |
9 |
* @name Site::WebBlock |
10 |
* |
11 |
*/ |
12 |
|
13 |
/** |
14 |
* <pre> |
15 |
* |
16 |
* $Id: WebBlock.php,v 1.3 2003/03/10 01:05:07 joko Exp $ |
17 |
* |
18 |
* $Log: WebBlock.php,v $ |
19 |
* Revision 1.3 2003/03/10 01:05:07 joko |
20 |
* + additional metadata for Autodia |
21 |
* |
22 |
* Revision 1.2 2003/03/05 18:54:45 joko |
23 |
* updated docu - phpDocumentor is very strict about its 'blocks'... |
24 |
* |
25 |
* Revision 1.1 2003/03/05 12:18:47 joko |
26 |
* from GenericPage.php |
27 |
* |
28 |
* Revision 1.1 2003/03/03 22:11:59 joko |
29 |
* + initial commit |
30 |
* |
31 |
* <pre> |
32 |
*/ |
33 |
|
34 |
|
35 |
/** |
36 |
* Make sure we have the required parent class |
37 |
*/ |
38 |
//class Site_WebPageMVC extends PageWidget { |
39 |
//loadModule('DesignPattern::MVC'); |
40 |
//class Site_GenericPage extends DesignPattern_MVC { |
41 |
//loadModule('DesignPattern::Proxy'); |
42 |
loadModule('DesignPattern::TransparentProxy'); |
43 |
|
44 |
|
45 |
/** |
46 |
* This class is used to build content |
47 |
* for an MVC controlled page. It instantiates |
48 |
* an concrete helper MVC object which does the |
49 |
* dispatching stuff. (phpHtmlLib::controller::WebMVC, |
50 |
* inherited from the abstract DesignPattern::MVC) |
51 |
* |
52 |
* This class is established here to act as a wrapper |
53 |
* bringing MVC and phpHtmlLib together. |
54 |
* |
55 |
* By now we inherit from the PageWidget, but this has |
56 |
* to be broken using the ProxyPattern or s.th.l.th. |
57 |
* I guess we'll have to dispatch to arbitrary concrete |
58 |
* Page-implementations here in future... |
59 |
* |
60 |
* @author Andreas Motl <andreas.motl@ilo.de> |
61 |
* @package org.netfrag.glib |
62 |
* @subpackage Site |
63 |
* @name Site::WebBlock |
64 |
* |
65 |
* @todo x phpHtmlLib::PageWidget-Adapter |
66 |
* @todo o php-include-file-Adapter |
67 |
* |
68 |
*/ |
69 |
//class Site_GenericPage extends DesignPattern_Proxy { |
70 |
class Site_WebBlock extends DesignPattern_TransparentProxy { |
71 |
|
72 |
/* |
73 |
var $_controller_module; |
74 |
var $_controller; |
75 |
*/ |
76 |
|
77 |
var $_page; |
78 |
|
79 |
|
80 |
function call_handler() { |
81 |
//print Dumper(func_get_args()); |
82 |
//print Dumper($this); |
83 |
//exit; |
84 |
//$this->make_handler_transparent(); |
85 |
} |
86 |
|
87 |
/* |
88 |
function @render() { |
89 |
print "render!<br/>"; |
90 |
} |
91 |
*/ |
92 |
|
93 |
//function MVCPage($title, $render_type = HTML, $ub_view = 'UB_LIST') { |
94 |
function Site_WebBlock(&$args) { |
95 |
|
96 |
//print("<h1>Site::GenericPage!</h1><br/>"); |
97 |
|
98 |
if (!$args[adapter]) { |
99 |
user_error("Please specify adapter in constructor or s.th.l.th."); |
100 |
//$args[type] = 'Page::Overview'; |
101 |
return; |
102 |
} |
103 |
|
104 |
// merge args to object attributes |
105 |
// FIXME!!! |
106 |
//$this->merge_args($args); |
107 |
|
108 |
/** |
109 |
* <!-- Autodia --> |
110 |
* can do: (this is metadata supplied for Autodia, don't delete!) |
111 |
* $proxy = new Site_Adapter_phpHtmlLib_PageWidget() |
112 |
* $proxy = new Site_Adapter_php_IncludeFile() |
113 |
* $proxy = new Site_Adapter_php_Class() |
114 |
* $proxy = new Site_Adapter_php_Object() |
115 |
* |
116 |
*/ |
117 |
|
118 |
// --- Proxy selector (an Adapter acts as a Proxy here to get transparent....) |
119 |
|
120 |
switch ($args[adapter]) { |
121 |
case 'phpHtmlLib': |
122 |
$this->_component_name = 'Site::Adapter::phpHtmlLib::PageWidget'; |
123 |
$this->_component_options[title] = $args[title]; |
124 |
break; |
125 |
case 'php_file': |
126 |
$this->_component_name = 'Site::Adapter::php::IncludeFile'; |
127 |
$this->_component_options = $args['block']; |
128 |
break; |
129 |
case 'php_class': |
130 |
$this->_component_name = 'Site::Adapter::php::Class'; |
131 |
$this->_component_options = $args['block']; |
132 |
break; |
133 |
case 'php_object': |
134 |
$this->_component_name = 'Site::Adapter::php::Object'; |
135 |
$this->_component_options = $args['block']; |
136 |
break; |
137 |
default: |
138 |
user_error("Site::GenericPage: no component selected!"); |
139 |
break; |
140 |
} |
141 |
|
142 |
|
143 |
//parent::constructor(); |
144 |
//exit; |
145 |
|
146 |
// test transparency here |
147 |
$test_before = 0; |
148 |
$test_after = 0; |
149 |
|
150 |
$this->create_proxy(); |
151 |
|
152 |
if ($test_before) { |
153 |
if ($this->_component_name == 'Site::Adapter::php::Class') { |
154 |
print "before:<br/>" . Dumper($this); |
155 |
} |
156 |
} |
157 |
|
158 |
$this->make_transparent(); |
159 |
|
160 |
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
161 |
// this code isn't executed any more since transparency occours above!!!! |
162 |
|
163 |
if ($test_after) { |
164 |
if ($this->_component_name == 'Site::Adapter::php::Class') { |
165 |
print "after:<br/>" . Dumper($this); |
166 |
} |
167 |
} |
168 |
|
169 |
//print Dumper($this); |
170 |
//exit; |
171 |
|
172 |
//return $this; |
173 |
|
174 |
} |
175 |
|
176 |
//switch ($thi |
177 |
|
178 |
/* |
179 |
|
180 |
// create controller instance |
181 |
$this->create_controller_instance(); |
182 |
|
183 |
// trace |
184 |
//print Dumper($this->_controller); |
185 |
//exit; |
186 |
|
187 |
// propagate phpHtmlLib page widget arguments: |
188 |
// - title: The title of the page |
189 |
// - render_type: An identifier specifying the output type: |
190 |
// used by now: HTML (possible: WML|SVG, i guess...? XML|DHTML also...?) |
191 |
$title = $args[title]; |
192 |
$render_type = $args[render_type]; |
193 |
$parent = get_parent_class($this); |
194 |
$this->$parent($title, $render_type); |
195 |
*/ |
196 |
|
197 |
|
198 |
|
199 |
/* |
200 |
function @old_create_controller_instance() { |
201 |
// V1: |
202 |
//$this->_controller = mkObject('ExplorerController.inc'); |
203 |
|
204 |
// V2: |
205 |
//loadModule('widgets/explorer/modules/ExplorerController', 'inc'); |
206 |
//$this->_controller = mkObject('ExplorerController'); |
207 |
|
208 |
// V3: (now being completely abstract here...) |
209 |
$this->_controller = mkObject($this->_controller_module); |
210 |
} |
211 |
*/ |
212 |
|
213 |
} |
214 |
|
215 |
?> |