summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorxue <>2007-06-15 15:10:44 +0000
committerxue <>2007-06-15 15:10:44 +0000
commit362a4036eb99b108050bdb027626de964a90ef67 (patch)
treee5b16d577f0d13db64ea8f4b9fca9a45839d9986
parenta9014dcee56ecbcee2321bddc51b239af2d59d5e (diff)
Fixed #641.
-rw-r--r--HISTORY1
-rw-r--r--framework/Web/UI/TControl.php7
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;