19declare(strict_types=1);
47 $uri =
$http->request()->getUri();
48 $request =
$http->wrapper()->query();
49 $factory =
$DIC->ui()->factory();
51 $data_factory = new \ILIAS\Data\Factory();
53 $endpoint_flag =
'progress_bar_example_endpoint';
54 $endpoint_url = $uri .
"&$endpoint_flag=1";
55 $endpoint_url = $data_factory->uri($endpoint_url);
57 $progress_bar = $factory->progress()->bar(
'waiting about 10 seconds', $endpoint_url);
59 $trigger = $factory->button()->standard(
'start making progress',
'#');
60 $trigger = $trigger->withAdditionalOnLoadCode(
61 static fn(
string $id) =>
"
62 document.getElementById('$id')?.addEventListener('click', (event) => {
63 // always 'kick off' async progress bars with an indeterminate state.
64 il.UI.Progress.Bar.indeterminate('{$progress_bar->getUpdateSignal()}', 'Estimating...');
65 event.target.disabled = true;
70 if ($request->has($endpoint_flag)) {
74 return $renderer->render([$progress_bar, $trigger]);
83 $state = match ($task_progress) {
84 1 => $state = $factory->progress()->state()->bar()->determinate(10,
'Start processing...'),
85 2 => $state = $factory->progress()->state()->bar()->determinate(20),
86 3 => $state = $factory->progress()->state()->bar()->determinate(30),
87 4 => $state = $factory->progress()->state()->bar()->determinate(40),
88 5 => $state = $factory->progress()->state()->bar()->determinate(50,
'Still processing...'),
89 6 => $state = $factory->progress()->state()->bar()->determinate(60),
90 7 => $state = $factory->progress()->state()->bar()->determinate(70),
91 8 => $state = $factory->progress()->state()->bar()->determinate(80),
92 9 => $state = $factory->progress()->state()->bar()->determinate(90),
93 10 => $state = $factory->progress()->state()->bar()->success(
"All done!"),
94 default => $state = $factory->progress()->state()->bar()->failure(
"An error ocurred."),
97 if (10 > $task_progress) {
107 ->withHeader(
'Content-Type',
'text/html; charset=utf-8')
110 $http->sendResponse();
123 $previous_value =
\ilSession::get(__NAMESPACE__ .
'_example_task_progress');
124 \ilSession::set(__NAMESPACE__ .
'_example_task_progress', (
int) $previous_value + 1);
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Builds a Color from either hex- or rgb values.
Stream factory which enables the user to create streams without the knowledge of the concrete class.
static ofString(string $string)
Creates a new stream with an initial value.
static get(string $a_var)
static clear(string $a_var)
static set(string $a_var, $a_val)
Set a value.
Interface GlobalHttpState.
An entity that renders components to a string output.
callArtificialTaskEndpoint(GlobalHttpState $http, UI\Factory $factory, UI\Renderer $renderer)
initialiseArtificialTaskOnce()
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...