ILIAS  release_7 Revision v7.30-3-g800a261c036
All Data Structures Namespaces Files Functions Variables Modules Pages
class.ilLMHtmlExportViewLayoutProvider.php
Go to the documentation of this file.
1 <?php
2 
29 
36 {
37  const LM_HTML_EXPORT_RENDERING = 'lm_html_export_rendering';
38 
39 
44  {
45  return $this->context_collection->repository();
46  }
47 
51  public function getMetaBarModification(CalledContexts $called_contexts) : ?MetaBarModification
52  {
53  $additional_data = $called_contexts->current()->getAdditionalData();
54  if ($additional_data->is(self::LM_HTML_EXPORT_RENDERING, true)) {
55  return $this->globalScreen()
56  ->layout()
57  ->factory()
58  ->metabar()
59  ->withModification(function (MetaBar $current = null) : ?MetaBar {
60  return null;
61  })->withHighPriority();
62  }
63  return null;
64  }
65 
69  public function getMainBarModification(CalledContexts $called_contexts) : ?MainBarModification
70  {
71  $additional_data = $called_contexts->current()->getAdditionalData();
72  if ($additional_data->is(self::LM_HTML_EXPORT_RENDERING, true)) {
73  return $this->globalScreen()
74  ->layout()
75  ->factory()
76  ->mainbar()
77  ->withModification(function (?MainBar $current = null) : ?MainBar {
78  if ($current === null) {
79  return null;
80  }
81  global $DIC;
82 
83  $lng = $DIC->language();
84  $f = $DIC->ui()->factory();
85 
86  // create an offline main bar
87  $offline_main_bar = new \ILIAS\UI\Implementation\Component\MainControls\MainBar(
88  new \ILIAS\UI\Implementation\Component\SignalGenerator()
89  );
90  $grid_icon = $f->symbol()->icon()->custom(\ilUtil::getImagePath("outlined/icon_tool.svg"), $lng->txt("more"));
91  $tools_button = $f->button()->bulky($grid_icon, $lng->txt("tools"), "#")->withEngagedState(true);
92  $offline_main_bar = $offline_main_bar->withToolsButton($tools_button);
93 
94  // get tool ids for offline use from lm tools provider
95  $lm_tools = new ilLMGSToolProvider($DIC);
96  $ids = $lm_tools->getOfflineToolIds();
97 
98  // copy all offline tools from original main bar to offline main bar
99  foreach ($current->getToolEntries() as $id => $te) {
100  if (in_array($id, $ids)) {
101  $offline_main_bar = $offline_main_bar->withAdditionalToolEntry(
102  $id,
103  $te
104  );
105  }
106  }
107 
108  return $offline_main_bar;
109  })->withHighPriority();
110  } else {
111  return null;
112  }
113  }
114 
119  {
120  $additional_data = $called_contexts->current()->getAdditionalData();
121  if ($additional_data->is(self::LM_HTML_EXPORT_RENDERING, true)) {
122  return $this->globalScreen()
123  ->layout()
124  ->factory()
125  ->breadcrumbs()
126  ->withModification(function (?Breadcrumbs $current = null) : ?Breadcrumbs {
127  return null;
128  })->withHighPriority();
129  } else {
130  return null;
131  }
132  }
133 }
LM HTML export view layout provider, hides main and meta bar.
Class Factory.
This describes the MainBar.
Definition: MainBar.php:16
Class ChatMainBarProvider .
Class ilLMGSToolProvider.
$lng
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
global $DIC
Definition: goto.php:24
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
getBreadCrumbsModification(CalledContexts $called_contexts)
No breadcrumbs in HTML exports.
This describes the MetaBar.
Definition: MetaBar.php:14
getMetaBarModification(CalledContexts $called_contexts)
No meta bar in HTML exports.
getMainBarModification(CalledContexts $called_contexts)
No main bar in HTML exports.