/
_actions.php
93 lines (87 loc) · 3.03 KB
/
_actions.php
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
<?php
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
class MJaxBaseAction extends QBaseClass{
protected $objEvent = null;
public function SetEvent($objEvent){
$this->objEvent = $objEvent;
}
}
class MJaxServerControlAction extends MJaxBaseAction{
protected $objTargetControl = null;
protected $strFunction = null;
public function __construct($objTargetControl, $strFunction){
$this->objTargetControl = $objTargetControl;
$this->strFunction = $strFunction;
}
public function Render(){
$strRendered = 'function(objEvent){';
$strRendered .= sprintf("MJax.TriggerControlEvent(objEvent, '%s', '%s');", $this->objEvent->Selector, $this->objEvent->EventName);
//The following wont render anything unless blnOnce is set to true
$strRendered .= $this->objEvent->RenderUnbind();
$strRendered .= '}';
return $strRendered;
}
public function Exicute($strFormId, $strControlId, $strParameter){
$strFunction = $this->strFunction;
$this->objTargetControl->$strFunction($strFormId, $strControlId, $strParameter);
}
public function __get($strName) {
switch ($strName) {
//case "KeyCode": return $this->strKeyCode;
default:
try {
return parent::__get($strName);
} catch (QCallerException $objExc) {
$objExc->IncrementOffset();
throw $objExc;
}
}
}
/////////////////////////
// Public Properties: SET
/////////////////////////
public function __set($strName, $mixValue) {
switch ($strName) {
/* case "KeyCode":
try {
return ($this->strKeyCode = $mixValue);
} catch (QCallerException $objExc) {
$objExc->IncrementOffset();
throw $objExc;
}*/
default:
try {
return parent::__set($strName, $mixValue);
} catch (QCallerException $objExc) {
$objExc->IncrementOffset();
throw $objExc;
}
}
}
}
class MJaxJavascriptAction extends MJaxBaseAction{
protected $strCode = null;
public function __construct($strCode){
$this->strCode = $strCode;
}
public function Render(){
$strRendered = '';
$strRendered .= $this->strCode;
//The following wont render anything unless blnOnce is set to true
$strRendered .= $this->objEvent->RenderUnbind();
$strRendered .= '';
return $strRendered;
}
}
class MJaxPluginAction extends MJaxJavascriptAction{
public function __construct($objPlugin){
$strRendered = $objPlugin->Render(false);
//$strCommand = substr($strRendered, 0, strlen($strRendered) - 1);
$strCommand = sprintf("function(){%s}", $strRendered);
parent::__construct($strCommand);
}
}
?>