| 1 |
jonen |
1.1 |
<?php |
| 2 |
|
|
/** |
| 3 |
|
|
* This contains the RoundTitleTable widget |
| 4 |
|
|
* |
| 5 |
|
|
* $Id: RoundTitleTable.inc,v 1.1 2002/11/26 21:51:54 hemna Exp $ |
| 6 |
|
|
* |
| 7 |
|
|
* @author Walter A. Boring IV <waboring@buildabetterweb.com> |
| 8 |
|
|
* @package phpHtmlLib |
| 9 |
|
|
* |
| 10 |
|
|
*/ |
| 11 |
|
|
|
| 12 |
|
|
/** |
| 13 |
|
|
* must have the BaseWidget |
| 14 |
|
|
*/ |
| 15 |
|
|
require_once( $phphtmllib."/widgets/BaseWidget.inc"); |
| 16 |
|
|
|
| 17 |
|
|
/** |
| 18 |
|
|
* This builds a table |
| 19 |
|
|
* widget that has a nice rounded title, |
| 20 |
|
|
* a subtitle area and any amount of data. |
| 21 |
|
|
* |
| 22 |
|
|
* @author Walter A. Boring IV <waboring@buildabetterweb.com> |
| 23 |
|
|
* @package phpHtmlLib |
| 24 |
|
|
*/ |
| 25 |
|
|
class RoundTitleTable extends BaseWidget { |
| 26 |
|
|
|
| 27 |
|
|
|
| 28 |
|
|
/** |
| 29 |
|
|
* the constructor for this class. |
| 30 |
|
|
* @param string $title - the title for the widget. |
| 31 |
|
|
* @param string $subtitle - the subtitle if any. |
| 32 |
|
|
* @param mixed $width - the width of the widget. |
| 33 |
|
|
* can be a % or an int. |
| 34 |
|
|
*/ |
| 35 |
|
|
function RoundTitleTable( $title, $subtitle=NULL, $width="100%") { |
| 36 |
|
|
|
| 37 |
|
|
$this->set_title( $title ); |
| 38 |
|
|
$this->set_subtitle( $subtitle ); |
| 39 |
|
|
$this->set_width( $width ); |
| 40 |
|
|
} |
| 41 |
|
|
|
| 42 |
|
|
|
| 43 |
|
|
function set_subtitle( $subtitle ) { |
| 44 |
|
|
$this->subtitle = $subtitle; |
| 45 |
|
|
} |
| 46 |
|
|
|
| 47 |
|
|
|
| 48 |
|
|
//****************************************** |
| 49 |
|
|
//* rendering area |
| 50 |
|
|
//****************************************** |
| 51 |
|
|
|
| 52 |
|
|
|
| 53 |
|
|
/** |
| 54 |
|
|
* renders a title table for the widget. |
| 55 |
|
|
* @access private |
| 56 |
|
|
*/ |
| 57 |
|
|
function render_title_table() { |
| 58 |
|
|
$table = html_table($this->width,0 ,0 ,0); |
| 59 |
|
|
|
| 60 |
|
|
//ok lets render the title table. |
| 61 |
|
|
$img = html_img("/phphtmllib/widgets/images/spacer.gif", 10, 15); |
| 62 |
|
|
|
| 63 |
|
|
$td = html_td("barleft", "left", $img ); |
| 64 |
|
|
$td->set_collapse(); |
| 65 |
|
|
$td2 = html_td("title", "", $this->title); |
| 66 |
|
|
$td2->set_collapse(); |
| 67 |
|
|
$td3 = html_td("barright", "right", $img); |
| 68 |
|
|
$td3->set_collapse(); |
| 69 |
|
|
|
| 70 |
|
|
$table->add_row( $td, $td2, $td3 ); |
| 71 |
|
|
return $table; |
| 72 |
|
|
} |
| 73 |
|
|
|
| 74 |
|
|
/** |
| 75 |
|
|
* this function builds the subtitle td |
| 76 |
|
|
* to hold the...subtitle! |
| 77 |
|
|
* |
| 78 |
|
|
* @return TDtag object |
| 79 |
|
|
*/ |
| 80 |
|
|
function _build_subtitle() { |
| 81 |
|
|
$td = html_td("subtitle", "", $this->subtitle); |
| 82 |
|
|
$td->set_tag_attribute("colspan", 2); |
| 83 |
|
|
$td->set_collapse(); |
| 84 |
|
|
return $td; |
| 85 |
|
|
} |
| 86 |
|
|
|
| 87 |
|
|
|
| 88 |
|
|
/** |
| 89 |
|
|
* Render the Navtable and its content. |
| 90 |
|
|
* |
| 91 |
|
|
* @param int - the indentation level for |
| 92 |
|
|
* the container. |
| 93 |
|
|
* @param int - the output debug flag to |
| 94 |
|
|
* maintain compatibility w/ the API. |
| 95 |
|
|
* |
| 96 |
|
|
* @return string the raw html output. |
| 97 |
|
|
*/ |
| 98 |
|
|
function render( $indent_level=1, $output_debug=0 ) { |
| 99 |
|
|
|
| 100 |
|
|
$span = html_div(); |
| 101 |
|
|
$span->set_class("roundtitletable"); |
| 102 |
|
|
|
| 103 |
|
|
$html = ""; |
| 104 |
|
|
|
| 105 |
|
|
//render the title area first. |
| 106 |
|
|
$title = $this->render_title_table(); |
| 107 |
|
|
$span->add( $title ); |
| 108 |
|
|
|
| 109 |
|
|
$table = html_table($this->width, 0, 0, 2); |
| 110 |
|
|
$table->set_class("content"); |
| 111 |
|
|
|
| 112 |
|
|
if ($this->subtitle) { |
| 113 |
|
|
$table->add_row( $this->_build_subtitle() ); |
| 114 |
|
|
} |
| 115 |
|
|
|
| 116 |
|
|
//build the containing TD |
| 117 |
|
|
$container_td = html_td(); |
| 118 |
|
|
|
| 119 |
|
|
foreach ($this->_content as $val) { |
| 120 |
|
|
$container_td->add( $val ); |
| 121 |
|
|
} |
| 122 |
|
|
$table->add_row( $container_td ); |
| 123 |
|
|
|
| 124 |
|
|
$span->add( $table ); |
| 125 |
|
|
|
| 126 |
|
|
return $span->render( $indent_level, $output_debug); |
| 127 |
|
|
} |
| 128 |
|
|
} |
| 129 |
|
|
|
| 130 |
|
|
/** |
| 131 |
|
|
* This class defines the css used by the |
| 132 |
|
|
* RoundTitleTable Object. |
| 133 |
|
|
* |
| 134 |
|
|
* @author Walter A. Boring IV <waboring@buildabetterweb.com> |
| 135 |
|
|
* @package phpHtmlLib |
| 136 |
|
|
*/ |
| 137 |
|
|
class RoundTitleTableCSS extends CSSBuilder { |
| 138 |
|
|
|
| 139 |
|
|
function user_setup() { |
| 140 |
|
|
$this->add_entry(".roundtitletable", NULL, |
| 141 |
|
|
array("font-family" => "arial,verdana,helvetica") ); |
| 142 |
|
|
|
| 143 |
|
|
$this->add_entry(".roundtitletable", ".title", |
| 144 |
|
|
array("font-size" => "10pt", |
| 145 |
|
|
"font-weight" => "bold", |
| 146 |
|
|
"text-align" => "center", |
| 147 |
|
|
"color" => "#FFFFFF", |
| 148 |
|
|
"background-color" => "#999999", |
| 149 |
|
|
"width" => "98%") ); |
| 150 |
|
|
|
| 151 |
|
|
$this->add_entry(".roundtitletable", ".barleft", |
| 152 |
|
|
array("background-image" => "url('/phphtmllib/widgets/images/top-left-corner.gif')", |
| 153 |
|
|
"background-repeat" => "no-repeat", |
| 154 |
|
|
"background-color" => "#999999", |
| 155 |
|
|
"width" => "1%")); |
| 156 |
|
|
|
| 157 |
|
|
$this->add_entry(".roundtitletable", ".barright", |
| 158 |
|
|
array("background-image" => "url('/phphtmllib/widgets/images/top-right-corner.gif')", |
| 159 |
|
|
"background-repeat" => "no-repeat", |
| 160 |
|
|
"background-color" => "#999999", |
| 161 |
|
|
"width" => "1%")); |
| 162 |
|
|
|
| 163 |
|
|
$this->add_entry(".roundtitletable", ".content", |
| 164 |
|
|
array("border" => "1px solid #777777;", |
| 165 |
|
|
"background-color" => "#FFFFFF") ); |
| 166 |
|
|
|
| 167 |
|
|
$this->add_entry(".roundtitletable", ".subtitle", |
| 168 |
|
|
array("font-size" => "8pt", |
| 169 |
|
|
"font-weight" => "bold", |
| 170 |
|
|
"text-align" => "center", |
| 171 |
|
|
"color" => "#777777", |
| 172 |
|
|
"background-color" => "#eeeeee") ); |
| 173 |
|
|
} |
| 174 |
|
|
} |
| 175 |
|
|
|
| 176 |
|
|
?> |