ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
Renderer.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
22 
26 
32 {
36  public function render(Component\Component $component, RendererInterface $default_renderer): string
37  {
38  $ui_fac = $this->getUIFactory();
39 
43  $this->checkComponent($component);
44  $tpl = $this->getTemplate("tpl.messagebox.html", true, true);
45 
46  $buttons = $component->getButtons();
47  if (count($buttons) > 0) {
48  $tpl->setCurrentBlock("buttons");
49  $tpl->setVariable("BUTTONS", $default_renderer->render($buttons));
50  $tpl->parseCurrentBlock();
51  }
52 
53  $tpl->setCurrentBlock("message_box");
54 
55  $tpl->setVariable("MESSAGE_TEXT", $component->getMessageText());
56  $tpl->setVariable("ACC_TEXT", $this->txt($component->getType() . "_message"));
57  if ($component->getType() == Component\MessageBox\MessageBox::FAILURE) {
58  $tpl->setVariable("ROLE", "alert");
59  } else {
60  $tpl->setVariable("ROLE", "status");
61  }
62 
63 
64  $links = $component->getLinks();
65  if (count($links) > 0) {
66  $unordered = $ui_fac->listing()->unordered(
67  $links
68  );
69 
70  $tpl->setVariable("LINK_LIST", $default_renderer->render($unordered));
71  }
72 
73  $tpl->touchBlock($component->getType() . "_class");
74 
75  $tpl->parseCurrentBlock();
76 
77  return $tpl->get();
78  }
79 
80  protected function getComponentInterfaceName(): array
81  {
82  return array(Component\MessageBox\MessageBox::class);
83  }
84 }
checkComponent(Component $component)
Check if a given component fits this renderer and throw if that is not the case. ...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
txt(string $id)
Get a text from the language file.
getTemplate(string $name, bool $purge_unfilled_vars, bool $purge_unused_blocks)
Get template of component this renderer is made for.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Definition: Factory.php:21
render(Component $component, Renderer $default_renderer)
Render the component if possible and delegate additional rendering to the default_renderer.
if($DIC->http() ->request() ->getMethod()=="GET" &&isset($DIC->http() ->request() ->getQueryParams()['tex'])) $tpl
Definition: latex.php:41