| 1 | <? | 
| 2 | /** | 
| 3 | * This file contains the abstract MVCPage class. | 
| 4 | * It inherits from phpHtmlLib's abstract PageWidget | 
| 5 | * class to seamlessly integrate into its render queue. | 
| 6 | * | 
| 7 | * @author Andreas Motl <andreas.motl@ilo.de> | 
| 8 | * @package phpHtmlLib | 
| 9 | * @module MVCPage | 
| 10 | * | 
| 11 | */ | 
| 12 |  | 
| 13 | /** | 
| 14 | * $Id: IncludeFile.php,v 1.1 2003/03/03 22:11:08 joko Exp $ | 
| 15 | * | 
| 16 | * $Log: IncludeFile.php,v $ | 
| 17 | * Revision 1.1  2003/03/03 22:11:08  joko | 
| 18 | * + initial commit | 
| 19 | * | 
| 20 | * | 
| 21 | */ | 
| 22 |  | 
| 23 |  | 
| 24 | /** | 
| 25 | * This class is used to build content | 
| 26 | * for an MVC controlled page.  It instantiates | 
| 27 | * an concrete helper MVC object which does the | 
| 28 | * dispatching stuff. (phpHtmlLib::controller::WebMVC, | 
| 29 | * inherited from the abstract DesignPattern::MVC) | 
| 30 | * | 
| 31 | * This class is established here to act as a wrapper | 
| 32 | * bringing MVC and phpHtmlLib together. | 
| 33 | * | 
| 34 | * By now we inherit from the PageWidget, but this has | 
| 35 | * to be broken using the ProxyPattern or s.th.l.th. | 
| 36 | * I guess we'll have to dispatch to arbitrary concrete | 
| 37 | * Page-implementations here in future... | 
| 38 | * | 
| 39 | * @author Andreas Motl <andreas.motl@ilo.de> | 
| 40 | * @package phpHtmlLib | 
| 41 | * @module MVCPage | 
| 42 | * | 
| 43 | */ | 
| 44 |  | 
| 45 | /** | 
| 46 | * Make sure we have the required parent class | 
| 47 | */ | 
| 48 |  | 
| 49 | //class Site_WebPageMVC extends PageWidget { | 
| 50 | //loadModule('DesignPattern::MVC'); | 
| 51 |  | 
| 52 | //require_once($phphtmllib."/widgets/PageWidget.inc"); | 
| 53 |  | 
| 54 |  | 
| 55 | // TODO: Learn TransparentProxy to do procedural calls instead | 
| 56 | // of instantiating a component and even less code could be in here..... | 
| 57 | // benefit: the TransparentProxy would be become even more powerful | 
| 58 | // eeäähhh, to the master Proxy it goes......!!! This one calls the handler(s)! | 
| 59 |  | 
| 60 |  | 
| 61 | //class Site_Adapter_php_Class { | 
| 62 | //class Site_Adapter_php_IncludeFile extends GenericDataWidget { | 
| 63 | class DesignPattern_AdapterProxy extends DesignPattern_TransparentProxy { | 
| 64 |  | 
| 65 | var $_adapter; | 
| 66 | var $_adapter_module; | 
| 67 | var $_adapter_options; | 
| 68 |  | 
| 69 | function &get_adapter() { | 
| 70 | return $this->_adapter; | 
| 71 | } | 
| 72 |  | 
| 73 | function &set_adapter(&$adapter) { | 
| 74 | $this->_adapter = &$adapter; | 
| 75 | } | 
| 76 |  | 
| 77 | // move this code to php::call_func!!! and wrap here!!! | 
| 78 | function &create_adapter($m, $f, $a, $options = array()) { | 
| 79 |  | 
| 80 | // load required module | 
| 81 | php::loadModule($m); | 
| 82 |  | 
| 83 | // V0: call-handler tests | 
| 84 | //$m::$f(); | 
| 85 | //$res = call_user_func(array($m, $f)); | 
| 86 | //call_user_func("$m::$f"); | 
| 87 | //$m->$f(); | 
| 88 |  | 
| 89 | // V1: | 
| 90 | //$res = call_user_func( array( $m, $f ) ); | 
| 91 |  | 
| 92 | // V2: | 
| 93 | //return call_user_func( array( $m, $f ), $a ); | 
| 94 |  | 
| 95 | if ($options[object]) { | 
| 96 | $m = php::mkInstance($m); | 
| 97 | } | 
| 98 |  | 
| 99 | // V3: | 
| 100 | $this->set_adapter( call_user_func( array( &$m, $f ), $a ) ); | 
| 101 | return $this->get_adapter(); | 
| 102 |  | 
| 103 | //print Dumper($res); | 
| 104 | //exit; | 
| 105 |  | 
| 106 | // FIXME: use TransparentProxy for this! | 
| 107 | // V1: | 
| 108 | //$this = $res; | 
| 109 | // V2: | 
| 110 | //$this->make_transparent(); | 
| 111 |  | 
| 112 | //return $res; | 
| 113 |  | 
| 114 | } | 
| 115 |  | 
| 116 | function set_adapter_module($name) { | 
| 117 | $this->_adapter_module = $name; | 
| 118 | } | 
| 119 | function get_adapter_module() { | 
| 120 | return $this->_adapter_module; | 
| 121 | } | 
| 122 | function set_adapter_options(&$options) { | 
| 123 | $this->_adapter_options = &$options; | 
| 124 | } | 
| 125 | function get_adapter_options() { | 
| 126 | return $this->_adapter_options; | 
| 127 | } | 
| 128 |  | 
| 129 | } | 
| 130 |  | 
| 131 | ?> |