summaryrefslogtreecommitdiff
path: root/framework/Web/UI/WebControls/TListControl.php
diff options
context:
space:
mode:
authorxue <>2006-01-14 00:19:18 +0000
committerxue <>2006-01-14 00:19:18 +0000
commitf16aa6762984e4d555a1cf93692db0a69fa2ab38 (patch)
tree5a460a73acb869cc58ecb1277118b2e039e0fd1b /framework/Web/UI/WebControls/TListControl.php
parentf0737c5b52373f262a4c8cfd25d4e1bb6ff33aee (diff)
Added TBaseDataList control. Updated class tree. Modified TTextBox about SafeHtml support. Modified TTextBox demo accordingly.
Diffstat (limited to 'framework/Web/UI/WebControls/TListControl.php')
-rw-r--r--framework/Web/UI/WebControls/TListControl.php37
1 files changed, 17 insertions, 20 deletions
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);
}
}