ILIAS  release_10 Revision v10.1-43-ga1241a92c2f
show_multi_step_modal.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
6 
8 
21 {
22  global $DIC;
23  $f = $DIC->ui()->factory();
24  $r = $DIC->ui()->renderer();
25  $refinery = $DIC->refinery();
26  $request_wrapper = $DIC->http()->wrapper()->query();
27 
28  $url = $_SERVER['REQUEST_URI'];
29 
30  $page = "";
31  if ($request_wrapper->has('page')) {
32  $page = $request_wrapper->retrieve('page', $refinery->kindlyTo()->string());
33  }
34  if ($page == "") {
35  $modal = $f->modal()->roundtrip("Modal Title", $f->legacy("b"));
36  $asyncUrl = $url . '&page=login&replaceSignal=' . $modal->getReplaceSignal()->getId();
37  $modal = $modal->withAsyncRenderUrl($asyncUrl);
38  $button = $f->button()->standard("Sign In", '#')
39  ->withOnClick($modal->getShowSignal());
40  return $r->render([$modal, $button]);
41  } else {
42  $signalId = "";
43  if ($request_wrapper->has('replaceSignal')) {
44  $signalId = $request_wrapper->retrieve('replaceSignal', $refinery->kindlyTo()->string());
45  }
46  $replaceSignal = new ReplaceSignal($signalId);
47  $button1 = $f->button()->standard('Login', '#')
48  ->withOnClick($replaceSignal->withAsyncRenderUrl($url . '&page=login&replaceSignal=' . $replaceSignal->getId()));
49  $button2 = $f->button()->standard('Registration', '#')
50  ->withOnClick($replaceSignal->withAsyncRenderUrl($url . '&page=register&replaceSignal=' . $replaceSignal->getId()));
51 
52  $modal = null;
53  if ($page == "login") {
54  $legacy = $f->legacy("<p>The Login Page</p>");
55  $modal = $f->modal()->roundtrip("Login", [$legacy])->withActionButtons([$button1, $button2]);
56  }
57  if ($page == "register") {
58  $legacy = $f->legacy("<p>The Registration Page</p>");
59  $modal = $f->modal()->roundtrip("Registration", [$legacy])->withActionButtons([$button1, $button2]);
60  }
61 
62  echo $r->renderAsync([$modal]);
63  exit;
64  }
65 }
$url
Definition: shib_logout.php:63
$_SERVER['HTTP_HOST']
Definition: raiseError.php:10
global $DIC
Definition: shib_login.php:25
show_multi_step_modal()
description: > Example for rendering a round trip multi-step modal.
$r