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