2 /*=====================================================================*
3 || ###################################################################
4 || # Blue Static ISSO Framework [#]issoversion[#]
5 || # Copyright ©2002-[#]year[#] Blue Static
7 || # This program is free software; you can redistribute it and/or modify
8 || # it under the terms of the GNU General Public License as published by
9 || # the Free Software Foundation; version [#]gpl[#] of the License.
11 || # This program is distributed in the hope that it will be useful, but
12 || # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13 || # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16 || # You should have received a copy of the GNU General Public License along
17 || # with this program; if not, write to the Free Software Foundation, Inc.,
18 || # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
19 || ###################################################################
20 \*=====================================================================*/
23 * Printer Root Element: Table (PrinterRootElementTable.php)
28 require_once('ISSO/PrinterRootElement.php');
31 * Printer Root Element: Table
33 * Represents a <table> object. This can have a parent or not: if it does,
34 * then it will be painted as a child, otherwise it will act as a root.
37 * @copyright Copyright (c)2002 - [#]year[#], Blue Static
42 class BSPrinterRootElementTable
extends BSPrinterRootElement
45 * Maximum number of columns
50 // ###################################################################
52 * Adds a table row into the child list
54 * @param BSPrinterTableElement Table element
56 public function addChild(BSPrinterElement
$tr)
58 $this->children
[] = $tr;
61 // ###################################################################
63 * Calculates the number of columns to display based on the colspan
64 * of children elements
66 private function _calculateColumnCount()
68 foreach ($this->children
AS $child)
70 if ($child->numberOfColumns() > $this->colspan
)
72 $this->colspan
= $child->numberOfColumns();
77 // ###################################################################
79 * Returns the HTML for all printed children elements
81 * @return string Printed HTML
83 protected function _paintChildren()
87 $this->_calculateColumnCount();
89 foreach ($this->children
AS $child)
91 $this->builder
.= "\n" . $child->paint() . "\n";
94 return $this->builder
;
97 // ###################################################################
99 * Sets the parent element
101 * @param BSPrinterElement Parent
103 public function setParent(BSPrinterElement
$parent)
105 $this->parent
= $parent;
108 // ###################################################################
110 * Gets the parent element
112 * @return BSPrinterElement Parent
114 public function getParent()
116 return $this->parent
;
119 // ###################################################################
123 * @return string Table HTML code
125 public function paint()
127 $this->printer
->paint("<table>" . $this->_paintChildren() . "</table>");
131 /*=====================================================================*
132 || ###################################################################
135 || ###################################################################
136 \*=====================================================================*/