11 |
* $Id$ |
* $Id$ |
12 |
* |
* |
13 |
* $Log$ |
* $Log$ |
14 |
|
* Revision 1.2 2003/03/01 16:53:57 joko |
15 |
|
* + now propagating/forwarding passed-in data to add_[model|view|controller] to base class method DesignPattern::Container::__add_entity to store it |
16 |
|
* is this a case for aspect-oriented-programming? |
17 |
|
* - removed calls to _abstract_method |
18 |
|
* |
19 |
* Revision 1.1 2003/03/01 15:31:18 joko |
* Revision 1.1 2003/03/01 15:31:18 joko |
20 |
* + initial commit |
* + initial commit |
21 |
* |
* |
24 |
|
|
25 |
|
|
26 |
/** |
/** |
27 |
* This tries to implement some parts of the MVC Model. |
* This tries to abstract some parts of the MVC Pattern. |
28 |
* |
* |
29 |
* |
* |
30 |
* @author Andreas Motl <andreas.motl@ilo.de> |
* @author Andreas Motl <andreas.motl@ilo.de> |
53 |
//loadModule('DesignPattern::Object'); |
//loadModule('DesignPattern::Object'); |
54 |
//class DesignPattern_MVC extends DesignPattern_Object { |
//class DesignPattern_MVC extends DesignPattern_Object { |
55 |
|
|
56 |
class DesignPattern_MVC { |
loadModule('DesignPattern::Container'); |
57 |
|
class DesignPattern_MVC extends DesignPattern_Container { |
58 |
|
|
59 |
var $_model = NULL; |
var $_model = NULL; |
60 |
var $_view = NULL; |
var $_view = NULL; |
71 |
} |
} |
72 |
|
|
73 |
function _abstract_method($method) { |
function _abstract_method($method) { |
74 |
print "Please implement code inside '$method'.<br/>"; |
$package = get_class($this); |
75 |
|
print "$package: Please implement method '$method'.<br/>"; |
76 |
} |
} |
77 |
|
|
78 |
|
|
79 |
|
|
80 |
function add_model() { |
function add_model() { |
81 |
$this->_abstract_method('add_model'); |
$args = &func_get_args(); |
82 |
|
$this->__add_entity('model', &$args); |
83 |
} |
} |
84 |
|
|
85 |
function add_view() { |
function add_view() { |
86 |
$this->_abstract_method('add_view'); |
$args = &func_get_args(); |
87 |
|
$this->__add_entity('view', &$args); |
88 |
} |
} |
89 |
|
|
90 |
function add_controller() { |
function add_controller() { |
91 |
$this->_abstract_method('add_controller'); |
$args = &func_get_args(); |
92 |
|
$this->__add_entity('controller', &$args); |
93 |
} |
} |
94 |
|
|
95 |
function setup_views() { |
function setup_views() { |