19 declare(strict_types=1);
42 $factory = $DIC->ui()->factory();
45 $df = new \ILIAS\Data\Factory();
48 $here_uri = $df->uri($DIC->http()->request()->getUri()->__toString());
52 $example_namespace = [
'prompt',
'endpoints'];
53 list($url_builder, $endpointtoken) = $url_builder->acquireParameters($example_namespace,
"endpoint");
54 $url_builder = $url_builder->withParameter($endpointtoken,
"true");
57 $query_namespace = [
'prompt',
'example1'];
58 list($url_builder, $action_token, $amount_token) = $url_builder->acquireParameters($query_namespace,
"action",
"amount");
59 $url_builder = $url_builder->withParameter($action_token,
"showprompt");
61 $default_uri = $url_builder->withParameter($amount_token,
"1")->buildURI();
62 $prompt = $factory->prompt()->standard($default_uri);
65 $query = $DIC->http()->wrapper()->query();
66 $icon = $factory->symbol()->icon()->standard(
'someExample',
'Example');
70 if ($query->has($action_token->getName())) {
71 $action = $query->retrieve($action_token->getName(),
$refinery->kindlyTo()->string());
72 $amount = $query->retrieve($amount_token->getName(),
$refinery->kindlyTo()->int()) ;
75 foreach (range(1, $amount) as $idx) {
76 $link_uri = $url_builder
77 ->withParameter($action_token,
"promptlink")
78 ->withParameter($amount_token, (
string) $idx)
79 ->buildURI()->__toString();
80 $links[] = $factory->link()->standard((
string) $idx, $link_uri);
83 $factory->button()->standard(
'OK',
'#')->withOnLoadCode(
84 fn(
$id) =>
"$('#$id').on('click', (e)=> {alert('$id');});" 87 $prompt_content = $factory->messageBox()->info(
'some text')
89 ->withButtons($buttons);
93 $back_uri = $url_builder
94 ->withParameter($action_token,
"showprompt")
95 ->withParameter($amount_token, (
string) $amount)
96 ->buildURI()->__toString();
97 $back = $factory->button()->standard(
'back',
'#')->withOnLoadCode(
98 fn(
$id) =>
"$('#$id').on('click', (e)=> { 99 let promptId = e.target.closest('.il-prompt').id; 100 il.UI.prompt.get(promptId).show('$back_uri'); 103 $prompt_content = $factory->messageBox()->info((
string) $amount)
104 ->withButtons([$back]);
108 throw new \Exception(
'?' . $action . $amount);
111 $response = $factory->prompt()->state()->show($prompt_content);
116 if (!$query->has($endpointtoken->getName())) {
117 $show_button = $factory->button()->standard(
'Show Simple Prompt', $prompt->getShowSignal());
118 $close_button = $factory->button()->standard(
'close Simple Prompt', $prompt->getCloseSignal());
120 $uri = $url_builder->withParameter($amount_token,
"8")->buildURI();
121 $show_button8 = $factory->button()->standard(
'Show Prompt with Parameter', $prompt->getShowSignal($uri));
123 $uri = $url_builder->withParameter($amount_token,
"78")->buildURI();
124 $show_button78 = $factory->button()->standard(
'Show Prompt with a lot of Items', $prompt->getShowSignal($uri));
128 $show_button, $show_button8, $show_button78
parameters()
description: > This shows how different states are being used in the same Prompt according to parame...
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
exit
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...