ILIAS  trunk Revision v11.0_alpha-1761-g6dbbfa7b760
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
base.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
22 
25 
34 function base()
35 {
36  global $DIC;
37  $factory = $DIC->ui()->factory();
38  $renderer = $DIC->ui()->renderer();
39  $df = new \ILIAS\Data\Factory();
40  $here_uri = $df->uri($DIC->http()->request()->getUri()->__toString());
41  $url_builder = new URLBuilder($here_uri);
42 
43  //a response may contain Components implementing IsPromptContent interface.
44  $content = $factory->input()->container()->form()->standard(
45  $url_builder->buildURI()->__toString(),
46  [$factory->input()->field()->text("Text Input")]
47  );
48 
49  $response = $factory->prompt()->state()->show($content);
50 
51  //endpoint to return response on (asynch) call
52  $refinery = $DIC['refinery'];
53  $example_namespace = ['prompt', 'response'];
54  list($url_builder, $url_token) = $url_builder->acquireParameters(
55  $example_namespace,
56  "response"
57  );
58  $query = $DIC->http()->wrapper()->query();
59  if ($query->has($url_token->getName())) {
60  echo($renderer->renderAsync($response));
61  exit();
62  }
63 
64  //build the prompt
65  $prompt = $factory->prompt()->standard($url_builder->buildURI());
66  $show_button = $factory->button()->standard('Show Prompt', $prompt->getShowSignal());
67 
68 
69  //show the response contents:
70  $txt_response = $factory->legacy()->content(
71  '<pre>'
72  . htmlentities($renderer->render($response))
73  . '</pre>'
74  );
75 
76  return $renderer->render([
77  $txt_response,
78  $show_button,
79  $prompt
80  ]);
81 
82 }
$renderer
base()
description: > The example displays the HTML of a State.
Definition: base.php:34
$response
Definition: xapitoken.php:93
global $DIC
Definition: shib_login.php:22
URLBuilder.
Definition: URLBuilder.php:40
exit
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...