From 362a4036eb99b108050bdb027626de964a90ef67 Mon Sep 17 00:00:00 2001 From: xue <> Date: Fri, 15 Jun 2007 15:10:44 +0000 Subject: Fixed #641. --- framework/Web/UI/TControl.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'framework') diff --git a/framework/Web/UI/TControl.php b/framework/Web/UI/TControl.php index cd24de41..dcfcec65 100644 --- a/framework/Web/UI/TControl.php +++ b/framework/Web/UI/TControl.php @@ -966,19 +966,20 @@ class TControl extends TApplicationComponent implements IRenderable, IBindable /** * Finds all child and grand-child controls that are of the specified type. * @param string the class name + * @param boolean whether the type comparison is strict or not. If false, controls of the parent classes of the specified class will also be returned. * @return array list of controls found */ - public function findControlsByType($type) + public function findControlsByType($type,$strict=true) { $controls=array(); if($this->getHasControls()) { foreach($this->_rf[self::RF_CONTROLS] as $control) { - if(is_object($control) && get_class($control)===$type) + if(is_object($control) && (get_class($control)===$type || (!$strict && ($control instanceof $type)))) $controls[]=$control; if(($control instanceof TControl) && $control->getHasControls()) - $controls=array_merge($controls,$control->findControlsByType($type)); + $controls=array_merge($controls,$control->findControlsByType($type,$strict)); } } return $controls; -- cgit v1.2.3