| 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.7 2003/03/05 15:41:03 joko |
| 17 |
|
* updated docu (phpDocumentor testing....) |
| 18 |
|
* |
| 19 |
|
* Revision 1.6 2003/03/05 15:24:23 joko |
| 20 |
|
* updated docu (phpDocumentor testing....) |
| 21 |
|
* |
| 22 |
|
* Revision 1.5 2003/03/03 21:57:42 joko |
| 23 |
|
* changed base class |
| 24 |
|
* |
| 25 |
|
* Revision 1.4 2003/03/01 22:44:54 joko |
| 26 |
|
* setup_views not required? |
| 27 |
|
* |
| 28 |
* Revision 1.3 2003/03/01 21:13:00 joko |
* Revision 1.3 2003/03/01 21:13:00 joko |
| 29 |
* now actually doing something via '->perform' |
* now actually doing something via '->perform' |
| 30 |
* |
* |
| 31 |
* Revision 1.2 2003/03/01 16:53:57 joko |
* Revision 1.2 2003/03/01 16:53:57 joko |
| 32 |
* + 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 |
| 33 |
* is this a case for aspect-oriented-programming? |
* is this a case for aspect-oriented-programming? |
| 34 |
* - removed calls to _abstract_method |
* - removed calls to _abstract_method |
| 35 |
* |
* |
| 43 |
/** |
/** |
| 44 |
* This tries to abstract some parts of the MVC Pattern. |
* This tries to abstract some parts of the MVC Pattern. |
| 45 |
* |
* |
|
* |
|
| 46 |
* @author Andreas Motl <andreas.motl@ilo.de> |
* @author Andreas Motl <andreas.motl@ilo.de> |
| 47 |
|
* @link http://www.netfrag.org/~joko/ |
| 48 |
* @copyright (c) 2003 - All Rights reserved. |
* @copyright (c) 2003 - All Rights reserved. |
| 49 |
* @license GNU LGPL (GNU Lesser General Public License) |
* @license GNU LGPL (GNU Lesser General Public License) |
| 50 |
* |
* @link http://www.gnu.org/licenses/lgpl.txt |
|
* @author-url http://www.netfrag.org/~joko/ |
|
|
* @license-url http://www.gnu.org/licenses/lgpl.txt |
|
| 51 |
* |
* |
| 52 |
* @package org.netfrag.glib |
* @package org.netfrag.glib |
| 53 |
* @module Application::ComponentRegistry |
* @name DesignPattern::MVC |
| 54 |
* |
* |
| 55 |
*/ |
*/ |
| 56 |
|
|
| 57 |
/** |
/** |
| 58 |
* Todo: |
* @todo xyz |
| 59 |
* |
* @todo bla, bli, blub |
|
* o xyz |
|
|
* o bla, bli, blub |
|
| 60 |
* |
* |
| 61 |
* |
* |
| 62 |
*/ |
*/ |
| 63 |
|
|
| 64 |
|
|
| 65 |
// 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 { |
|
| 66 |
|
|
| 67 |
var $_model = array(); |
var $_model = array(); |
| 68 |
var $_view = array(); |
var $_view = array(); |
| 77 |
* |
* |
| 78 |
* @param registry |
* @param registry |
| 79 |
*/ |
*/ |
| 80 |
function DesignPattern_MVC() { |
function constructor() { |
| 81 |
|
parent::constructor(); |
| 82 |
} |
} |
| 83 |
|
|
| 84 |
function _abstract_method($method) { |
function _abstract_method($method) { |
| 125 |
} |
} |
| 126 |
|
|
| 127 |
function setup_views() { |
function setup_views() { |
| 128 |
$this->_abstract_method('setup_views'); |
//$this->_abstract_method('setup_views'); |
| 129 |
} |
} |
| 130 |
|
|
| 131 |
|
|
| 132 |
function add_model() { |
function add_model() { |
| 133 |
$args = &func_get_args(); |
$args = &func_get_args(); |
| 134 |
$this->__push('model', &$args[0]); |
$this->_container->push('model', &$args[0]); |
| 135 |
} |
} |
| 136 |
|
|
| 137 |
function add_view() { |
function add_view() { |
| 138 |
$args = &func_get_args(); |
$args = &func_get_args(); |
| 139 |
$this->__push('view', &$args[0]); |
$this->_container->push('view', &$args[0]); |
| 140 |
} |
} |
| 141 |
|
|
| 142 |
function add_controller() { |
function add_controller() { |
| 143 |
$args = &func_get_args(); |
$args = &func_get_args(); |
| 144 |
$this->__push('controller', &$args[0]); |
$this->_container->push('controller', &$args[0]); |
| 145 |
} |
} |
| 146 |
|
|
| 147 |
function &get_model_data() { |
function &get_model_data() { |
| 148 |
return $this->__last('model'); |
return $this->_container->last('model'); |
| 149 |
} |
} |
| 150 |
|
|
| 151 |
function &get_view_data() { |
function &get_view_data() { |
| 152 |
$args = &func_get_args(); |
$args = &func_get_args(); |
| 153 |
$slot = $args[0]; |
$slot = $args[0]; |
| 154 |
return $this->__slot('view', $slot); |
return $this->_container->slot('view', $slot); |
| 155 |
} |
} |
| 156 |
|
|
| 157 |
function &get_controller_data() { |
function &get_controller_data() { |
| 158 |
return $this->__last('controller'); |
return $this->_container->last('controller'); |
| 159 |
} |
} |
| 160 |
|
|
| 161 |
} |
} |