ILIAS  release_7 Revision v7.30-3-g800a261c036
All Data Structures Namespaces Files Functions Variables Modules Pages
class.ilLSViewLayoutProvider.php
Go to the documentation of this file.
1 <?php
32 
39 {
40 
44  protected $data_collection;
45 
50  {
51  return $this->context_collection->main();
52  }
53 
59  protected function isKioskModeEnabled(CalledContexts $screen_context_stack) : bool
60  {
61  $this->data_collection = $screen_context_stack->current()->getAdditionalData();
62  return $this->data_collection->is(\ilLSPlayer::GS_DATA_LS_KIOSK_MODE, true);
63  }
64 
65  public function getMainBarModification(CalledContexts $screen_context_stack) : ?MainBarModification
66  {
67  if (!$this->isKioskModeEnabled($screen_context_stack)) {
68  return null;
69  }
70  return $this->globalScreen()->layout()->factory()->mainbar()
71  ->withModification(
72  function (?MainBar $mainbar) : ?MainBar {
73  if ($mainbar === null) {
74  $ui = $this->dic->ui();
75  $mainbar = $ui->factory()->mainControls()->mainbar();
76  }
77  $entries = $this->data_collection->get(\ilLSPlayer::GS_DATA_LS_MAINBARCONTROLS);
78  $tools = $mainbar->getToolEntries();
79  $mainbar = $mainbar->withClearedEntries();
80 
81  foreach ($entries as $key => $entry) {
82  $mainbar = $mainbar->withAdditionalEntry($key, $entry);
83  }
84  foreach ($tools as $key => $entry) {
85  $mainbar = $mainbar->withAdditionalToolEntry($key, $entry);
86  }
87  return $mainbar;
88  }
89  )
90  ->withHighPriority();
91  }
92 
93  public function getMetaBarModification(CalledContexts $screen_context_stack) : ?MetaBarModification
94  {
95  if (!$this->isKioskModeEnabled($screen_context_stack)) {
96  return null;
97  }
98  return $this->globalScreen()->layout()->factory()->metabar()
99  ->withModification(
100  function (?MetaBar $metabar) : ?Metabar {
101  if ($metabar === null) {
102  return null;
103  }
104  $metabar = $metabar->withClearedEntries();
105  foreach ($this->data_collection->get(\ilLSPlayer::GS_DATA_LS_METABARCONTROLS) as $key => $entry) {
106  $metabar = $metabar->withAdditionalEntry($key, $entry);
107  }
108  return $metabar;
109  }
110  )
111  ->withHighPriority();
112  }
113 
114  public function getBreadCrumbsModification(CalledContexts $screen_context_stack) : ?BreadCrumbsModification
115  {
116  if (!$this->isKioskModeEnabled($screen_context_stack)) {
117  return null;
118  }
119 
120  return $this->globalScreen()->layout()->factory()->breadcrumbs()
121  ->withModification(
122  function (?Breadcrumbs $current) : ?Breadcrumbs {
123  return null;
124  }
125  )
126  ->withHighPriority();
127  }
128 
129  public function getContentModification(CalledContexts $screen_context_stack) : ?ContentModification
130  {
131  if (!$this->isKioskModeEnabled($screen_context_stack)) {
132  return null;
133  }
134  $html = $this->data_collection->get(\ilLSPlayer::GS_DATA_LS_CONTENT);
135  // TODO: Once we have more control over the content, we could just setContent
136  // in ilObjLearningSequenceLearnerGUI like any other object and later strip
137  // away the header here.
138  return $this->globalScreen()->layout()->factory()->content()
139  ->withModification(
140  function (?Legacy $content) use ($html) : Legacy {
141  $ui = $this->dic->ui();
142  return $ui->factory()->legacy($html);
143  }
144  )
145  ->withHighPriority();
146  }
147 }
withAdditionalToolEntry(string $id, Slate\Slate $entry, bool $initially_hidden=false, Button\Close $close_button=null)
Append a tool-entry.
const GS_DATA_LS_KIOSK_MODE
This describes the MainBar.
Definition: MainBar.php:16
withClearedEntries()
Get a copy of this Metabar without any entries.
withAdditionalEntry(string $id, $entry)
Append an entry.
getMetaBarModification(CalledContexts $screen_context_stack)
isKioskModeEnabled(CalledContexts $screen_context_stack)
withClearedEntries()
Get a copy of this Mainbar without any entries.
Class ilLSViewLayoutProvider.
getContentModification(CalledContexts $screen_context_stack)
withAdditionalEntry(string $id, $entry)
Append an entry.
getMainBarModification(CalledContexts $screen_context_stack)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
const GS_DATA_LS_MAINBARCONTROLS
getBreadCrumbsModification(CalledContexts $screen_context_stack)
This describes the MetaBar.
Definition: MetaBar.php:14
const GS_DATA_LS_CONTENT
const GS_DATA_LS_METABARCONTROLS