ILIAS  release_7 Revision v7.30-3-g800a261c036
Renderer.php
Go to the documentation of this file.
1<?php
2
3/* Copyright (c) 2017 Alex Killing <killing@leifos.de> Extended GPL, see docs/LICENSE */
4
6
8use ILIAS\UI\Renderer as RendererInterface;
10
12{
16 public function render(Component\Component $component, RendererInterface $default_renderer)
17 {
18 $this->checkComponent($component);
19
20 if ($component instanceof Component\Divider\Horizontal) {
21 return $this->renderDividerHorizontal($component, $default_renderer);
22 }
23 if ($component instanceof Component\Divider\Vertical) {
24 return $this->renderDividerVertical($component, $default_renderer);
25 }
26 return "";
27 }
28
29 protected function renderDividerHorizontal(Component\Divider\Horizontal $component, RendererInterface $default_renderer)
30 {
31 $tpl = $this->getTemplate("tpl.horizontal.html", true, true);
32
33 $label = $component->getLabel();
34
35 if ($label !== null) {
36 $tpl->setCurrentBlock("label");
37 $tpl->setVariable("LABEL", $label);
38 $tpl->parseCurrentBlock();
39 $tpl->touchBlock("with_label");
40 } else {
41 $tpl->touchBlock("divider");
42 }
43
44 return $tpl->get();
45 }
46
47 protected function renderDividerVertical(Component\Divider\Vertical $component, RendererInterface $default_renderer)
48 {
49 $tpl = $this->getTemplate("tpl.vertical.html", true, true);
50
51 $tpl->touchBlock("divider");
52
53 return $tpl->get();
54 }
55
59 protected function getComponentInterfaceName()
60 {
61 return array(Component\Divider\Horizontal::class
62 ,Component\Divider\Vertical::class
63 );
64 }
65}
An exception for terminatinating execution or to throw for unit testing.
renderDividerVertical(Component\Divider\Vertical $component, RendererInterface $default_renderer)
Definition: Renderer.php:47
renderDividerHorizontal(Component\Divider\Horizontal $component, RendererInterface $default_renderer)
Definition: Renderer.php:29
getComponentInterfaceName()
Get the name of the component-interface this renderer is supposed to render.ATTENTION: Fully qualifie...
Definition: Renderer.php:59
render(Component\Component $component, RendererInterface $default_renderer)
Definition: Renderer.php:16
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
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