1 | <?php |
||
35 | 1 | final class Control extends BaseControl |
|
36 | { |
||
37 | /** |
||
38 | * @var IConfirmer |
||
39 | */ |
||
40 | private $confirmerFactory; |
||
41 | |||
42 | /** |
||
43 | * @var Confirmer |
||
44 | */ |
||
45 | private $confirmer; |
||
46 | |||
47 | /** |
||
48 | * @var bool |
||
49 | */ |
||
50 | private $useAjax = TRUE; |
||
51 | |||
52 | /** |
||
53 | * @param string|NULL $layoutFile |
||
54 | * @param string|NULL $templateFile |
||
55 | * @param IConfirmer $confirmerFactory |
||
56 | */ |
||
57 | public function __construct( |
||
77 | |||
78 | /** |
||
79 | * Change default dialog layout path |
||
80 | * |
||
81 | * @param string $layoutFile |
||
82 | * |
||
83 | * @return void |
||
84 | */ |
||
85 | public function setLayoutFile(string $layoutFile) |
||
89 | |||
90 | /** |
||
91 | * Change default confirmer template path |
||
92 | * |
||
93 | * @param string $layoutFile |
||
94 | * |
||
95 | * @return void |
||
96 | */ |
||
97 | public function setTemplateFile(string $layoutFile) |
||
101 | |||
102 | /** |
||
103 | * @return string |
||
104 | */ |
||
105 | public function getTemplateFile() : string |
||
110 | |||
111 | /** |
||
112 | * Overrides signal method formatter |
||
113 | * This provide "dynamically named signals" |
||
114 | * |
||
115 | * @param string $signal |
||
116 | * |
||
117 | * @return string |
||
118 | */ |
||
119 | public static function formatSignalMethod($signal) : string |
||
127 | |||
128 | /** |
||
129 | * Add confirmation handler to "dynamicaly named signals" |
||
130 | * |
||
131 | * @param string $name Confirmation/signal name |
||
132 | * @param callback|Nette\Utils\Callback $handler Callback called when confirmation succeed |
||
133 | * @param callback|string $question Callback ($confirmer, $params) or string containing question text |
||
134 | * @param callback|string $heading Callback ($confirmer, $params) or string containing heading text |
||
135 | * |
||
136 | * @return void |
||
137 | * |
||
138 | * @throws Exceptions\InvalidArgumentException |
||
139 | */ |
||
140 | public function addConfirmer(string $name, $handler, $question, $heading) |
||
161 | |||
162 | /** |
||
163 | * @param string $name |
||
164 | * |
||
165 | * @return Confirmer |
||
166 | * |
||
167 | * @throws Exceptions\InvalidArgumentException |
||
168 | */ |
||
169 | public function getConfirmer(string $name) : Confirmer |
||
180 | |||
181 | /** |
||
182 | * @return void |
||
183 | */ |
||
184 | public function resetConfirmer() |
||
191 | |||
192 | /** |
||
193 | * @return Application\UI\Multiplier |
||
194 | * |
||
195 | * @throws Exceptions\InvalidArgumentException |
||
196 | */ |
||
197 | protected function createComponentConfirmer() : Application\UI\Multiplier |
||
217 | |||
218 | /** |
||
219 | * Show dialog for confirmation |
||
220 | * |
||
221 | * @param string $name |
||
222 | * @param array $params |
||
223 | * |
||
224 | * @return void |
||
225 | * |
||
226 | * @throws Exceptions\InvalidArgumentException |
||
227 | * @throws Exceptions\InvalidStateException |
||
228 | */ |
||
229 | public function showConfirm(string $name, array $params = []) |
||
242 | |||
243 | /** |
||
244 | * Dynamically named signal receiver |
||
245 | * |
||
246 | * @return void |
||
247 | * |
||
248 | * @throws Exceptions\InvalidArgumentException |
||
249 | * @throws Exceptions\InvalidStateException |
||
250 | */ |
||
251 | public function handleShowConfirmer() |
||
270 | |||
271 | /** |
||
272 | * @return void |
||
273 | */ |
||
274 | public function enableAjax() |
||
278 | |||
279 | /** |
||
280 | * @return void |
||
281 | */ |
||
282 | public function disableAjax() |
||
286 | |||
287 | /** |
||
288 | * Render control |
||
289 | * |
||
290 | * @return void |
||
291 | * |
||
292 | * @throws Exceptions\InvalidStateException |
||
293 | */ |
||
294 | public function render() |
||
318 | |||
319 | /** |
||
320 | * @param string $name |
||
321 | * |
||
322 | * @return Confirmer |
||
323 | * |
||
324 | * @throws Exceptions\InvalidArgumentException |
||
325 | */ |
||
326 | private function getConfirmerControl(string $name) : Confirmer |
||
336 | } |
||
337 |