From 42df6f47862c2f1495ded49f758dbc46f9d9e930 Mon Sep 17 00:00:00 2001 From: xue <> Date: Thu, 4 May 2006 20:00:46 +0000 Subject: Merge from 3.0 branch till 1023. --- framework/Web/UI/WebControls/TTable.php | 56 +++++++++++++++++++++++++++++++-- 1 file changed, 54 insertions(+), 2 deletions(-) (limited to 'framework/Web/UI/WebControls/TTable.php') 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(); + } } } } -- cgit v1.2.3