ACC SHELL
<?php
class TF_Html_Table extends TF_Html
{
private $_cols = null;
private $_inicialized = null;
private $_hasBody = false;
private $_tbody = null;
function __construct ($header = null, $attributes = array(), $isXhtml = true)
{
if (! is_null($header)) {
$this->init($header);
}
parent::__construct('table', null, $attributes, false, $isXhtml);
}
/**
* init
*/
public function init ($header = array())
{
$tr = new TF_Html("tr");
foreach ($header as $val) {
$th = new TF_Html("th", $val);
$th->setStripSpaces(true);
$tr->addChild($th);
}
$thead = new TF_Html("thead");
$thead->addChild($tr);
$tbody = new TF_Html("tbody");
$this->_tbody = &$tbody;
$this->addChild($thead);
$this->addChild($this->_tbody);
} /* of init -------------------------------------*/
/**
* addRow
*/
public function addRow ($data = array())
{
if (($data instanceof TF_Html)) {
$this->_tbody->addChild($data);
}
$tr = new TF_Html("tr");
foreach ($data as $val) {
if (is_null($val)) {
$val = ' ';
}
$td = new TF_Html("td", $val);
$td->setStripSpaces(true);
$tr->addChild($td);
}
$this->_tbody->addChild($tr);
} /* of addRow -------------------------------------*/
}
ACC SHELL 2018