From 3f5d113f3c11ac3ec6025ee60c3c25996b7d9c6d Mon Sep 17 00:00:00 2001 From: Roland Gruber Date: Sun, 29 Aug 2010 16:02:27 +0000 Subject: [PATCH] added fieldsets --- lam/lib/html.inc | 58 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) diff --git a/lam/lib/html.inc b/lam/lib/html.inc index bff7da4c..a59edf50 100644 --- a/lam/lib/html.inc +++ b/lam/lib/html.inc @@ -1278,6 +1278,64 @@ class htmlStatusMessage extends htmlElement { StatusMessage($this->type, $this->title, $this->text); return array(); } + +} + +/** + * Text area with label and help link. + * + * @package metaHTML + */ +class htmlFieldset extends htmlElement { + + /** fieldset content */ + private $content; + /** descriptive label */ + private $label = null; + /** label image */ + private $labelImage = null; + + /** + * Constructor. + * + * @param htmlElement $content content to display inside fieldset + * @param String $label label + * @param String $labelImage image to put before label + */ + function __construct($content, $label = null, $labelImage = null) { + $this->content = $content; + $this->label = htmlspecialchars($label); + $this->labelImage = htmlspecialchars($labelImage); + } + + /** + * Prints the HTML code for this element. + * + * @param string $module Name of account module + * @param array $input List of meta-HTML elements + * @param array $values List of values which override the defaults in $input (name => value) + * @param boolean $restricted If true then no buttons will be displayed + * @param integer $tabindex Start value of tabulator index for input fields + * @param string $scope Account type + * @return array List of input field names and their type (name => type) + */ + function generateHTML($module, $input, $values, $restricted, &$tabindex, $scope) { + echo "
\n"; + // generate legend + if (($this->label != null) || ($this->labelImage != null)) { + echo ""; + if ($this->labelImage != null) { + echo "labelImage . "\" alt=\"\"> "; + } + if ($this->label != null) { + echo $this->label; + } + echo "\n"; + } + $return = $this->content->generateHTML($module, $input, $values, $restricted, $tabindex, $scope); + echo "
\n"; + return $return; + } }