ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
All Data Structures Namespaces Files Functions Variables Modules Pages
class.ilLSViewLayoutProvider.php
Go to the documentation of this file.
1 <?php
16 
23 {
24 
28  protected $data_collection;
29 
34  {
35  return $this->context_collection->main();
36  }
37 
43  protected function isKioskModeEnabled(CalledContexts $screen_context_stack) : bool
44  {
45  $this->data_collection = $screen_context_stack->current()->getAdditionalData();
46  return $this->data_collection->is(\ilLSPlayer::GS_DATA_LS_KIOSK_MODE, true);
47  }
48 
49  public function getMainBarModification(CalledContexts $screen_context_stack) : ?MainBarModification
50  {
51  if (!$this->isKioskModeEnabled($screen_context_stack)) {
52  return null;
53  }
54  return $this->globalScreen()->layout()->factory()->mainbar()
55  ->withModification(
56  function (MainBar $mainbar) : ?MainBar {
57  $mainbar = $mainbar->withClearedEntries();
58  foreach ($this->data_collection->get(\ilLSPlayer::GS_DATA_LS_MAINBARCONTROLS) as $key => $entry) {
59  $mainbar = $mainbar->withAdditionalEntry($key, $entry);
60  }
61  return $mainbar;
62  }
63  )
64  ->withHighPriority();
65  }
66 
67  public function getMetaBarModification(CalledContexts $screen_context_stack) : ?MetaBarModification
68  {
69  if (!$this->isKioskModeEnabled($screen_context_stack)) {
70  return null;
71  }
72  return $this->globalScreen()->layout()->factory()->metabar()
73  ->withModification(
74  function (MetaBar $metabar) : ?Metabar {
75  $metabar = $metabar->withClearedEntries();
76  foreach ($this->data_collection->get(\ilLSPlayer::GS_DATA_LS_METABARCONTROLS) as $key => $entry) {
77  $metabar = $metabar->withAdditionalEntry($key, $entry);
78  }
79  return $metabar;
80  }
81  )
82  ->withHighPriority();
83  }
84 
85  public function getBreadCrumbsModification(CalledContexts $screen_context_stack) : ?BreadCrumbsModification
86  {
87  if (!$this->isKioskModeEnabled($screen_context_stack)) {
88  return null;
89  }
90 
91  return $this->globalScreen()->layout()->factory()->breadcrumbs()
92  ->withModification(
93  function (Breadcrumbs $current) : ?Breadcrumbs {
94  return null;
95  }
96  )
97  ->withHighPriority();
98  }
99 
100  public function getContentModification(CalledContexts $screen_context_stack) : ?ContentModification
101  {
102  if (!$this->isKioskModeEnabled($screen_context_stack)) {
103  return null;
104  }
105  $html = $this->data_collection->get(\ilLSPlayer::GS_DATA_LS_CONTENT);
106  // TODO: Once we have more control over the content, we could just setContent
107  // in ilObjLearningSequenceLearnerGUI like any other object and later strip
108  // away the header here.
109  return $this->globalScreen()->layout()->factory()->content()
110  ->withModification(
111  function (Legacy $content) use ($html) : Legacy {
112  $ui = $this->dic->ui();
113  return $ui->factory()->legacy($html);
114  }
115  )
116  ->withHighPriority();
117  }
118 }
const GS_DATA_LS_KIOSK_MODE
This describes the MainBar.
Definition: MainBar.php:15
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)
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