diff options
Diffstat (limited to 'framework/Web/UI/WebControls/TDataBoundControl.php')
-rw-r--r-- | framework/Web/UI/WebControls/TDataBoundControl.php | 38 |
1 files changed, 35 insertions, 3 deletions
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 @@ <?php
+/**
+ * TBulletedList class file
+ *
+ * @author Qiang Xue <qiang.xue@gmail.com>
+ * @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 <qiang.xue@gmail.com>
+ * @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()
|