3 declare(strict_types=1);
    31     $uri = 
$http->request()->getUri();
    32     $request = 
$http->wrapper()->query();
    33     $factory = $DIC->ui()->factory();
    35     $data_factory = new \ILIAS\Data\Factory();
    37     $endpoint_flag = 
'progress_bar_example_endpoint';
    38     $endpoint_url = $uri . 
"&$endpoint_flag=1";
    39     $endpoint_url = $data_factory->uri($endpoint_url);
    41     $progress_bar = $factory->progress()->bar(
'waiting about 10 seconds', $endpoint_url);
    43     $trigger = $factory->button()->standard(
'start making progress', 
'#');
    44     $trigger = $trigger->withAdditionalOnLoadCode(
    45         static fn(
string $id) => 
"    46             document.getElementById('$id')?.addEventListener('click', (event) => {    47                 // always 'kick off' async progress bars with an indeterminate state.    48                 il.UI.Progress.Bar.indeterminate('{$progress_bar->getUpdateSignal()}', 'Estimating...');    49                 event.target.disabled = true;    54     if ($request->has($endpoint_flag)) {
    58     return $renderer->render([$progress_bar, $trigger]);
    67     $state = match ($task_progress) {
    68         1 => $state = $factory->progress()->state()->bar()->determinate(10, 
'Start processing...'),
    69         2 => $state = $factory->progress()->state()->bar()->determinate(20),
    70         3 => $state = $factory->progress()->state()->bar()->determinate(30),
    71         4 => $state = $factory->progress()->state()->bar()->determinate(40),
    72         5 => $state = $factory->progress()->state()->bar()->determinate(50, 
'Still processing...'),
    73         6 => $state = $factory->progress()->state()->bar()->determinate(60),
    74         7 => $state = $factory->progress()->state()->bar()->determinate(70),
    75         8 => $state = $factory->progress()->state()->bar()->determinate(80),
    76         9 => $state = $factory->progress()->state()->bar()->determinate(90),
    77         10 => $state = $factory->progress()->state()->bar()->success(
"All done!"),
    78         default => $state = $factory->progress()->state()->bar()->failure(
"An error ocurred."),
    81     if (10 > $task_progress) {
    87     $html = $renderer->renderAsync($state);
    91              ->withHeader(
'Content-Type', 
'text/html; charset=utf-8')
    92              ->withBody(Streams::ofString($html))
   107     $previous_value = 
\ilSession::get(__NAMESPACE__ . 
'_example_task_progress');
   108     \ilSession::set(__NAMESPACE__ . 
'_example_task_progress', (
int) $previous_value + 1);
 static get(string $a_var)
 
callArtificialTaskEndpoint(GlobalHttpState $http, UI\Factory $factory, UI\Renderer $renderer)
 
sendResponse()
Render the current response hold by ILIAS. 
 
saveResponse(ResponseInterface $response)
Saves the given response for further use. 
 
server()
 description: > This example shows how a Progress Bar can be rendered and updated by the server...
 
This is how the factory for UI elements looks. 
 
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins 
 
response()
Returns the current psr-7 response. 
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
initialiseArtificialTaskOnce()
 
static clear(string $a_var)
 
static set(string $a_var, $a_val)
Set a value.