1 |
<?php |
<?php |
2 |
|
|
3 |
/** |
/** |
4 |
* This file contains the DesignPattern::MVC class. |
* This file contains the DesignPattern::MVC class |
5 |
* |
* |
6 |
* @author Andreas Motl <andreas.motl@ilo.de> |
* @author Andreas Motl <andreas.motl@ilo.de> |
7 |
* @package org.netfrag.glib |
* @package org.netfrag.glib |
8 |
|
* @name DesignPattern::MVC |
9 |
|
* |
10 |
*/ |
*/ |
11 |
|
|
12 |
/** |
/** |
13 |
* $Id$ |
* $Id$ |
14 |
* |
* |
15 |
* $Log$ |
* $Log$ |
16 |
|
* Revision 1.8 2003/03/05 16:10:17 joko |
17 |
|
* updated docu (phpDocumentor testing....) |
18 |
|
* |
19 |
|
* Revision 1.7 2003/03/05 15:41:03 joko |
20 |
|
* updated docu (phpDocumentor testing....) |
21 |
|
* |
22 |
|
* Revision 1.6 2003/03/05 15:24:23 joko |
23 |
|
* updated docu (phpDocumentor testing....) |
24 |
|
* |
25 |
|
* Revision 1.5 2003/03/03 21:57:42 joko |
26 |
|
* changed base class |
27 |
|
* |
28 |
* Revision 1.4 2003/03/01 22:44:54 joko |
* Revision 1.4 2003/03/01 22:44:54 joko |
29 |
* setup_views not required? |
* setup_views not required? |
30 |
* |
* |
32 |
* now actually doing something via '->perform' |
* now actually doing something via '->perform' |
33 |
* |
* |
34 |
* Revision 1.2 2003/03/01 16:53:57 joko |
* Revision 1.2 2003/03/01 16:53:57 joko |
35 |
* + now propagating/forwarding passed-in data to add_[model|view|controller] to base class method DesignPattern::Container::__push_element to store it |
* + now propagating/forwarding passed-in data to add_[model|view|controller] to base class method DesignPattern::Container::push_element to store it |
36 |
* is this a case for aspect-oriented-programming? |
* is this a case for aspect-oriented-programming? |
37 |
* - removed calls to _abstract_method |
* - removed calls to _abstract_method |
38 |
* |
* |
44 |
|
|
45 |
|
|
46 |
/** |
/** |
47 |
* This tries to abstract some parts of the MVC Pattern. |
* This tries to abstract some parts of the MVC Pattern |
|
* |
|
48 |
* |
* |
49 |
* @author Andreas Motl <andreas.motl@ilo.de> |
* @author Andreas Motl <andreas.motl@ilo.de> |
50 |
|
* @link http://www.netfrag.org/~joko/ |
51 |
* @copyright (c) 2003 - All Rights reserved. |
* @copyright (c) 2003 - All Rights reserved. |
52 |
* @license GNU LGPL (GNU Lesser General Public License) |
* @license GNU LGPL (GNU Lesser General Public License) |
53 |
* |
* @link http://www.gnu.org/licenses/lgpl.txt |
|
* @author-url http://www.netfrag.org/~joko/ |
|
|
* @license-url http://www.gnu.org/licenses/lgpl.txt |
|
54 |
* |
* |
55 |
* @package org.netfrag.glib |
* @package org.netfrag.glib |
56 |
* @module Application::ComponentRegistry |
* @name DesignPattern::MVC |
57 |
|
* @filesource |
58 |
* |
* |
59 |
*/ |
*/ |
60 |
|
|
61 |
/** |
/** |
62 |
* Todo: |
* @todo xyz |
63 |
* |
* @todo bla, bli, blub |
|
* o xyz |
|
|
* o bla, bli, blub |
|
64 |
* |
* |
65 |
* |
* |
66 |
*/ |
*/ |
67 |
|
|
68 |
|
|
69 |
// isn't required by now: |
class DesignPattern_MVC extends DesignPattern_Facade { |
|
//loadModule('DesignPattern::Object'); |
|
|
//class DesignPattern_MVC extends DesignPattern_Object { |
|
|
|
|
|
loadModule('DesignPattern::Container'); |
|
|
class DesignPattern_MVC extends DesignPattern_Container { |
|
70 |
|
|
71 |
var $_model = array(); |
var $_model = array(); |
72 |
var $_view = array(); |
var $_view = array(); |
81 |
* |
* |
82 |
* @param registry |
* @param registry |
83 |
*/ |
*/ |
84 |
function DesignPattern_MVC() { |
function constructor() { |
85 |
|
parent::constructor(); |
86 |
} |
} |
87 |
|
|
88 |
function _abstract_method($method) { |
function _abstract_method($method) { |
131 |
function setup_views() { |
function setup_views() { |
132 |
//$this->_abstract_method('setup_views'); |
//$this->_abstract_method('setup_views'); |
133 |
} |
} |
134 |
|
|
135 |
|
|
136 |
function add_model() { |
function add_model() { |
137 |
$args = &func_get_args(); |
$args = &func_get_args(); |
138 |
$this->__push('model', &$args[0]); |
$this->_container->push('model', &$args[0]); |
139 |
} |
} |
140 |
|
|
141 |
function add_view() { |
function add_view() { |
142 |
$args = &func_get_args(); |
$args = &func_get_args(); |
143 |
$this->__push('view', &$args[0]); |
$this->_container->push('view', &$args[0]); |
144 |
} |
} |
145 |
|
|
146 |
function add_controller() { |
function add_controller() { |
147 |
$args = &func_get_args(); |
$args = &func_get_args(); |
148 |
$this->__push('controller', &$args[0]); |
$this->_container->push('controller', &$args[0]); |
149 |
} |
} |
150 |
|
|
151 |
function &get_model_data() { |
function &get_model_data() { |
152 |
return $this->__last('model'); |
return $this->_container->last('model'); |
153 |
} |
} |
154 |
|
|
155 |
function &get_view_data() { |
function &get_view_data() { |
156 |
$args = &func_get_args(); |
$args = &func_get_args(); |
157 |
$slot = $args[0]; |
$slot = $args[0]; |
158 |
return $this->__slot('view', $slot); |
return $this->_container->slot('view', $slot); |
159 |
} |
} |
160 |
|
|
161 |
function &get_controller_data() { |
function &get_controller_data() { |
162 |
return $this->__last('controller'); |
return $this->_container->last('controller'); |
163 |
} |
} |
164 |
|
|
165 |
} |
} |