1 | <?php |
||
25 | class Factory |
||
26 | { |
||
27 | use \Jaxon\Utils\Traits\Config; |
||
28 | |||
29 | /** |
||
30 | * The prefix to prepend on each call |
||
31 | * |
||
32 | * @var string |
||
33 | */ |
||
34 | protected $sPrefix = ''; |
||
35 | |||
36 | /** |
||
37 | * The callable repository |
||
38 | * |
||
39 | * @var CallableRepository |
||
40 | */ |
||
41 | protected $xRepository = null; |
||
42 | |||
43 | /** |
||
44 | * The class constructor |
||
45 | * |
||
46 | * @param CallableRepository $xRepository |
||
47 | */ |
||
48 | public function __construct(CallableRepository $xRepository) |
||
52 | |||
53 | /** |
||
54 | * Set the name of the class to call |
||
55 | * |
||
56 | * @param string|null $sClass The callable class |
||
57 | * |
||
58 | * @return Factory |
||
59 | */ |
||
60 | public function setClassName($sClass) |
||
80 | |||
81 | /** |
||
82 | * Set the callable object to call |
||
83 | * |
||
84 | * @param CallableObject $xCallable The callable object |
||
85 | * |
||
86 | * @return Factory |
||
87 | */ |
||
88 | public function setCallable(CallableObject $xCallable) |
||
94 | |||
95 | /** |
||
96 | * Return the javascript call to a Jaxon function or object method |
||
97 | * |
||
98 | * @param string $sFunction The function or method (without class) name |
||
99 | * @param ... $xParams The parameters of the function or method |
||
100 | * |
||
101 | * @return Request |
||
102 | */ |
||
103 | public function call($sFunction) |
||
123 | |||
124 | /** |
||
125 | * Return the javascript call to a generic function |
||
126 | * |
||
127 | * @param string $sFunction The function or method (with class) name |
||
128 | * @param ... $xParams The parameters of the function or method |
||
129 | * |
||
130 | * @return Request |
||
131 | */ |
||
132 | public function func($sFunction) |
||
144 | |||
145 | /** |
||
146 | * Make the pagination links for a registered Jaxon class method |
||
147 | * |
||
148 | * @param integer $nItemsTotal The total number of items |
||
149 | * @param integer $nItemsPerPage The number of items per page page |
||
150 | * @param integer $nCurrentPage The current page |
||
151 | * |
||
152 | * @return string the pagination links |
||
153 | */ |
||
154 | public function paginate($nItemsTotal, $nItemsPerPage, $nCurrentPage) |
||
163 | |||
164 | /** |
||
165 | * Make a parameter of type Jaxon::FORM_VALUES |
||
166 | * |
||
167 | * @param string $sFormId The id of the HTML form |
||
168 | * |
||
169 | * @return Parameter |
||
170 | */ |
||
171 | public function form($sFormId) |
||
175 | |||
176 | /** |
||
177 | * Make a parameter of type Jaxon::INPUT_VALUE |
||
178 | * |
||
179 | * @param string $sInputId the id of the HTML input element |
||
180 | * |
||
181 | * @return Parameter |
||
182 | */ |
||
183 | public function input($sInputId) |
||
187 | |||
188 | /** |
||
189 | * Make a parameter of type Jaxon::CHECKED_VALUE |
||
190 | * |
||
191 | * @param string $sInputId the name of the HTML form element |
||
192 | * |
||
193 | * @return Parameter |
||
194 | */ |
||
195 | public function checked($sInputId) |
||
199 | |||
200 | /** |
||
201 | * Make a parameter of type Jaxon::CHECKED_VALUE |
||
202 | * |
||
203 | * @param string $sInputId the name of the HTML form element |
||
204 | * |
||
205 | * @return Parameter |
||
206 | */ |
||
207 | public function select($sInputId) |
||
211 | |||
212 | /** |
||
213 | * Make a parameter of type Jaxon::ELEMENT_INNERHTML |
||
214 | * |
||
215 | * @param string $sElementId the id of the HTML element |
||
216 | * |
||
217 | * @return Parameter |
||
218 | */ |
||
219 | public function html($sElementId) |
||
223 | |||
224 | /** |
||
225 | * Make a parameter of type Jaxon::QUOTED_VALUE |
||
226 | * |
||
227 | * @param string $sValue the value of the parameter |
||
228 | * |
||
229 | * @return Parameter |
||
230 | */ |
||
231 | public function string($sValue) |
||
235 | |||
236 | /** |
||
237 | * Make a parameter of type Jaxon::NUMERIC_VALUE |
||
238 | * |
||
239 | * @param numeric $nValue the value of the parameter |
||
240 | * |
||
241 | * @return Parameter |
||
242 | */ |
||
243 | public function numeric($nValue) |
||
247 | |||
248 | /** |
||
249 | * Make a parameter of type Jaxon::NUMERIC_VALUE |
||
250 | * |
||
251 | * @param numeric $nValue the value of the parameter |
||
252 | * |
||
253 | * @return Parameter |
||
254 | */ |
||
255 | public function int($nValue) |
||
259 | |||
260 | /** |
||
261 | * Make a parameter of type Jaxon::JS_VALUE |
||
262 | * |
||
263 | * @param string $sValue the javascript code of the parameter |
||
264 | * |
||
265 | * @return Parameter |
||
266 | */ |
||
267 | public function javascript($sValue) |
||
271 | |||
272 | /** |
||
273 | * Make a parameter of type Jaxon::JS_VALUE |
||
274 | * |
||
275 | * @param string $sValue the javascript code of the parameter |
||
276 | * |
||
277 | * @return Parameter |
||
278 | */ |
||
279 | public function js($sValue) |
||
283 | |||
284 | /** |
||
285 | * Make a parameter of type Jaxon::PAGE_NUMBER |
||
286 | * |
||
287 | * @return Parameter |
||
288 | */ |
||
289 | public function page() |
||
294 | } |
||
295 |