diff options
author | xue <> | 2006-05-04 13:45:09 +0000 |
---|---|---|
committer | xue <> | 2006-05-04 13:45:09 +0000 |
commit | ad005a0cfb526a41d04dd5260df654845ef68f5b (patch) | |
tree | 393ebcc8313e9bffef64c06406553c12348f80ff /framework/Web/UI/WebControls/TTable.php | |
parent | 49ccf41324a2c87b20b84f72355b79d92d6f3d0c (diff) |
Added table section support.
Diffstat (limited to 'framework/Web/UI/WebControls/TTable.php')
-rw-r--r-- | framework/Web/UI/WebControls/TTable.php | 56 |
1 files changed, 54 insertions, 2 deletions
diff --git a/framework/Web/UI/WebControls/TTable.php b/framework/Web/UI/WebControls/TTable.php index e7baca02..aaed37df 100644 --- a/framework/Web/UI/WebControls/TTable.php +++ b/framework/Web/UI/WebControls/TTable.php @@ -298,11 +298,63 @@ class TTable extends TWebControl {
if($this->getHasControls())
{
- $writer->writeLine();
+ $renderTableSection=false;
foreach($this->getControls() as $row)
{
- $row->renderControl($writer);
+ if($row->getTableSection()!=='Body')
+ {
+ $renderTableSection=true;
+ break;
+ }
+ }
+ if($renderTableSection)
+ {
+ $currentSection='Header';
+ $writer->writeLine();
+ foreach($this->getControls() as $index=>$row)
+ {
+ if(($section=$row->getTableSection())===$currentSection)
+ {
+ if($index===0 && $currentSection==='Header')
+ $writer->renderBeginTag('thead');
+ }
+ else
+ {
+ if($currentSection==='Header')
+ {
+ if($index>0)
+ $writer->renderEndTag();
+ if($section==='Body')
+ $writer->renderBeginTag('tbody');
+ else
+ $writer->renderBeginTag('tfoot');
+ $currentSection=$section;
+ }
+ else if($currentSection==='Body')
+ {
+ $writer->renderEndTag();
+ if($section==='Footer')
+ $writer->renderBeginTag('tfoot');
+ else
+ throw new TConfigurationException('table_tablesection_outoforder');
+ $currentSection=$section;
+ }
+ else // Footer
+ throw new TConfigurationException('table_tablesection_outoforder');
+ }
+ $row->renderControl($writer);
+ $writer->writeLine();
+ }
+ $writer->renderEndTag();
+ }
+ else
+ {
$writer->writeLine();
+ foreach($this->getControls() as $row)
+ {
+ $row->renderControl($writer);
+ $writer->writeLine();
+ }
}
}
}
|