blob: 2365326bc91cae189cfcf4a5e531cef73380ceb6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
|
<?php
/**
* TTriggeredCallback class file.
*
* @author Wei Zhuo <weizhuo[at]gamil[dot]com>
* @link http://www.pradosoft.com/
* @copyright Copyright © 2005-2013 PradoSoft
* @license http://www.pradosoft.com/license/
* @version $Id: TTriggeredCallback.php 3245 2013-01-07 20:23:32Z ctrlaltca $
* @package System.Web.UI.ActiveControls
*/
Prado::using('System.Web.UI.ActiveControls.TCallback');
/**
* TTriggeredCallback abstract Class
*
* Base class for triggered callback controls. The {@link setControlID ControlID}
* property sets the control ID to observe the trigger.
*
* @author Wei Zhuo <weizhuo[at]gmail[dot]com>
* @version $Id: TTriggeredCallback.php 3245 2013-01-07 20:23:32Z ctrlaltca $
* @package System.Web.UI.ActiveControls
* @since 3.1
*/
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['EventTarget'] = $this->getUniqueID();
$options['ControlID'] = $this->getTargetControl();
return $options;
}
}
|