diff options
author | xue <> | 2006-01-04 02:53:33 +0000 |
---|---|---|
committer | xue <> | 2006-01-04 02:53:33 +0000 |
commit | 1c9aa17d682ae92e2e8687ab40916075470830f7 (patch) | |
tree | e79459099b35976d15343852b48f2ac1d17ca011 /framework/Web/UI | |
parent | 938620ed98eee9babe7fdb0d99c0400257aa47d1 (diff) |
Added findControlsByType().
Diffstat (limited to 'framework/Web/UI')
-rw-r--r-- | framework/Web/UI/TControl.php | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/framework/Web/UI/TControl.php b/framework/Web/UI/TControl.php index 1663b783..34e9b92f 100644 --- a/framework/Web/UI/TControl.php +++ b/framework/Web/UI/TControl.php @@ -809,6 +809,27 @@ class TControl extends TComponent }
/**
+ * Finds all child and grand-child controls that are of the specified type.
+ * @param string the class name
+ * @return array list of controls found
+ */
+ public function findControlsByType($type)
+ {
+ $controls=array();
+ if($this->getHasControls())
+ {
+ foreach($this->_rf[self::RF_CONTROLS] as $control)
+ {
+ if($control instanceof $type)
+ $controls[]=$control;
+ if(($control instanceof TControl) && $control->getHasControls())
+ $controls=array_merge($controls,$control->findControlsByType($type));
+ }
+ }
+ return $controls;
+ }
+
+ /**
* Resets the control as a naming container.
* Only framework developers should use this method.
*/
|