class = 'Table'; $this->name = $name; $this->cssClass = $cssClass; } function setKeyField($value) { $this->mKeyField = $value; } function setData($data) { if (is_array($data) && isset($data[0]) && is_array($data[0])) $this->mData = &$data; } function addColumn($column) { if ($column != null) $column->setTable($this); $this->mColumns[] = &$column; } function setInteractive($value) { $this->mInteractive = $value; } function isInteractive() { return $this->mInteractive; } function setIAScript($value) { $this->mIAScript = $value; } function getIAScript() { return $this->mIAScript; } function setWidth($value) { $this->mWidth = $value; } function getWidth() { return $this->mWidth; } function setTableOptions($value) { $this->mTableOptions = $value; } function getTableOptions() { return $this->mTableOptions; } function setRowOptions($value) { $this->mRowOptions = $value; } function getRowOptions() { return $this->mRowOptions; } function setHeaderOptions($value) { $this->mHeaderOptions = $value; } function getHeaderOptions() { return $this->mHeaderOptions; } function getValueAt($rowindex, $colindex) { if (!$this->mProccessed) $this->_process(); return @$this->mData[$rowindex][$this->mColumnFields[$colindex]]; } function getValueAtName($rowindex, $fieldname) { if (!$this->mProccessed) $this->_process(); return @$this->mData[$rowindex][$fieldname]; } function _process() { $this->mProccessed = true; if ($this->mInteractive) { // Add a column of clickable checkboxes. $column = new TableColumn("","name."_all\" onclick=\"setAll(this.checked)\">"); import('form.CheckboxCellRenderer'); $cb = new CheckboxCellRenderer(); if ($this->getIAScript()) $cb->setOnChangeAdd($this->getIAScript()."(this)"); $column->setRenderer($cb); $column->setTable($this); array_unshift($this->mColumns, $column); } foreach ($this->mColumns as $column) { $this->mColumnFields[] = $column->getField(); $this->mHeaders[] = $column->getHeader(); $this->mFooters[] = $column->getFooter(); } } 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 .= ">$header | \n"; } $html .= "
---|
mHeaderOptions) > 0) { foreach ($this->mHeaderOptions as $k=>$v) { $html .= " $k=\"$v\""; } } $html .= ">$footer | \n"; } $html .= "