From 362a4036eb99b108050bdb027626de964a90ef67 Mon Sep 17 00:00:00 2001 From: xue <> Date: Fri, 15 Jun 2007 15:10:44 +0000 Subject: Fixed #641. --- HISTORY | 1 + framework/Web/UI/TControl.php | 7 ++++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/HISTORY b/HISTORY index 256a255e..d78ec668 100644 --- a/HISTORY +++ b/HISTORY @@ -5,6 +5,7 @@ BUG: Ticket#650 - Fixed TMysqlMetaData bug about SHOW FULL TABLES (Qiang) BUG: TWizard Sidebar using TDataListItemRenderer has error (Qiang) ENH: Ticket#631 - Make TQueue implement Countable as the other collection classes (Knut) ENH: Ticket#634 - Override __toString for TXmlElement and TXmlDocument (Knut) +ENH: Ticket#641 - Added support to find out controls of specified class or parent classes (Qiang) CHG: Ticket#649 - Wrong error message in THttpCookieCollection::itemAt() (Knut) NEW: Ticket#646 - Implement TAPCCache::add() (Knut) 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