ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
client.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
37function client(): string
38{
39 global $DIC;
40 $factory = $DIC->ui()->factory();
41 $renderer = $DIC->ui()->renderer();
42
43 $progress_bar = $factory->progress()->bar('clicking the button 10 times');
44
45 $make_progress = $factory->button()->standard('make some progress', '#');
46 $make_progress = $make_progress->withAdditionalOnLoadCode(
47 static fn(string $id) => "
48 let progress = 0;
49 document.getElementById('$id')?.addEventListener('click', (event) => {
50 if (90 === progress) {
51 event.target.disabled = true;
52 il.UI.Progress.Bar.success('{$progress_bar->getUpdateSignal()}', 'all done!');
53 return;
54 }
55
56 progress += 10;
57 il.UI.Progress.Bar.determinate('{$progress_bar->getUpdateSignal()}', progress);
58 });
59 ",
60 );
61
62 return $renderer->render([$progress_bar, $make_progress]);
63}
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
$renderer
global $DIC
Definition: shib_login.php:26