ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
show_multi_step_modal.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
24
37{
38 global $DIC;
39 $f = $DIC->ui()->factory();
40 $r = $DIC->ui()->renderer();
41 $refinery = $DIC->refinery();
42 $request_wrapper = $DIC->http()->wrapper()->query();
43
44 $url = $_SERVER['REQUEST_URI'];
45
46 $page = "";
47 if ($request_wrapper->has('page')) {
48 $page = $request_wrapper->retrieve('page', $refinery->kindlyTo()->string());
49 }
50 if ($page == "") {
51 $modal = $f->modal()->roundtrip("Modal Title", $f->legacy()->content("b"));
52 $asyncUrl = $url . '&page=login&replaceSignal=' . $modal->getReplaceSignal()->getId();
53 $modal = $modal->withAsyncRenderUrl($asyncUrl);
54 $button = $f->button()->standard("Sign In", '#')
55 ->withOnClick($modal->getShowSignal());
56 return $r->render([$modal, $button]);
57 } else {
58 $signalId = "";
59 if ($request_wrapper->has('replaceSignal')) {
60 $signalId = $request_wrapper->retrieve('replaceSignal', $refinery->kindlyTo()->string());
61 }
62 $replaceSignal = new ReplaceSignal($signalId);
63 $button1 = $f->button()->standard('Login', '#')
64 ->withOnClick($replaceSignal->withAsyncRenderUrl($url . '&page=login&replaceSignal=' . $replaceSignal->getId()));
65 $button2 = $f->button()->standard('Registration', '#')
66 ->withOnClick($replaceSignal->withAsyncRenderUrl($url . '&page=register&replaceSignal=' . $replaceSignal->getId()));
67
68 $modal = null;
69 if ($page == "login") {
70 $legacy = $f->legacy()->content("<p>The Login Page</p>");
71 $modal = $f->modal()->roundtrip("Login", [$legacy])->withActionButtons([$button1, $button2]);
72 }
73 if ($page == "register") {
74 $legacy = $f->legacy()->content("<p>The Registration Page</p>");
75 $modal = $f->modal()->roundtrip("Registration", [$legacy])->withActionButtons([$button1, $button2]);
76 }
77
78 echo $r->renderAsync([$modal]);
79 exit;
80 }
81}
exit
$_SERVER['HTTP_HOST']
Definition: raiseError.php:26
global $DIC
Definition: shib_login.php:26
$url
Definition: shib_logout.php:68