summaryrefslogtreecommitdiff
path: root/framework/Web/UI/TControl.php
diff options
context:
space:
mode:
authorxue <>2006-03-16 22:04:31 +0000
committerxue <>2006-03-16 22:04:31 +0000
commit3ec0ec6275b1ab8a95b2696febcdd0284732fce2 (patch)
tree3c83a2cfd80416b63ac784e2a2c6733389691088 /framework/Web/UI/TControl.php
parentb683553fc8d08bd1c398a471bf7d19fb47f8b2b5 (diff)
Added findControlsByID.
Diffstat (limited to 'framework/Web/UI/TControl.php')
-rw-r--r--framework/Web/UI/TControl.php27
1 files changed, 27 insertions, 0 deletions
diff --git a/framework/Web/UI/TControl.php b/framework/Web/UI/TControl.php
index 4b5696bd..21482b0a 100644
--- a/framework/Web/UI/TControl.php
+++ b/framework/Web/UI/TControl.php
@@ -897,6 +897,33 @@ class TControl extends TApplicationComponent
}
/**
+ * Finds all child and grand-child controls with the specified ID.
+ * Note, this method is different from {@link findControl} in that
+ * it searches through all controls that have this control as the ancestor
+ * while {@link findcontrol} only searches through controls that have this
+ * control as the direct naming container.
+ * @param string the ID being looked for
+ * @return array list of controls found
+ */
+ public function findControlsByID($id)
+ {
+ $controls=array();
+ if($this->getHasControls())
+ {
+ foreach($this->_rf[self::RF_CONTROLS] as $control)
+ {
+ if($control instanceof TControl)
+ {
+ if($control->_id===$id)
+ $controls[]=$control;
+ $controls=array_merge($controls,$control->findControlsByID($id));
+ }
+ }
+ }
+ return $controls;
+ }
+
+ /**
* Resets the control as a naming container.
* Only framework developers should use this method.
*/