ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
base.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
25
40function base()
41{
42 global $DIC;
43 $factory = $DIC->ui()->factory();
44 $renderer = $DIC->ui()->renderer();
45
46 $df = new \ILIAS\Data\Factory();
47 $refinery = $DIC['refinery'];
48
49 $here_uri = $df->uri($DIC->http()->request()->getUri()->__toString());
50 $url_builder = new URLBuilder($here_uri);
51
52 //The messagebox we are going to wrap into the prompt
53 $message = $factory->messageBox()->success('some message box')
54 ->withButtons([$factory->button()->standard('some Action', '#')]);
55
56 //when expecting a state, we do not want to render other examples
57 $example_namespace = ['prompt', 'endpoints'];
58 list($url_builder, $endpointtoken) = $url_builder->acquireParameters($example_namespace, "endpoint");
59 $url_builder = $url_builder->withParameter($endpointtoken, "true");
60
61 //build the prompt
62 $query_namespace = ['prompt', 'example0'];
63 list($url_builder, $token) = $url_builder->acquireParameters($query_namespace, "show");
64 $url_builder = $url_builder->withParameter($token, "true");
65 $prompt = $factory->prompt()->standard($url_builder->buildURI());
66
67 //build the endpoint returning the wrapped message
68 $query = $DIC->http()->wrapper()->query();
69 if ($query->has($token->getName())) {
70 $response = $factory->prompt()->state()->show($message);
71 echo($renderer->renderAsync($response));
72 exit();
73 }
74
75 //a button to open the prompt:
76 $show_button = $factory->button()->standard('Show Simple Prompt', $prompt->getShowSignal());
77
78 if (!$query->has($endpointtoken->getName())) {
79 return $renderer->render([
81 $prompt,
82 $show_button
83 ]);
84 }
85}
$renderer
exit
Flags some Component to be a valid content of a Prompt.
global $DIC
Definition: shib_login.php:26
$message
Definition: xapiexit.php:31
$token
Definition: xapitoken.php:70
$response
Definition: xapitoken.php:93