summaryrefslogtreecommitdiff
path: root/framework/Web/UI/WebControls/TDataBoundControl.php
diff options
context:
space:
mode:
authorxue <>2006-01-04 04:59:01 +0000
committerxue <>2006-01-04 04:59:01 +0000
commitd1384deb9b3ac872defd08fd01fbf8cf11442b45 (patch)
tree1a013dd4fdbf1f15f21d33aefa001c3ad9337096 /framework/Web/UI/WebControls/TDataBoundControl.php
parent1c9aa17d682ae92e2e8687ab40916075470830f7 (diff)
Added documentation.
Diffstat (limited to 'framework/Web/UI/WebControls/TDataBoundControl.php')
-rw-r--r--framework/Web/UI/WebControls/TDataBoundControl.php38
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 &copy; 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()