1 | <?php |
||
24 | class JsCall implements JsonSerializable |
||
25 | { |
||
26 | /** |
||
27 | * The name of the javascript function |
||
28 | * |
||
29 | * @var string |
||
30 | */ |
||
31 | private $sFunction; |
||
32 | |||
33 | /** |
||
34 | * A string containing either a single or a double quote character that will be used |
||
35 | * during the generation of the javascript for this function. |
||
36 | * This can be set prior to calling <Request->getScript> |
||
37 | * |
||
38 | * @var string |
||
39 | */ |
||
40 | public $sQuoteCharacter; |
||
41 | |||
42 | /** |
||
43 | * An array of parameters that will be used to populate the argument list for this function |
||
44 | * when the javascript is output in <Request->getScript> |
||
45 | * |
||
46 | * @var array |
||
47 | */ |
||
48 | protected $aParameters; |
||
49 | |||
50 | /** |
||
51 | * The constructor. |
||
52 | * |
||
53 | * @param string $sFunction The javascript function |
||
54 | */ |
||
55 | public function __construct($sFunction) |
||
61 | |||
62 | /** |
||
63 | * Instruct the request to use single quotes when generating the javascript |
||
64 | * |
||
65 | * @return void |
||
66 | */ |
||
67 | public function useSingleQuote() |
||
72 | |||
73 | /** |
||
74 | * Instruct the request to use single quotes when generating the javascript |
||
75 | * |
||
76 | * @return void |
||
77 | */ |
||
78 | public function useSingleQuotes() |
||
83 | |||
84 | /** |
||
85 | * Instruct the request to use double quotes while generating the javascript |
||
86 | * |
||
87 | * @return void |
||
88 | */ |
||
89 | public function useDoubleQuote() |
||
93 | |||
94 | /** |
||
95 | * Instruct the request to use double quotes while generating the javascript |
||
96 | * |
||
97 | * @return void |
||
98 | */ |
||
99 | public function useDoubleQuotes() |
||
103 | |||
104 | /** |
||
105 | * Clear the parameter list associated with this request |
||
106 | * |
||
107 | * @return void |
||
108 | */ |
||
109 | public function clearParameters() |
||
113 | |||
114 | /** |
||
115 | * Set the value of the parameter at the given position |
||
116 | * |
||
117 | * @param Interfaces\Parameter $xParameter The value to be used |
||
118 | * |
||
119 | * @return void |
||
120 | */ |
||
121 | public function pushParameter(Interfaces\Parameter $xParameter) |
||
125 | |||
126 | /** |
||
127 | * Add a parameter value to the parameter list for this request |
||
128 | * |
||
129 | * @param string $sType The type of the value to be used |
||
130 | * @param string $sValue The value to be used |
||
131 | * |
||
132 | * Types should be one of the following <Jaxon::FORM_VALUES>, <Jaxon::QUOTED_VALUE>, <Jaxon::NUMERIC_VALUE>, |
||
133 | * <Jaxon::JS_VALUE>, <Jaxon::INPUT_VALUE>, <Jaxon::CHECKED_VALUE>, <Jaxon::PAGE_NUMBER>. |
||
134 | * The value should be as follows: |
||
135 | * - <Jaxon::FORM_VALUES> - Use the ID of the form you want to process. |
||
136 | * - <Jaxon::QUOTED_VALUE> - The string data to be passed. |
||
137 | * - <Jaxon::JS_VALUE> - A string containing valid javascript |
||
138 | * (either a javascript variable name that will be in scope at the time of the call or |
||
139 | * a javascript function call whose return value will become the parameter). |
||
140 | * |
||
141 | * @return void |
||
142 | */ |
||
143 | public function addParameter($sType, $sValue) |
||
147 | |||
148 | /** |
||
149 | * Add a set of parameters to this request |
||
150 | * |
||
151 | * @param array $aParameters The parameters |
||
152 | * |
||
153 | * @return void |
||
154 | */ |
||
155 | public function addParameters(array $aParameters) |
||
169 | |||
170 | /** |
||
171 | * Returns a string representation of the script output (javascript) from this request object |
||
172 | * |
||
173 | * @return string |
||
174 | */ |
||
175 | public function getScript() |
||
179 | |||
180 | /** |
||
181 | * Convert this request object to string |
||
182 | * |
||
183 | * @return string |
||
184 | */ |
||
185 | public function __toString() |
||
189 | |||
190 | /** |
||
191 | * Convert this request object to string, when converting the response into json. |
||
192 | * |
||
193 | * This is a method of the JsonSerializable interface. |
||
194 | * |
||
195 | * @return string |
||
196 | */ |
||
197 | public function jsonSerialize() |
||
201 | } |
||
202 |