summaryrefslogtreecommitdiff
path: root/framework/Web/UI/WebControls/TTable.php
diff options
context:
space:
mode:
authorxue <>2006-05-04 20:00:46 +0000
committerxue <>2006-05-04 20:00:46 +0000
commit42df6f47862c2f1495ded49f758dbc46f9d9e930 (patch)
treeee849b9758bcbd5c1b1aac40761ce68417eba2bb /framework/Web/UI/WebControls/TTable.php
parentc00193d23726bcb05b1fe53c4dfb3fc38b0a22e5 (diff)
Merge from 3.0 branch till 1023.
Diffstat (limited to 'framework/Web/UI/WebControls/TTable.php')
-rw-r--r--framework/Web/UI/WebControls/TTable.php56
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();
+ }
}
}
}