diff options
author | wei <> | 2006-08-12 12:54:27 +0000 |
---|---|---|
committer | wei <> | 2006-08-12 12:54:27 +0000 |
commit | 1180e6486139a9c9662984367c4f624394e06f35 (patch) | |
tree | f89a379960284595d5a425e22424582eea57422c /framework/Web/UI/ActiveControls/TTriggeredCallback.php | |
parent | 54d4919e3f1b00b644fa3c107acdf20159a1b154 (diff) |
Add Triggered Callbacks
Diffstat (limited to 'framework/Web/UI/ActiveControls/TTriggeredCallback.php')
-rw-r--r-- | framework/Web/UI/ActiveControls/TTriggeredCallback.php | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/framework/Web/UI/ActiveControls/TTriggeredCallback.php b/framework/Web/UI/ActiveControls/TTriggeredCallback.php new file mode 100644 index 00000000..076166c9 --- /dev/null +++ b/framework/Web/UI/ActiveControls/TTriggeredCallback.php @@ -0,0 +1,49 @@ +<?php
+
+abstract class TTriggeredCallback extends TCallback
+{
+ /**
+ * @return string The ID of the server control the trigger is bounded to.
+ */
+ public function getControlID()
+ {
+ return $this->getViewState('ControlID', '');
+ }
+
+ /**
+ * @param string The ID of the server control the trigger is bounded to.
+ */
+ public function setControlID($value)
+ {
+ $this->setViewState('ControlID', $value, '');
+ }
+
+ /**
+ * @return string target control client ID or html element ID if
+ * control is not found in hierarchy.
+ */
+ protected function getTargetControl()
+ {
+ $id = $this->getControlID();
+ if(($control=$this->findControl($id)) instanceof TControl)
+ return $control->getClientID();
+ if($id==='')
+ {
+ throw new TConfigurationException(
+ 'ttriggeredcallback_invalid_controlid', get_class($this));
+ }
+ return $id;
+ }
+
+ /**
+ * @return array list of trigger callback options.
+ */
+ protected function getTriggerOptions()
+ {
+ $options['ID'] = $this->getClientID();
+ $options['ControlID'] = $this->getTargetControl();
+ return $options;
+ }
+}
+
+?>
\ No newline at end of file |