19 declare(strict_types=1);
    53         if ($component instanceof 
MainBar) {
    54             return $this->renderMainbar($component, $default_renderer);
    56         if ($component instanceof 
MetaBar) {
    57             return $this->renderMetabar($component, $default_renderer);
    59         if ($component instanceof 
Footer) {
    60             return $this->
renderFooter($component, $default_renderer);
    62         if ($component instanceof 
ModeInfo) {
    68         throw new LogicException(
"Cannot render: " . get_class($component));
    73         if (!$slate instanceof 
Slate && !$slate instanceof 
MainBar) {
    77             ->withMainBarTreePosition($pos)
    79                 function ($num, $slate, $is_tool = 
false) use ($pos) {
    98         $is_removeable = array_key_exists($entry_id, $close_buttons);
    99         $is_hidden = in_array($entry_id, $hidden);
   101         if ($is_removeable) {
   102             $trigger_signal = $component->getTriggerSignal($mb_id, $component::ENTRY_ACTION_REMOVE);
   103             $this->trigger_signals[] = $trigger_signal;
   104             $btn_removetool = $close_buttons[$entry_id]
   105                ->withAdditionalOnloadCode(
   106                    fn(
$id) => 
"il.UI.maincontrols.mainbar.addPartIdAndEntry('$mb_id', 'remover', '$id', true);"   108                 ->withOnClick($trigger_signal);
   110             $tpl->setCurrentBlock(
"tool_removal");
   111             $tpl->setVariable(
"REMOVE_TOOL", $default_renderer->render($btn_removetool));
   112             $tpl->parseCurrentBlock();
   115         $is_removeable = $is_removeable ? 
'true' : 
'false';
   116         $is_hidden = $is_hidden ? 
'true' : 
'false';
   117         return "il.UI.maincontrols.mainbar.addToolEntry('$mb_id', $is_removeable, $is_hidden, '$entry_id');";
   128         foreach ($entries as $k => $entry) {
   133             if ($entry instanceof 
Slate) {
   135                 $mb_id = $entry->getMainBarTreePosition();
   136                 $is_tool = $block === static::BLOCK_MAINBAR_TOOLS;
   138                     $js = $this->
renderToolEntry($k, $mb_id, $component, $tpl, $default_renderer);
   141                 $trigger_signal = $component->getTriggerSignal($mb_id, $component::ENTRY_ACTION_TRIGGER);
   142                 $this->trigger_signals[] = $trigger_signal;
   143                 $button = 
$f->button()->bulky($entry->getSymbol(), $entry->getName(), 
'#')
   144                     ->withOnClick($trigger_signal);
   147                 $pos = array_search($k, array_keys($entries));
   148                 $mb_id = 
'0:' . $pos;
   152             $button = $button->withAdditionalOnLoadCode(
   153                 function (
$id) use ($js, $mb_id, $k, $is_tool): 
string {
   154                     $add_as_tool = $is_tool ? 
'true' : 
'false';
   156                         il.UI.maincontrols.mainbar.addPartIdAndEntry('$mb_id', 'triggerer', '$id', $add_as_tool);   157                         il.UI.maincontrols.mainbar.addMapping('$k','$mb_id');   161             )->withAriaRole(IBulky::MENUITEM);
   163             $tpl->setCurrentBlock($block);
   164             $tpl->setVariable(
"BUTTON", $default_renderer->render($button));
   165             $tpl->parseCurrentBlock();
   168                 $entry = $entry->withAriaRole(ISlate::MENU);
   170                 $tpl->setCurrentBlock(
"slate_item");
   171                 $tpl->setVariable(
"SLATE", $default_renderer->render($entry));
   172                 $tpl->parseCurrentBlock();
   180         $tpl = $this->
getTemplate(
"tpl.mainbar.html", 
true, 
true);
   182         $tpl->setVariable(
"ARIA_LABEL", $this->
txt(
'mainbar_aria_label'));
   183         $more_btn_label = $this->
txt(
'mainbar_more_label');
   187         $more_slate = 
$f->mainControls()->slate()->combined(
   189             $f->symbol()->glyph()->more()
   191         $more_slate = $more_slate->withAriaRole(ISlate::MENU);
   199             static::BLOCK_MAINBAR_ENTRIES => $component->
getEntries(),
   203         foreach ($mb_entries as $block => $entries) {
   218             $tpl->setCurrentBlock(
"tools_trigger");
   219             $tpl->setVariable(
"BUTTON", $default_renderer->render($btn_tools));
   220             $tpl->parseCurrentBlock();
   224         $btn_disengage = 
$f->button()->bulky(
$f->symbol()->glyph()->collapseHorizontal(
"#"), $this->
txt(
'close'), 
"#")
   226         $tpl->setVariable(
"CLOSE_SLATES", $default_renderer->render($btn_disengage));
   230         $tpl->setVariable(
'ID', 
$id);
   238         $tpl = $this->
getTemplate(
"tpl.metabar.html", 
true, 
true);
   246         $more_label = $this->
txt(
'show_more');
   247         $more_symbol = 
$f->symbol()->glyph()->disclosure()
   248             ->withCounter(
$f->counter()->novelty(0))
   249             ->withCounter(
$f->counter()->status(0));
   253         $more_slate = 
$f->mainControls()->slate()->combined($more_label, $more_symbol);
   254         $more_slate = $more_slate->withAriaRole(ISlate::MENU);
   255         $entries[] = $more_slate;
   261             static::BLOCK_METABAR_ENTRIES,
   267             function (
$id) use ($signals) {
   268                 $entry_signal = $signals[
'entry'];
   269                 $close_slates_signal = $signals[
'close_slates'];
   271                                         il.UI.maincontrols.metabar.init('$id');   272                     il.UI.maincontrols.metabar.get('$id').registerSignals(   274                                                 '$close_slates_signal',   276                     il.UI.maincontrols.metabar.get('$id').init();   277                     window.addEventListener(   279                         ()=>{il.UI.maincontrols.metabar.get('$id').init()}   284         $tpl->setVariable(
'ARIA_LABEL', $this->
txt(
'metabar_aria_label'));
   287         $tpl->setVariable(
'ID', 
$id);
   293         $tpl = $this->
getTemplate(
"tpl.mode_info.html", 
true, 
true);
   294         $tpl->setVariable(
'MODE_TITLE', $component->
getModeTitle());
   297         $action = $base_URI . 
'?' . $query;
   298         $close = $this->
getUIFactory()->symbol()->glyph()->close($action);
   299         $tpl->setVariable(
'CLOSE_GLYPH', $default_renderer->render($close));
   308         $tpl = $this->
getTemplate(
"tpl.system_info.html", 
true, 
true);
   309         $tpl->setVariable(
'HEADLINE', $component->getHeadLine());
   310         $tpl->setVariable(
'BODY', $component->getInformationText());
   311         $tpl->setVariable(
'DENOTATION', $component->getDenotation());
   312         switch ($component->getDenotation()) {
   315                 $tpl->setVariable(
'LIVE', 
'aria-live="polite"');
   318                 $tpl->setVariable(
'ROLE', 
'role="alert"');
   321         if ($component->isDismissable()) {
   322             $close = $this->
getUIFactory()->symbol()->glyph()->close(
"#");
   323             $signal = $component->getCloseSignal();
   324             $close = $close->withOnClick($signal);
   325             $tpl->setVariable(
'CLOSE_BUTTON', $default_renderer->render($close));
   326             $tpl->setVariable(
'CLOSE_URI', (
string) $component->getDismissAction());
   327             $component = $component->withAdditionalOnLoadCode(fn(
$id) => 
"$(document).on('$signal', function() { il.UI.maincontrols.system_info.close('$id'); });");
   330         $more = $this->
getUIFactory()->symbol()->glyph()->more(
"#");
   331         $tpl->setVariable(
'MORE_BUTTON', $default_renderer->render($more));
   333         $component = $component->withAdditionalOnLoadCode(fn(
$id) => 
"il.UI.maincontrols.system_info.init('$id')");
   336         $tpl->setVariable(
'ID', 
$id);
   337         $tpl->setVariable(
'ID_HEADLINE', 
$id . 
"_headline");
   338         $tpl->setVariable(
'ID_DESCRIPTION', 
$id . 
"_description");
   350         string $active = null
   352         foreach ($entries as 
$id => $entry) {
   356             if ($entry instanceof 
Slate) {
   358                 $secondary_signal = $entry->getToggleSignal();
   359                 $clickable = 
$f->button()->bulky($entry->getSymbol(), $entry->getName(), 
'#')
   361                     ->withOnClick($entry_signal)
   362                     ->appendOnClick($secondary_signal)
   363                     ->withAriaRole(IBulky::MENUITEM);
   366             } elseif ($entry instanceof 
IBulky) {
   368                 $clickable = $clickable->withAriaRole(IBulky::MENUITEM);
   374             $clickable_html = $default_renderer->render($clickable);
   377                 $tpl->setCurrentBlock(
"slate_item");
   378                 $tpl->setVariable(
"SLATE", $default_renderer->render($slate));
   379                 $tpl->parseCurrentBlock();
   382             $tpl->setCurrentBlock($use_block);
   383             $tpl->setVariable(
"BUTTON", $clickable_html);
   384             $tpl->parseCurrentBlock();
   392         $inititally_active = $component->
getActive();
   395             function (
$id) use ($component, $trigger_signals, $inititally_active): 
string {
   399                 $js = 
"il.UI.maincontrols.mainbar.addTriggerSignal('$disengage_all_signal');";
   400                 $js .= 
"il.UI.maincontrols.mainbar.addTriggerSignal('$tools_toggle_signal');";
   402                 foreach ($trigger_signals as $signal) {
   403                     $js .= 
"il.UI.maincontrols.mainbar.addTriggerSignal('$signal');";
   408                     $js .= 
"il.UI.maincontrols.mainbar.addTriggerSignal('$signal');";
   412                     window.addEventListener('resize', il.UI.maincontrols.mainbar.adjustToScreenSize);   413                     il.UI.maincontrols.mainbar.init('$inititally_active');   424         $tpl = $this->
getTemplate(
"tpl.footer.html", 
true, 
true);
   426         $modalsWithTriggers = $component->
getModals();
   427         $links = array_merge($links, array_column($modalsWithTriggers, 1));
   430             $link_list = $this->
getUIFactory()->listing()->unordered($links);
   431             $tpl->setVariable(
'LINKS', $default_renderer->render($link_list));
   434         if ($modalsWithTriggers !== []) {
   435             $tpl->setVariable(
'MODALS', $default_renderer->render(
   436                 array_column($modalsWithTriggers, 0)
   440         $tpl->setVariable(
'TEXT', $component->
getText());
   443         if ($perm_url instanceof 
URI) {
   444             $code = 
function (
string $id) use ($perm_url): 
string {
   446                 $perm_url = $this->
jsonEncode((
string) $perm_url);
   448                 return "document.getElementById($id).addEventListener('click', e => il.Footer.permalink.copyText($perm_url)   449                             .then(() => il.Footer.permalink.showTooltip(e.target.nextElementSibling, 5000)));";
   451             $button = $this->
getUIFactory()->button()->shy($this->
txt(
'copy_perma_link'), 
'')->withAdditionalOnLoadCode($code);
   452             $tpl->setVariable(
'PERMANENT', $default_renderer->render($button));
   453             $tpl->setVariable(
'PERMANENT_TOOLTIP', $this->
txt(
'perma_link_copied'));
   463         parent::registerResources($registry);
   464         $registry->
register(
'./src/UI/templates/js/MainControls/dist/mainbar.js');
   465         $registry->
register(
'./src/UI/templates/js/MainControls/dist/maincontrols.min.js');
   466         $registry->
register(
'./src/GlobalScreen/Client/dist/GS.js');
   467         $registry->
register(
'./src/UI/templates/js/MainControls/system_info.js');
   468         $registry->
register(
'./src/UI/templates/js/MainControls/dist/footer.min.js');
   487         return json_encode($value, JSON_HEX_QUOT | JSON_HEX_TAG | JSON_HEX_AMP | JSON_HEX_APOS | JSON_THROW_ON_ERROR);
 
Registry for resources required by rendered output like Javascript or CSS. 
 
This describes the MainBar. 
 
const DENOTATION_IMPORTANT
 
checkComponent(Component $component)
Check if a given component fits this renderer and throw  if that is not the case. ...
 
getDisengageAllSignal()
This signal disengages all slates when triggered. 
 
getInitiallyHiddenToolIds()
There are tools that are rendered invisible before first activation. 
 
calculateMainBarTreePosition($pos, $slate)
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
getComponentInterfaceName()
 
renderToolEntry(string $entry_id, string $mb_id, MainBar $component, UITemplateWrapper $tpl, RendererInterface $default_renderer)
 
const BLOCK_METABAR_ENTRIES
 
txt(string $id)
Get a text from the language file. 
 
withOnLoadCode(Closure $binder)
 
getEntryClickSignal()
The Signal is triggered when any Entry is being clicked. 
 
renderFooter(Footer $component, RendererInterface $default_renderer)
 
const BLOCK_MAINBAR_ENTRIES
 
getDisengageAllSignal()
This signal disengages all slates when triggered. 
 
getTemplate(string $name, bool $purge_unfilled_vars, bool $purge_unused_blocks)
Get template of component this renderer is made for. 
 
renderSystemInfo(Component\MainControls\SystemInfo $component, RendererInterface $default_renderer)
 
renderModeInfo(ModeInfo $component, RendererInterface $default_renderer)
 
The scope of this class is split ilias-conform URI's into components. 
 
const DENOTATION_BREAKING
 
const BLOCK_MAINBAR_TOOLS
 
withAdditionalEntry(string $id, $entry)
Append an entry. 
 
bindMainbarJS(MainBar $component)
 
getToolsButton()
Returns the button of the tools-trigger. 
 
register(string $name)
Add a dependency. 
 
This describes the MetaBar. 
 
renderMainbarEntry(array $entries, string $block, MainBar $component, UITemplateWrapper $tpl, RendererInterface $default_renderer)
 
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins 
 
getUIFactory()
Get a UI factory. 
 
render(Component\Component $component, RendererInterface $default_renderer)
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
registerResources(ResourceRegistry $registry)
Announce resources this renderer requires. 
 
getToggleToolsSignal()
Signal to toggle the tools-section. 
 
getEngageToolSignal(string $tool_id)
Signal to engage a tool from outside the MainBar. 
 
getCloseButtons()
Buttons to close tools; maybe configure with callback. 
 
Base class for all component renderers. 
 
This describes the Footer. 
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
renderTriggerButtonsAndSlates(UITemplateWrapper $tpl, RendererInterface $default_renderer, Signal $entry_signal, string $block, array $entries, string $active=null)
 
bindJavaScript(JavaScriptBindable $component)
Bind the component to JavaScript.