From 9d1f815c6e98263e8d26a377096af588c7d602aa Mon Sep 17 00:00:00 2001 From: Roland Gruber Date: Sun, 9 Sep 2012 13:59:31 +0000 Subject: [PATCH] support table width --- lam/lib/html.inc | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/lam/lib/html.inc b/lam/lib/html.inc index 5b447af8..c05fe3a8 100644 --- a/lam/lib/html.inc +++ b/lam/lib/html.inc @@ -143,6 +143,18 @@ class htmlTable extends htmlElement { private $rowOpen = false; /** additional CSS classes */ private $CSSClasses = ''; + /** table width */ + private $width = null; + + /** + * Constructor + * + * @param String $width table width (e.g. 100%) + * @see htmlElement + */ + function __construct($width = null) { + $this->width = $width; + } /** * Adds an element to the table. The element may be a htmlElement object or a simple String. @@ -213,7 +225,11 @@ class htmlTable extends htmlElement { */ public function generateHTML($module, $input, $values, $restricted, &$tabindex, $scope) { $return = array(); - echo "CSSClasses>\n"; + $width = ''; + if ($this->width != null) { + $width = ' width="' . htmlspecialchars($this->width) . '"'; + } + echo "CSSClasses>\n"; // print all contained elements for ($i = 0; $i < sizeof($this->elements); $i++) { // print htmlElement objects @@ -2001,7 +2017,7 @@ class htmlSpacer extends htmlElement { if ($this->height != null) { $height = 'height: ' . $this->height . ';'; } - echo "
\n"; + echo "
\n"; return array(); }