From d1384deb9b3ac872defd08fd01fbf8cf11442b45 Mon Sep 17 00:00:00 2001 From: xue <> Date: Wed, 4 Jan 2006 04:59:01 +0000 Subject: Added documentation. --- framework/Web/UI/WebControls/TDataBoundControl.php | 38 ++++++++++++++++++++-- 1 file changed, 35 insertions(+), 3 deletions(-) (limited to 'framework/Web/UI/WebControls/TDataBoundControl.php') diff --git a/framework/Web/UI/WebControls/TDataBoundControl.php b/framework/Web/UI/WebControls/TDataBoundControl.php index 8f447607..9eca4434 100644 --- a/framework/Web/UI/WebControls/TDataBoundControl.php +++ b/framework/Web/UI/WebControls/TDataBoundControl.php @@ -1,4 +1,23 @@ + * @link http://www.pradosoft.com/ + * @copyright Copyright © 2005 PradoSoft + * @license http://www.pradosoft.com/license/ + * @version $Revision: $ $Date: $ + * @package System.Web.UI.WebControls + */ + +/** + * TBulletedList class + * + * @author Qiang Xue + * @version $Revision: $ $Date: $ + * @package System.Web.UI.WebControls + * @since 3.0 + */ abstract class TDataBoundControl extends TWebControl { @@ -280,11 +299,24 @@ abstract class TDataBoundControl extends TWebControl */ protected function validateDataSource($value) { - if(is_array($value)) + if(is_string($value)) + { + $list=new TList; + foreach(TPropertyValue::ensureArray($value) as $key=>$value) + { + if(is_array($value)) + $list->add($value); + else + $list->add(array($value,is_string($key)?$key:$value)); + } + return $list; + } + else if(is_array($value)) $value=new TList($value); - else if($value!==null && !($value instanceof Traversable)) + else if(($value instanceof Traversable) || $value===null) + return $value; + else throw new TInvalidDataTypeException('databoundcontrol_datasource_invalid'); - return $value; } public function getDataMember() -- cgit v1.2.3