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