ILIAS  release_8 Revision v8.19-1-g4e8f2f9140c
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 
28 {
32  public function render(Component\Component $component, RendererInterface $default_renderer): string
33  {
34  $this->checkComponent($component);
35 
36  if ($component instanceof Component\Divider\Horizontal) {
37  return $this->renderDividerHorizontal($component);
38  }
39  if ($component instanceof Component\Divider\Vertical) {
40  return $this->renderDividerVertical();
41  }
42  return "";
43  }
44 
45  protected function renderDividerHorizontal(Component\Divider\Horizontal $component): string
46  {
47  $tpl = $this->getTemplate("tpl.horizontal.html", true, true);
48 
49  $label = $component->getLabel();
50 
51  if ($label !== null) {
52  $tpl->setCurrentBlock("label");
53  $tpl->setVariable("LABEL", $label);
54  $tpl->parseCurrentBlock();
55  $tpl->touchBlock("with_label");
56  } else {
57  $tpl->touchBlock("divider");
58  }
59 
60  return $tpl->get();
61  }
62 
63  protected function renderDividerVertical(): string
64  {
65  $tpl = $this->getTemplate("tpl.vertical.html", true, true);
66 
67  $tpl->touchBlock("divider");
68 
69  return $tpl->get();
70  }
71 
75  protected function getComponentInterfaceName(): array
76  {
77  return [
78  Component\Divider\Horizontal::class,
79  Component\Divider\Vertical::class
80  ];
81  }
82 }
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...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Definition: Factory.php:21
getTemplate(string $name, bool $purge_unfilled_vars, bool $purge_unused_blocks)
Get template of component this renderer is made for.
render(Component\Component $component, RendererInterface $default_renderer)
Definition: Renderer.php:32
renderDividerHorizontal(Component\Divider\Horizontal $component)
Definition: Renderer.php:45
if($DIC->http() ->request() ->getMethod()=="GET" &&isset($DIC->http() ->request() ->getQueryParams()['tex'])) $tpl
Definition: latex.php:41