15 use \ILIAS\GlobalScreen\Scope\MainMenu\Collector\Renderer\Hasher;
28 return $this->context_collection->
main()->repository();
39 $access =
$DIC->access();
41 $lng->loadLanguageModule(
"content");
44 $additional_data = $called_contexts->
current()->getAdditionalData();
45 $iff =
function ($id) {
46 return $this->identification_provider->contextAwareIdentifier($id);
48 $l =
function (
string $content) {
49 return $this->dic->ui()->factory()->legacy($content);
52 if ($additional_data->is(self::SHOW_TOC_TOOL,
true)) {
53 $ref_id = $called_contexts->
current()->getReferenceId()->toInt();
55 if (!$access->checkAccess(
"read",
"", $ref_id)) {
60 $tools[] = $this->
getTocTool($additional_data);
63 if ($additional_data->is(self::SHOW_LINK_SLATES,
true)) {
64 $title =
$lng->txt(
"obj_glo");
66 $identification = $iff(
"lm_glossary");
67 $hashed = $this->hash($identification->serialize());
68 $tools[] = $this->factory->tool($identification)
69 ->addComponentDecorator(
static function (
ILIAS\
UI\Component\Component
$c) use ($hashed) :
ILIAS\
UI\Component\Component {
70 if (
$c instanceof LegacySlate) {
71 $signal_id =
$c->getToggleSignal()->getId();
72 return $c->withAdditionalOnLoadCode(
static function ($id) use ($hashed) {
74 $('body').on('il-lm-show-glossary-slate', function(){
75 il.UI.maincontrols.mainbar.engageTool('$hashed');
81 ->withInitiallyHidden(
true)
83 ->withContentWrapper(
function () use ($l) {
89 $title =
$lng->txt(
"cont_tool_media");
91 $identification = $iff(
"lm_media");
92 $hashed = $this->hash($identification->serialize());
93 $tools[] = $this->factory->tool($identification)
94 ->addComponentDecorator(
static function (
ILIAS\
UI\Component\Component
$c) use ($hashed) :
ILIAS\
UI\Component\Component {
95 if (
$c instanceof LegacySlate) {
96 $signal_id =
$c->getToggleSignal()->getId();
97 return $c->withAdditionalOnLoadCode(
static function ($id) use ($hashed) {
99 $('body').on('il-lm-show-media-slate', function(){
100 il.UI.maincontrols.mainbar.engageTool('$hashed');
106 ->withInitiallyHidden(
true)
108 ->withContentWrapper(
function () use ($l) {
114 $title =
$lng->txt(
"cont_tool_faq");
116 $identification = $iff(
"lm_faq");
117 $hashed = $this->hash($identification->serialize());
118 $tools[] = $this->factory->tool($identification)
119 ->addComponentDecorator(
static function (
ILIAS\
UI\Component\Component
$c) use ($hashed) :
ILIAS\
UI\Component\Component {
120 if (
$c instanceof LegacySlate) {
121 $signal_id =
$c->getToggleSignal()->getId();
122 return $c->withAdditionalOnLoadCode(
static function ($id) use ($hashed) {
124 $('body').on('il-lm-show-faq-slate', function(){
125 il.UI.maincontrols.mainbar.engageTool('$hashed');
131 ->withInitiallyHidden(
true)
133 ->withContentWrapper(
function () use ($l) {
150 $iff =
function ($id) {
151 return $this->identification_provider->contextAwareIdentifier($id);
154 $this->hash($iff(
"lm_pres_toc")->serialize()),
155 $this->hash($iff(
"lm_glossary")->serialize()),
156 $this->hash($iff(
"lm_media")->serialize()),
157 $this->hash($iff(
"lm_faq")->serialize())
168 public function getTocTool($additional_data) : \
ILIAS\GlobalScreen\Scope\Tool\Factory\Tool
174 $iff =
function ($id) {
175 return $this->identification_provider->contextAwareIdentifier($id);
177 $l =
function (
string $content) {
178 return $this->dic->ui()->factory()->legacy($content);
181 $title =
$lng->txt(
"cont_toc");
183 return $this->factory->tool($iff(
"lm_pres_toc"))
185 ->withContentWrapper(
function () use ($l, $additional_data) {
186 return $l($this->
getToc($additional_data));
200 private function getToc($additional_data) : string
204 $params = $additional_data->get(self::LM_QUERY_PARAMS);
205 $offline = $additional_data->is(self::LM_OFFLINE,
true);
207 if (!is_array($params)) {
214 return $renderer->render();
215 }
catch (Exception
$e) {
228 return "<div style='height:100%; overflow:hidden;' id='" .
$type .
"_area'><iframe style='border:0; padding:0; height:100%; width:100%'></iframe></div>";
An exception for terminatinating execution or to throw for unit testing.
Main service init and factory.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
withSymbol(Symbol $symbol)
@inheritDoc
Class ChatMainBarProvider \MainMenu\Provider.