From 2903d0c2e430b981424d407c7be4fb60ad48135f Mon Sep 17 00:00:00 2001 From: Roland Gruber Date: Sun, 11 Aug 2013 10:50:21 +0000 Subject: [PATCH] id for tables --- lam/lib/html.inc | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/lam/lib/html.inc b/lam/lib/html.inc index c4962168..c9a2c49a 100644 --- a/lam/lib/html.inc +++ b/lam/lib/html.inc @@ -174,6 +174,8 @@ class htmlTable extends htmlElement { private $rowOpen = false; /** table width */ private $width = null; + /** HTML ID */ + private $id = null; /** * Constructor @@ -181,8 +183,9 @@ class htmlTable extends htmlElement { * @param String $width table width (e.g. 100%) * @see htmlElement */ - function __construct($width = null) { + function __construct($width = null, $id = null) { $this->width = $width; + $this->id = $id; } /** @@ -262,11 +265,15 @@ class htmlTable extends htmlElement { if ($this->width != null) { $width = ' width="' . htmlspecialchars($this->width) . '"'; } + $id = ''; + if (!empty($this->id)) { + $id = ' id="' . $this->id . '"'; + } $classAttr = ''; if (sizeof($this->cssClasses) > 0) { $classAttr = ' class="' . implode(' ', $this->cssClasses) . '"'; } - echo "\n"; + echo "\n"; // print all contained elements for ($i = 0; $i < sizeof($this->elements); $i++) { // print htmlElement objects