| 1 |
joko |
1.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: BaseController.php,v 1.1 2003/03/01 21:11:18 joko Exp $ |
| 15 |
|
|
* |
| 16 |
|
|
* $Log: BaseController.php,v $ |
| 17 |
|
|
* |
| 18 |
|
|
*/ |
| 19 |
|
|
|
| 20 |
|
|
|
| 21 |
|
|
/** |
| 22 |
|
|
* This class is used to build content |
| 23 |
|
|
* for an MVC controlled page. It instantiates |
| 24 |
|
|
* an concrete helper MVC object which does the |
| 25 |
|
|
* dispatching stuff. (phpHtmlLib::controller::WebMVC, |
| 26 |
|
|
* inherited from the abstract DesignPattern::MVC) |
| 27 |
|
|
* |
| 28 |
|
|
* This class is established here to act as a wrapper |
| 29 |
|
|
* bringing MVC and phpHtmlLib together. |
| 30 |
|
|
* |
| 31 |
|
|
* By now we inherit from the PageWidget, but this has |
| 32 |
|
|
* to be broken using the ProxyPattern or s.th.l.th. |
| 33 |
|
|
* I guess we'll have to dispatch to arbitrary concrete |
| 34 |
|
|
* Page-implementations here in future... |
| 35 |
|
|
* |
| 36 |
|
|
* @author Andreas Motl <andreas.motl@ilo.de> |
| 37 |
|
|
* @package phpHtmlLib |
| 38 |
|
|
* @module MVCPage |
| 39 |
|
|
* |
| 40 |
|
|
*/ |
| 41 |
|
|
|
| 42 |
|
|
/** |
| 43 |
|
|
* Make sure we have the required parent class |
| 44 |
|
|
*/ |
| 45 |
|
|
|
| 46 |
|
|
//class Site_WebPageMVC extends PageWidget { |
| 47 |
|
|
//loadModule('DesignPattern::MVC'); |
| 48 |
|
|
|
| 49 |
|
|
//require_once($phphtmllib."/widgets/PageWidget.inc"); |
| 50 |
|
|
|
| 51 |
|
|
|
| 52 |
|
|
class Site_Adapter_phpHtmlLib_PageWidget extends PageWidget { |
| 53 |
|
|
|
| 54 |
|
|
function Site_Adapter_phpHtmlLib_PageWidget($args = array()) { |
| 55 |
|
|
|
| 56 |
|
|
// trace |
| 57 |
|
|
//print Dumper($args); |
| 58 |
|
|
//exit; |
| 59 |
|
|
|
| 60 |
|
|
//$this->PageWidget( $title, $render_type ); |
| 61 |
|
|
//$this->PageWidget( 'Hello World!', HTML ); |
| 62 |
|
|
$this->PageWidget( $args[title], HTML ); |
| 63 |
|
|
|
| 64 |
|
|
} |
| 65 |
|
|
|
| 66 |
|
|
function body_content() { |
| 67 |
|
|
|
| 68 |
|
|
$master_div = html_div(); |
| 69 |
|
|
$master_div->set_style('border:1px solid black;'); |
| 70 |
|
|
|
| 71 |
|
|
//add the header area |
| 72 |
|
|
$master_div->add( html_comment( "HEADER BLOCK BEGIN") ); |
| 73 |
|
|
$master_div->add( $this->header_block() ); |
| 74 |
|
|
$master_div->add( html_comment( "HEADER BLOCK END") ); |
| 75 |
|
|
|
| 76 |
|
|
//add it to the page |
| 77 |
|
|
//build the outer wrapper div |
| 78 |
|
|
//that everything will live under |
| 79 |
|
|
$wrapper_div = html_div(); |
| 80 |
|
|
$wrapper_div->set_id( "phphtmllib" ); |
| 81 |
|
|
$wrapper_div->set_style('border:1px solid blue;'); |
| 82 |
|
|
|
| 83 |
|
|
//add the main body |
| 84 |
|
|
$wrapper_div->add( html_comment( "MAIN BLOCK BEGIN") ); |
| 85 |
|
|
$wrapper_div->add( $this->main_block() ); |
| 86 |
|
|
$wrapper_div->add( html_comment( "MAIN BLOCK END") ); |
| 87 |
|
|
|
| 88 |
|
|
$master_div->add( $wrapper_div ); |
| 89 |
|
|
|
| 90 |
|
|
//add the footer area. |
| 91 |
|
|
$master_div->add( html_comment( "FOOTER BLOCK BEGIN") ); |
| 92 |
|
|
$master_div->add( $this->footer_block() ); |
| 93 |
|
|
$master_div->add( html_comment( "FOOTER BLOCK END") ); |
| 94 |
|
|
|
| 95 |
|
|
$this->add($master_div); |
| 96 |
|
|
|
| 97 |
|
|
} |
| 98 |
|
|
|
| 99 |
|
|
/** |
| 100 |
|
|
* We override this method to automatically |
| 101 |
|
|
* break up the main block into a |
| 102 |
|
|
* left block and a right block |
| 103 |
|
|
* |
| 104 |
|
|
* @param TABLEtag object. |
| 105 |
|
|
*/ |
| 106 |
|
|
function main_block() { |
| 107 |
|
|
|
| 108 |
|
|
$main = html_div(); |
| 109 |
|
|
$main->set_id("maincontent"); |
| 110 |
|
|
|
| 111 |
|
|
$table = html_table("100%",0); |
| 112 |
|
|
$left_div = html_div("leftblock", $this->left_block() ); |
| 113 |
|
|
|
| 114 |
|
|
$table->add_row( html_td("leftblock", "", $left_div ), |
| 115 |
|
|
html_td("divider", "", " "), |
| 116 |
|
|
html_td("rightblock", "", $this->content_block() )); |
| 117 |
|
|
$main->add( $table ); |
| 118 |
|
|
|
| 119 |
|
|
return $main; |
| 120 |
|
|
} |
| 121 |
|
|
|
| 122 |
|
|
|
| 123 |
|
|
function header_block() { |
| 124 |
|
|
return container( "HEADER BLOCK" ); |
| 125 |
|
|
} |
| 126 |
|
|
|
| 127 |
|
|
function footer_block() { |
| 128 |
|
|
return container( "FOOTER BLOCK" ); |
| 129 |
|
|
} |
| 130 |
|
|
|
| 131 |
|
|
function left_block() { |
| 132 |
|
|
return container( "LEFT BLOCK" ); |
| 133 |
|
|
} |
| 134 |
|
|
|
| 135 |
|
|
function content_block() { |
| 136 |
|
|
//$this->add( "CONTENT BLOCK" ); |
| 137 |
|
|
return container( "CONTENT BLOCK" ); |
| 138 |
|
|
} |
| 139 |
|
|
|
| 140 |
|
|
|
| 141 |
|
|
} |
| 142 |
|
|
|
| 143 |
|
|
?> |