fixed table merging

This commit is contained in:
Roland Gruber 2010-09-26 11:10:28 +00:00
parent be743a467b
commit de5c76921b
1 changed files with 18 additions and 0 deletions

View File

@ -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[] = "</tr>\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[] = "</tr>\n";
}
$this->rowOpen = false;
}
$this->elements = array_merge($this->elements, $table->elements);
}