ILIAS  trunk Revision v11.0_alpha-1689-g66c127b4ae8
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
class.ilLMHtmlExportViewLayoutProvider.php
Go to the documentation of this file.
1 <?php
2 
29 
35 {
36  public const LM_HTML_EXPORT_RENDERING = 'lm_html_export_rendering';
37 
42  {
43  return $this->context_collection->repository();
44  }
45 
49  public function getMetaBarModification(CalledContexts $screen_context_stack): ?MetaBarModification
50  {
51  $additional_data = $screen_context_stack->current()->getAdditionalData();
52  if ($additional_data->is(self::LM_HTML_EXPORT_RENDERING, true)) {
53  return $this->globalScreen()
54  ->layout()
55  ->factory()
56  ->metabar()
57  ->withModification(function (?MetaBar $current = null): ?MetaBar {
58  return null;
59  })->withHighPriority();
60  }
61  return null;
62  }
63 
67  public function getMainBarModification(CalledContexts $screen_context_stack): ?MainBarModification
68  {
69  $additional_data = $screen_context_stack->current()->getAdditionalData();
70  if ($additional_data->is(self::LM_HTML_EXPORT_RENDERING, true)) {
71  return $this->globalScreen()
72  ->layout()
73  ->factory()
74  ->mainbar()
75  ->withModification(function (?MainBar $current = null): ?MainBar {
76  if ($current === null) {
77  return null;
78  }
79  global $DIC;
80 
81  $lng = $DIC->language();
82  $f = $DIC->ui()->factory();
83 
84  // create an offline main bar
85  $offline_main_bar = new \ILIAS\UI\Implementation\Component\MainControls\MainBar(
86  new \ILIAS\UI\Implementation\Component\SignalGenerator()
87  );
88  $grid_icon = $f->symbol()->icon()->custom(\ilUtil::getImagePath("standard/icon_tool.svg"), $lng->txt("more"));
89  $tools_button = $f->button()->bulky($grid_icon, $lng->txt("tools"), "#")->withEngagedState(true);
90  $offline_main_bar = $offline_main_bar->withToolsButton($tools_button);
91 
92  // get tool ids for offline use from lm tools provider
93  $lm_tools = new ilLMGSToolProvider($DIC);
94  $ids = $lm_tools->getOfflineToolIds();
95 
96  // copy all offline tools from original main bar to offline main bar
97  foreach ($current->getToolEntries() as $id => $te) {
98  if (in_array($id, $ids)) {
99  $offline_main_bar = $offline_main_bar->withAdditionalToolEntry(
100  $id,
101  $te
102  );
103  }
104  }
105 
106  return $offline_main_bar;
107  })->withHighPriority();
108  } else {
109  return null;
110  }
111  }
112 
116  public function getBreadCrumbsModification(CalledContexts $screen_context_stack): ?BreadCrumbsModification
117  {
118  $additional_data = $screen_context_stack->current()->getAdditionalData();
119  if ($additional_data->is(self::LM_HTML_EXPORT_RENDERING, true)) {
120  return $this->globalScreen()
121  ->layout()
122  ->factory()
123  ->breadcrumbs()
124  ->withModification(function (?Breadcrumbs $current = null): ?Breadcrumbs {
125  return null;
126  })->withHighPriority();
127  } else {
128  return null;
129  }
130  }
131 }
LM HTML export view layout provider, hides main and meta bar.
This describes the MainBar.
Definition: MainBar.php:33
getBreadCrumbsModification(CalledContexts $screen_context_stack)
No breadcrumbs in HTML exports.
Interface Observer Contains several chained tasks and infos about them.
getMetaBarModification(CalledContexts $screen_context_stack)
No meta bar in HTML exports.
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
global $DIC
Definition: shib_login.php:22
static getImagePath(string $image_name, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
This describes the MetaBar.
Definition: MetaBar.php:32
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
global $lng
Definition: privfeed.php:31
getMainBarModification(CalledContexts $screen_context_stack)
No main bar in HTML exports.