| 1 |
<?php |
| 2 |
/** |
| 3 |
* This contains the TextNav widget |
| 4 |
* |
| 5 |
* $Id: StandardDialogWidget.inc,v 1.1 2003/09/29 22:29:23 hemna Exp $ |
| 6 |
* |
| 7 |
* @author Walter A. Boring IV <waboring@buildabetterweb.com> |
| 8 |
* @package phpHtmlLib |
| 9 |
* |
| 10 |
*/ |
| 11 |
|
| 12 |
/** |
| 13 |
* This class requires the DialogWidget |
| 14 |
*/ |
| 15 |
require_once($phphtmllib."/widgets/DialogWidget.inc"); |
| 16 |
|
| 17 |
|
| 18 |
/** |
| 19 |
* This class is used to build a DialogWidget that |
| 20 |
* can have 'blocks' for messages. |
| 21 |
* |
| 22 |
*/ |
| 23 |
class StandardDialogWidget extends DialogWidget { |
| 24 |
|
| 25 |
|
| 26 |
/** |
| 27 |
* Pushes a block content onto the data object |
| 28 |
* Each pushed block is separated by some white space |
| 29 |
* defined in $_block_spacing |
| 30 |
* |
| 31 |
* @param string - block title |
| 32 |
* @param mixed - either string, or tag object. |
| 33 |
* @access public |
| 34 |
*/ |
| 35 |
function add_block($title, $content) { |
| 36 |
$this->_data[] = array("title"=>$title, |
| 37 |
"content"=>$content); |
| 38 |
} |
| 39 |
|
| 40 |
|
| 41 |
/** |
| 42 |
* This method is used to add the message blocks |
| 43 |
* to the appropriate container |
| 44 |
* |
| 45 |
* @return object - the container object with the messages. |
| 46 |
*/ |
| 47 |
function &_build_message_container() { |
| 48 |
$box = new InfoTable($this->get_title()); |
| 49 |
|
| 50 |
//don't show the cell borders |
| 51 |
$box->set_show_cellborders(false); |
| 52 |
|
| 53 |
// add each block |
| 54 |
foreach ($this->_data as $block) { |
| 55 |
// we have a block with the title |
| 56 |
$box->add_row($this->_build_block($block)); |
| 57 |
} |
| 58 |
return $box; |
| 59 |
} |
| 60 |
|
| 61 |
|
| 62 |
/** |
| 63 |
* Create a DIV that holds the title |
| 64 |
* and data of a block |
| 65 |
* |
| 66 |
* @return a DIVtag |
| 67 |
* @access private |
| 68 |
*/ |
| 69 |
function &_build_block($data) { |
| 70 |
$div = html_div(); |
| 71 |
$div->set_style("text-align: center;"); |
| 72 |
|
| 73 |
if (is_array($data)) { |
| 74 |
if (is_null($data["title"])) { |
| 75 |
$div->add($data["content"]); |
| 76 |
$block =& $div; |
| 77 |
} else { |
| 78 |
$block = html_fieldset($data["title"], $data["content"]); |
| 79 |
} |
| 80 |
} else { |
| 81 |
$div->add($data); |
| 82 |
$block =& $div; |
| 83 |
} |
| 84 |
return $block; |
| 85 |
} |
| 86 |
} |
| 87 |
?> |