|
27 | 27 | use ILIAS\Data\Link; |
28 | 28 | use ILIAS\Data\Result; |
29 | 29 | use ILIAS\Data\Password; |
| 30 | +use ILIAS\UI\Implementation\Component\Launcher\Inline; |
30 | 31 | use ILIAS\UI\Component\Launcher\Launcher; |
31 | 32 | use ILIAS\UI\Component\Launcher\Factory as LauncherFactory; |
32 | 33 | use ILIAS\UI\Component\MessageBox\MessageBox; |
@@ -315,9 +316,29 @@ function (Result $result) { |
315 | 316 | && $request->getQueryParams()[$key] === 'exam_modal') { |
316 | 317 | $launcher = $launcher->withRequest($request); |
317 | 318 | } |
| 319 | + |
| 320 | + if ($this->shouldOpenModal()) { |
| 321 | + /** @var Inline $launcher */ |
| 322 | + $modal = $launcher->getModal(); |
| 323 | + $show_signal = $modal->getShowSignal(); |
| 324 | + |
| 325 | + $this->tpl->addOnLoadCode(" |
| 326 | + (function() { |
| 327 | + setTimeout(function() { |
| 328 | + $(document).trigger('$show_signal', {}); |
| 329 | + }); |
| 330 | + })(); |
| 331 | + "); |
| 332 | + } |
| 333 | + |
318 | 334 | return $launcher; |
319 | 335 | } |
320 | 336 |
|
| 337 | + private function shouldOpenModal(): bool |
| 338 | + { |
| 339 | + return ($this->http->request()->getQueryParams()['launcher_id'] ?? '') === 'exam_modal'; |
| 340 | + } |
| 341 | + |
321 | 342 | private function getModalLauncherLink(): Link |
322 | 343 | { |
323 | 344 | $uri = $this->data_factory->uri($this->http->request()->getUri()->__toString())->withParameter('launcher_id', 'exam_modal'); |
@@ -386,6 +407,10 @@ private function getModalLauncherMessageBox(): ?MessageBox |
386 | 407 | $modal_message_box_message = $this->lng->txt('tst_exam_modal_message_password'); |
387 | 408 | } |
388 | 409 |
|
| 410 | + if ($this->shouldOpenModal()) { |
| 411 | + return $this->ui_factory->messageBox()->failure($this->lng->txt('tst_exam_password_invalid_message')); |
| 412 | + } |
| 413 | + |
389 | 414 | return isset($modal_message_box_message) ? $this->ui_factory->messageBox()->info($modal_message_box_message) : null; |
390 | 415 | } |
391 | 416 |
|
|
0 commit comments