From de5c76921b8f9d187f68016de4b08c06dce4008b Mon Sep 17 00:00:00 2001 From: Roland Gruber Date: Sun, 26 Sep 2010 11:10:28 +0000 Subject: [PATCH] fixed table merging --- lam/lib/html.inc | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/lam/lib/html.inc b/lam/lib/html.inc index 25729a9e..3665971e 100644 --- a/lam/lib/html.inc +++ b/lam/lib/html.inc @@ -230,6 +230,24 @@ class htmlTable extends htmlElement { if (is_null($table) || !($table instanceof htmlTable)) { return; } + // remove obsolete new lines at the end + if ($table->elements[sizeof($table->elements) - 1] == htmlTable::newLine) { + unset($table->elements[sizeof($table->elements) - 1]); + } + // close last row of other table if needed + if ($table->rowOpen) { + $table->elements[] = "\n"; + } + // close last own row if needed + if ($this->rowOpen) { + if ($this->elements[sizeof($this->elements) - 1] == htmlTable::newLine) { + unset($this->elements[sizeof($this->elements) - 1]); + } + else { + $this->elements[] = "\n"; + } + $this->rowOpen = false; + } $this->elements = array_merge($this->elements, $table->elements); }