1 | <?php |
||
33 | 1 | final class Control extends BaseControl |
|
34 | { |
||
35 | /** |
||
36 | * @var IConfirmer |
||
37 | */ |
||
38 | private $confirmerFactory; |
||
39 | |||
40 | /** |
||
41 | * @var Confirmer |
||
42 | */ |
||
43 | private $confirmer; |
||
44 | |||
45 | /** |
||
46 | * @var bool |
||
47 | */ |
||
48 | private $useAjax = TRUE; |
||
49 | |||
50 | /** |
||
51 | * @param string|NULL $layoutFile |
||
52 | * @param string|NULL $templateFile |
||
53 | * @param IConfirmer $confirmerFactory |
||
54 | * |
||
55 | * @throws Exceptions\InvalidArgumentException |
||
56 | */ |
||
57 | public function __construct( |
||
77 | |||
78 | /** |
||
79 | * Change default dialog layout path |
||
80 | * |
||
81 | * @param string $layoutFile |
||
82 | * |
||
83 | * @return void |
||
84 | * |
||
85 | * @throws Exceptions\InvalidArgumentException |
||
86 | */ |
||
87 | public function setLayoutFile(string $layoutFile) : void |
||
91 | |||
92 | /** |
||
93 | * Change default confirmer template path |
||
94 | * |
||
95 | * @param string $layoutFile |
||
96 | * |
||
97 | * @return void |
||
98 | * |
||
99 | * @throws Exceptions\InvalidArgumentException |
||
100 | */ |
||
101 | public function setTemplateFile(string $layoutFile) : void |
||
105 | |||
106 | /** |
||
107 | * @return string |
||
108 | */ |
||
109 | public function getTemplateFile() : string |
||
114 | |||
115 | /** |
||
116 | * Overrides signal method formatter |
||
117 | * This provide "dynamically named signals" |
||
118 | * |
||
119 | * @param string $signal |
||
120 | * |
||
121 | * @return string |
||
122 | */ |
||
123 | public static function formatSignalMethod($signal) : string |
||
131 | |||
132 | /** |
||
133 | * Add confirmation handler to "dynamicaly named signals" |
||
134 | * |
||
135 | * @param string $name Confirmation/signal name |
||
136 | * @param callback|Utils\Callback $handler Callback called when confirmation succeed |
||
137 | * @param callback|string $question Callback ($confirmer, $params) or string containing question text |
||
138 | * @param callback|string $heading Callback ($confirmer, $params) or string containing heading text |
||
139 | * |
||
140 | * @return void |
||
141 | * |
||
142 | * @throws Exceptions\InvalidArgumentException |
||
143 | */ |
||
144 | public function addConfirmer(string $name, $handler, $question, $heading) : void |
||
165 | |||
166 | /** |
||
167 | * @param string $name |
||
168 | * |
||
169 | * @return Confirmer |
||
170 | * |
||
171 | * @throws Exceptions\InvalidArgumentException |
||
172 | */ |
||
173 | public function getConfirmer(string $name) : Confirmer |
||
184 | |||
185 | /** |
||
186 | * @return void |
||
187 | */ |
||
188 | public function resetConfirmer() : void |
||
195 | |||
196 | /** |
||
197 | * @return Application\UI\Multiplier |
||
198 | */ |
||
199 | protected function createComponentConfirmer() : Application\UI\Multiplier |
||
219 | |||
220 | /** |
||
221 | * Show dialog for confirmation |
||
222 | * |
||
223 | * @param string $name |
||
224 | * @param array $params |
||
225 | * |
||
226 | * @return void |
||
227 | * |
||
228 | * @throws Exceptions\InvalidArgumentException |
||
229 | * @throws Exceptions\InvalidStateException |
||
230 | */ |
||
231 | public function showConfirm(string $name, array $params = []) : void |
||
244 | |||
245 | /** |
||
246 | * Dynamically named signal receiver |
||
247 | * |
||
248 | * @return void |
||
249 | * |
||
250 | * @throws Exceptions\InvalidArgumentException |
||
251 | * @throws Exceptions\InvalidStateException |
||
252 | */ |
||
253 | public function handleShowConfirmer() : void |
||
272 | |||
273 | /** |
||
274 | * @return void |
||
275 | */ |
||
276 | public function enableAjax() : void |
||
280 | |||
281 | /** |
||
282 | * @return void |
||
283 | */ |
||
284 | public function disableAjax() : void |
||
288 | |||
289 | /** |
||
290 | * Render control |
||
291 | * |
||
292 | * @return void |
||
293 | * |
||
294 | * @throws Exceptions\InvalidStateException |
||
295 | */ |
||
296 | public function render() : void |
||
320 | |||
321 | /** |
||
322 | * @param string $name |
||
323 | * |
||
324 | * @return Confirmer |
||
325 | * |
||
326 | * @throws Exceptions\InvalidArgumentException |
||
327 | */ |
||
328 | private function getConfirmerControl(string $name) : Confirmer |
||
338 | } |
||
339 |