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