\n";
/** list of subelements */
private $elements = array();
+ /** specifies if currently a row is open */
+ private $rowOpen = false;
/**
* Adds an element to the table. The element may be a htmlElement object or a simple String.
@@ -85,7 +87,22 @@ class htmlTable extends htmlElement {
* @param array $options list of options (e.g. htmlElement::OPTION_ALIGN => htmlElement::ALIGN_TOP)
*/
public function addElement($element, $newLine = false) {
- if ($element instanceof htmlElement) {
+ // add row element
+ if ($element instanceof htmlTableRow) {
+ // check if a row needs to be closed
+ if ($this->rowOpen) {
+ $this->elements[] = "
\n";
+ $this->rowOpen = false;
+ }
+ $this->elements[] = $element;
+ }
+ // add cell element
+ elseif ($element instanceof htmlElement) {
+ // check if a row needs to be opened
+ if (!$this->rowOpen) {
+ $this->elements[] = "
\n";
+ $this->rowOpen = true;
+ }
// check if alignment option was given
$align = '';
if ($element->alignment !== null) {
@@ -120,7 +137,12 @@ class htmlTable extends htmlElement {
* Adds another line to the table.
*/
public function addNewLine() {
- $this->elements[] = htmlTable::newLine;
+ if (!$this->rowOpen) {
+ $this->elements[] = "
\n";
+ }
echo htmlTable::footer;
return $return;
}
}
+/**
+ * A row inside a htmlTable.
+ *
+ * @see htmlTable
+ * @package metaHTML
+ */
+class htmlTableRow extends htmlElement {
+
+ private $cells;
+
+ /**
+ * Constructor
+ *
+ * @param array $cells list of htmlElements
+ * @see htmlElement
+ */
+ function __construct($cells) {
+ $this->cells = $cells;
+ }
+
+ /**
+ * 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) {
+ $types = array();
+ echo "
";
+ return $types;
+ }
+
+}
+
/**
* An extended input field that combines label, input field and help.
*
@@ -695,6 +765,7 @@ class htmlTableExtendedInputCheckbox extends htmlInputCheckbox {
* @param boolean $checked checked
* @param String $label descriptive label
* @param String $helpID help ID
+ * @param boolean $labelFirst specifies if the label is at the beginning or at the end (optional, default beginning)
*/
function __construct($name, $checked, $label, $helpID = null, $labelFirst = true) {
parent::__construct($name, $checked);
@@ -736,6 +807,96 @@ class htmlTableExtendedInputCheckbox extends htmlInputCheckbox {
}
+/**
+ * Prints the HTML code for a file upload field.
+ *
+ * @package metaHTML
+ */
+class htmlInputFileUpload extends htmlElement {
+
+ /** unique name of input element */
+ private $name;
+
+ /**
+ * Constructor.
+ *
+ * @param String $name unique name
+ */
+ function __construct($name) {
+ $this->name = htmlspecialchars($name);
+ }
+
+ /**
+ * 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) {
+ $tabindexValue = ' tabindex="' . $tabindex . '"';
+ $tabindex++;
+ echo '';
+ return array($this->name => 'file');
+ }
+
+}
+
+/**
+ * File upload with descriptive label and help link.
+ *
+ * @package metaHTML
+ */
+class htmlTableExtendedInputFileUpload extends htmlInputFileUpload {
+
+ /** descriptive label */
+ private $label;
+ /** help ID */
+ private $helpID;
+
+ /**
+ * Constructor.
+ *
+ * @param String $name unique name
+ * @param String $label descriptive label
+ * @param String $helpID help ID
+ */
+ function __construct($name, $label, $helpID = null) {
+ parent::__construct($name);
+ $this->label = htmlspecialchars($label);
+ $this->helpID = $helpID;
+ }
+
+ /**
+ * 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 $this->label;
+ echo "\n\n
\n";
+ $return = parent::generateHTML($module, $input, $values, $restricted, $tabindex, $scope);
+ // print help link
+ if ($this->helpID != null) {
+ echo "\n