18 declare(strict_types=1);
36 $registry->
register(
'./assets/js/progress.min.js');
37 parent::registerResources($registry);
42 if ($component instanceof
Bar) {
51 $template = $this->
getTemplate(
'tpl.progress_bar.html',
true,
true);
53 $template->setVariable(
'LABEL', $component->getLabel());
55 $template->setVariable(
'SUCCESS_GLYPH', $default_renderer->render(
56 $this->getUIFactory()->symbol()->glyph()->apply(),
59 $template->setVariable(
'FAILURE_GLYPH', $default_renderer->render(
60 $this->getUIFactory()->symbol()->glyph()->close(),
63 $async_url = $component->getAsyncUrl();
64 if (null !== $async_url) {
65 $template->setVariable(
'ASYNC_URL', (
string) $async_url);
68 if (null !== $component->getAsyncUrl()) {
70 static fn(
string $id):
string =>
" 71 const progressbar = il.UI.Progress.Bar.createAsync( 72 document.getElementById('$id'), 73 '{$component->getUpdateSignal()->getId()}', 74 {$component->getAsyncRefreshInterval()->getRefreshIntervalInMs()}, 77 $(document).on('{$component->getResetSignal()}', () => progressBar.reset()); 82 static fn(
string $id):
string =>
" 83 const progressBar = il.UI.Progress.Bar.create( 84 document.getElementById('$id'), 85 '{$component->getUpdateSignal()->getId()}', 88 $(document).on('{$component->getResetSignal()}', () => progressBar.reset()); 97 $template->setVariable(
'ID',
$id);
99 return $template->get();
104 $template->
setVariable(
'MAX_VALUE', (
string) $max);
109 if (null !== $value) {
Registry for resources required by rendered output like Javascript or CSS.
render(Component $component, RendererInterface $default_renderer)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
applyProgressBarMaxValue(Template $template, int $max=Bar::MAX_VALUE)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
createId()
Get a fresh unique id.
setVariable(string $name, $value)
Set a variable in the current block.
getTemplate(string $name, bool $purge_unfilled_vars, bool $purge_unused_blocks)
Get template of component this renderer is made for.
maybeApplyProgressBarValue(Template $template, ?int $value=null)
cannotHandleComponent(Component $component)
This method MUST be called by derived component renderers, if.
register(string $name)
Add a dependency.
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
withAdditionalOnLoadCode(Closure $binder)
Add some onload-code to the component instead of replacing the existing one.
registerResources(ResourceRegistry $registry)
Announce resources this renderer requires.
Base class for all component renderers.
renderProgressBar(Bar $component, RendererInterface $default_renderer)
bindJavaScript(JavaScriptBindable $component)
Bind the component to JavaScript.