From f16aa6762984e4d555a1cf93692db0a69fa2ab38 Mon Sep 17 00:00:00 2001 From: xue <> Date: Sat, 14 Jan 2006 00:19:18 +0000 Subject: Added TBaseDataList control. Updated class tree. Modified TTextBox about SafeHtml support. Modified TTextBox demo accordingly. --- framework/Web/UI/WebControls/TListControl.php | 37 ++++++++++++--------------- 1 file changed, 17 insertions(+), 20 deletions(-) (limited to 'framework/Web/UI/WebControls/TListControl.php') diff --git a/framework/Web/UI/WebControls/TListControl.php b/framework/Web/UI/WebControls/TListControl.php index 7057e119..cb740124 100644 --- a/framework/Web/UI/WebControls/TListControl.php +++ b/framework/Web/UI/WebControls/TListControl.php @@ -156,27 +156,24 @@ abstract class TListControl extends TDataBoundControl $items=$this->getItems(); if(!$this->getAppendDataBoundItems()) $items->clear(); - if($data instanceof Traversable) + $textField=$this->getDataTextField(); + if($textField==='') + $textField=0; + $valueField=$this->getDataValueField(); + if($valueField==='') + $valueField=1; + $textFormat=$this->getDataTextFormatString(); + foreach($data as $object) { - $textField=$this->getDataTextField(); - if($textField==='') - $textField=0; - $valueField=$this->getDataValueField(); - if($valueField==='') - $valueField=1; - $textFormat=$this->getDataTextFormatString(); - foreach($data as $object) - { - $item=new TListItem; - if(isset($object[$textField])) - $text=$object[$textField]; - else - $text=TPropertyValue::ensureString($object); - $item->setText($textFormat===''?$text:sprintf($textFormat,$text)); - if(isset($object[$valueField])) - $item->setValue($object[$valueField]); - $items->add($item); - } + $item=new TListItem; + if(isset($object[$textField])) + $text=$object[$textField]; + else + $text=TPropertyValue::ensureString($object); + $item->setText($textFormat===''?$text:sprintf($textFormat,$text)); + if(isset($object[$valueField])) + $item->setValue($object[$valueField]); + $items->add($item); } } -- cgit v1.2.3