ILIAS  release_7 Revision v7.30-3-g800a261c036
Renderer.php
Go to the documentation of this file.
1<?php
2
3/* Copyright (c) 2018 Thomas Famula <famula@leifos.de> Extended GPL, see docs/LICENSE */
4
6
8use ILIAS\UI\Renderer as RendererInterface;
10
16{
20 public function render(Component\Component $component, RendererInterface $default_renderer)
21 {
22 $ui_fac = $this->getUIFactory();
23
27 $this->checkComponent($component);
28 $tpl = $this->getTemplate("tpl.messagebox.html", true, true);
29
30 $buttons = $component->getButtons();
31 if (count($buttons) > 0) {
32 $tpl->setCurrentBlock("buttons");
33 $tpl->setVariable("BUTTONS", $default_renderer->render($buttons));
34 $tpl->parseCurrentBlock();
35 }
36
37 $tpl->setCurrentBlock("message_box");
38
39 $tpl->setVariable("MESSAGE_TEXT", $component->getMessageText());
40 $tpl->setVariable("ACC_TEXT", $this->txt($component->getType() . "_message"));
41
42
43 $links = $component->getLinks();
44 if (count($links) > 0) {
45 $unordered = $ui_fac->listing()->unordered(
46 $links
47 );
48
49 $tpl->setVariable("LINK_LIST", $default_renderer->render($unordered));
50 }
51
52 $tpl->touchBlock($component->getType() . "_class");
53
54 $tpl->parseCurrentBlock();
55
56 return $tpl->get();
57 }
58
59 protected function getComponentInterfaceName()
60 {
61 return array(Component\MessageBox\MessageBox::class);
62 }
63}
An exception for terminatinating execution or to throw for unit testing.
getComponentInterfaceName()
Get the name of the component-interface this renderer is supposed to render.
Definition: Renderer.php:59
getTemplate($name, $purge_unfilled_vars, $purge_unused_blocks)
Get template of component this renderer is made for.
checkComponent(Component $component)
Check if a given component fits this renderer and throw \LogicError if that is not the case.
A component is the most general form of an entity in the UI.
Definition: Component.php:14
render(Component $component, Renderer $default_renderer)
Render the component if possible and delegate additional rendering to the default_renderer.
An entity that renders components to a string output.
Definition: Renderer.php:15
if($DIC->http() ->request() ->getMethod()=="GET" &&isset($DIC->http() ->request() ->getQueryParams()['tex'])) $tpl
Definition: latex.php:41