summaryrefslogtreecommitdiff
path: root/framework/Web/UI/ActiveControls/TTriggeredCallback.php
diff options
context:
space:
mode:
Diffstat (limited to 'framework/Web/UI/ActiveControls/TTriggeredCallback.php')
-rw-r--r--framework/Web/UI/ActiveControls/TTriggeredCallback.php49
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