| 1 |
lars |
1 |
<?php
|
|
|
2 |
/**
|
|
|
3 |
* TTriggeredCallback class file.
|
|
|
4 |
*
|
|
|
5 |
* @author Wei Zhuo <weizhuo[at]gamil[dot]com>
|
|
|
6 |
* @link http://www.pradosoft.com/
|
|
|
7 |
* @copyright Copyright © 2005-2008 PradoSoft
|
|
|
8 |
* @license http://www.pradosoft.com/license/
|
|
|
9 |
* @version $Id: TTriggeredCallback.php 2541 2008-10-21 15:05:13Z qiang.xue $
|
|
|
10 |
* @package System.Web.UI.ActiveControls
|
|
|
11 |
*/
|
|
|
12 |
|
|
|
13 |
/**
|
|
|
14 |
* TTriggeredCallback abstract Class
|
|
|
15 |
*
|
|
|
16 |
* Base class for triggered callback controls. The {@link setControlID ControlID}
|
|
|
17 |
* property sets the control ID to observe the trigger.
|
|
|
18 |
*
|
|
|
19 |
* @author Wei Zhuo <weizhuo[at]gmail[dot]com>
|
|
|
20 |
* @version $Id: TTriggeredCallback.php 2541 2008-10-21 15:05:13Z qiang.xue $
|
|
|
21 |
* @package System.Web.UI.ActiveControls
|
|
|
22 |
* @since 3.1
|
|
|
23 |
*/
|
|
|
24 |
abstract class TTriggeredCallback extends TCallback
|
|
|
25 |
{
|
|
|
26 |
/**
|
|
|
27 |
* @return string The ID of the server control the trigger is bounded to.
|
|
|
28 |
*/
|
|
|
29 |
public function getControlID()
|
|
|
30 |
{
|
|
|
31 |
return $this->getViewState('ControlID', '');
|
|
|
32 |
}
|
|
|
33 |
|
|
|
34 |
/**
|
|
|
35 |
* @param string The ID of the server control the trigger is bounded to.
|
|
|
36 |
*/
|
|
|
37 |
public function setControlID($value)
|
|
|
38 |
{
|
|
|
39 |
$this->setViewState('ControlID', $value, '');
|
|
|
40 |
}
|
|
|
41 |
|
|
|
42 |
/**
|
|
|
43 |
* @return string target control client ID or html element ID if
|
|
|
44 |
* control is not found in hierarchy.
|
|
|
45 |
*/
|
|
|
46 |
protected function getTargetControl()
|
|
|
47 |
{
|
|
|
48 |
$id = $this->getControlID();
|
|
|
49 |
if(($control=$this->findControl($id)) instanceof TControl)
|
|
|
50 |
return $control->getClientID();
|
|
|
51 |
if($id==='')
|
|
|
52 |
{
|
|
|
53 |
throw new TConfigurationException(
|
|
|
54 |
'ttriggeredcallback_invalid_controlid', get_class($this));
|
|
|
55 |
}
|
|
|
56 |
return $id;
|
|
|
57 |
}
|
|
|
58 |
|
|
|
59 |
/**
|
|
|
60 |
* @return array list of trigger callback options.
|
|
|
61 |
*/
|
|
|
62 |
protected function getTriggerOptions()
|
|
|
63 |
{
|
|
|
64 |
$options['ID'] = $this->getClientID();
|
|
|
65 |
$options['EventTarget'] = $this->getUniqueID();
|
|
|
66 |
$options['ControlID'] = $this->getTargetControl();
|
|
|
67 |
return $options;
|
|
|
68 |
}
|
|
|
69 |
}
|
|
|
70 |
|