X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=WEB-INF%2Flib%2Fform%2FTable.class.php;h=7bcd78be89e717c60c932e7020eed4e0d04e4d32;hb=fcb232f2236dd0105525b0239fa7b212aaf72a2a;hp=ea0d28e85202b7f5fe75a9f08cbb0381fff91ead;hpb=3a5964df63eb410b66e02326ebc7f7c90e8d606e;p=timetracker.git diff --git a/WEB-INF/lib/form/Table.class.php b/WEB-INF/lib/form/Table.class.php index ea0d28e8..7bcd78be 100644 --- a/WEB-INF/lib/form/Table.class.php +++ b/WEB-INF/lib/form/Table.class.php @@ -34,6 +34,7 @@ class Table extends FormElement { var $mColumns = array(); // array of columns in table var $mData = null; // array of rows with data for column cells var $mHeaders = array(); // column headers + var $mFooters = array(); // column footers var $mInteractive = true; // adds a clickable checkbox column to table var $mIAScript = null; // sctipt to execute when a checkbox is clicked var $mKeyField = ''; // identifies a column used as key to access row data @@ -41,23 +42,23 @@ class Table extends FormElement { var $mBgColor = '#ffffff'; var $mBgColorOver = '#eeeeff'; var $mWidth = ''; - var $class = 'Table'; var $mTableOptions = array(); var $mRowOptions = array(); var $mHeaderOptions = array(); var $mProccessed = false; - function __construct($name, $value='') { + function __construct($name, $cssClass = null) { + $this->class = 'Table'; $this->name = $name; - $this->value = $value; + $this->cssClass = $cssClass; } function setKeyField($value) { - $this->mKeyField = $value; + $this->mKeyField = $value; } function setData($data) { - if (is_array($data) && isset($data[0]) && is_array($data[0])) + if (is_array($data) && isset($data[0]) && is_array($data[0])) $this->mData = &$data; } @@ -89,7 +90,7 @@ class Table extends FormElement { return @$this->mData[$rowindex][$this->mColumnFields[$colindex]]; } - function getValueAtName($rowindex,$fieldname) { + function getValueAtName($rowindex, $fieldname) { if (!$this->mProccessed) $this->_process(); return @$this->mData[$rowindex][$fieldname]; } @@ -111,16 +112,20 @@ class Table extends FormElement { foreach ($this->mColumns as $column) { $this->mColumnFields[] = $column->getField(); $this->mHeaders[] = $column->getHeader(); + $this->mFooters[] = $column->getFooter(); } } - function toStringControl() { + function getHtml() { if (!$this->mProccessed) $this->_process(); $html = ""; if ($this->mInteractive) $html .= $this->_addJavaScript(); $html .= "
mHeaderOptions) > 0) { + foreach ($this->mHeaderOptions as $k=>$v) { + $html .= " $k=\"$v\""; + } + } + $html .= ">$footer | \n"; + } + $html .= "
---|