ILIAS  release_7 Revision v7.30-3-g800a261c036
All Data Structures Namespaces Files Functions Variables Modules Pages
class.ilKioskPageRenderer.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
13 
18 {
19  public function __construct(
20  ilGlobalPageTemplate $il_global_template,
21  MetaContent $layout_meta_content,
22  Factory $ui_factory,
23  Renderer $ui_renderer,
25  ilTemplate $kiosk_template,
26  ilLSTOCGUI $toc_gui,
27  ilLSLocatorGUI $loc_gui,
28  string $window_base_title
29  ) {
30  $this->il_tpl = $il_global_template;
31  $this->layout_meta_content = $layout_meta_content;
32  $this->ui_factory = $ui_factory;
33  $this->ui_renderer = $ui_renderer;
34  $this->lng = $lng;
35  $this->tpl = $kiosk_template;
36  $this->toc_gui = $toc_gui;
37  $this->loc_gui = $loc_gui;
38  $this->window_base_title = $window_base_title;
39  }
40 
41  public function buildCurriculumSlate(Workflow $curriculum) : Slate
42  {
43  $f = $this->ui_factory;
44  return $this->ui_factory->maincontrols()->slate()->legacy(
45  $this->lng->txt('lso_mainbar_button_label_curriculum'),
46  $f->symbol()->icon()->standard("lso", "Learning Sequence")
47  ->withIsOutlined(true),
48  $this->ui_factory->legacy(
49  $this->ui_renderer->render($curriculum)
50  )
51  );
52  }
53 
54 
55  public function buildToCSlate($toc, Icon $icon) : Slate
56  {
57  $html = $this->toc_gui
58  ->withStructure($toc->toJSON())
59  ->getHTML();
60  return $this->ui_factory->maincontrols()->slate()->legacy(
61  $this->lng->txt('lso_mainbar_button_label_toc'),
62  $icon->withSize("small")->withIsOutlined(true),
63  $this->ui_factory->legacy($html)
64  );
65  }
66 
67 
68  public function render(
69  string $lso_title,
70  LSControlBuilder $control_builder,
71  string $obj_title,
72  Component $icon,
73  array $content
74  ) : string {
75  $this->tpl->setVariable(
76  "OBJECT_ICON",
77  $this->ui_renderer->render($icon)
78  );
79  $this->tpl->setVariable("OBJECT_TITLE", $obj_title);
80 
81  $this->tpl->setVariable(
82  "PLAYER_NAVIGATION",
83  $this->ui_renderer->render([
84  $control_builder->getPreviousControl(),
85  $control_builder->getNextControl()
86  ])
87  );
88 
89  $controls = $control_builder->getControls();
90 
91  //ensure done control is first element
92  if ($control_builder->getDoneControl()) {
93  array_unshift($controls, $control_builder->getDoneControl());
94  }
95  //also shift start control up front - this is for legacy-views only!
96  if ($control_builder->getStartControl()) {
97  array_unshift($controls, $control_builder->getStartControl());
98  $this->tpl->setVariable("JS_INLINE", $control_builder->getAdditionalJS());
99  }
100 
101  //TODO: insert toggles
102 
103  $this->tpl->setVariable(
104  "OBJ_NAVIGATION",
105  $this->ui_renderer->render($controls)
106  );
107 
108 
109  $this->tpl->setVariable(
110  "VIEW_MODES",
111  $this->ui_renderer->render($control_builder->getModeControls())
112  );
113 
114  if ($control_builder->getLocator()) {
115  $this->tpl->setVariable(
116  'LOCATOR',
117  $this->ui_renderer->render(
118  $this->loc_gui
119  ->withItems($control_builder->getLocator()->getItems())
120  ->getComponent()
121  )
122  );
123  }
124 
125  $this->tpl->setVariable(
126  'CONTENT',
127  $this->ui_renderer->render($content)
128  );
129 
130  return $this->tpl->get();
131  }
132 }
An entity that renders components to a string output.
Definition: Renderer.php:14
render(string $lso_title, LSControlBuilder $control_builder, string $obj_title, Component $icon, array $content)
This describes how an icon could be modified during construction of UI.
Definition: Icon.php:9
buildCurriculumSlate(Workflow $curriculum)
Class ilGlobalPageTemplate.
$lng
This is how the factory for UI elements looks.
Definition: Factory.php:17
Class ilKioskPageRenderer.
__construct(ilGlobalPageTemplate $il_global_template, MetaContent $layout_meta_content, Factory $ui_factory, Renderer $ui_renderer, ilLanguage $lng, ilTemplate $kiosk_template, ilLSTOCGUI $toc_gui, ilLSLocatorGUI $loc_gui, string $window_base_title)
Class LSControlBuilder.
GUI for Locator element.
Tree-GUI for ToC.
withSize($size)
Set the size for this icon.