15 use \ILIAS\GlobalScreen\Scope\MainMenu\Collector\Renderer\Hasher;
27 return $this->context_collection->
main()->repository();
39 $access =
$DIC->access();
41 $lng->loadLanguageModule(
"content");
44 $additional_data = $called_contexts->
current()->getAdditionalData();
45 if ($additional_data->is(self::SHOW_TOC_TOOL,
true)) {
46 $iff =
function ($id) {
47 return $this->identification_provider->contextAwareIdentifier($id);
49 $l =
function (
string $content) {
50 return $this->dic->ui()->factory()->legacy($content);
52 $ref_id = $called_contexts->
current()->getReferenceId()->toInt();
54 if (!$access->checkAccess(
"read",
"", $ref_id)) {
59 $tools[] = $this->
getTocTool($additional_data);
61 $title =
$lng->txt(
"obj_glo");
63 $identification = $iff(
"lm_glossary");
64 $hashed = $this->hash($identification->serialize());
65 $tools[] = $this->factory->tool($identification)
66 ->addComponentDecorator(
static function (
ILIAS\
UI\Component\Component
$c) use ($hashed) :
ILIAS\
UI\Component\Component {
67 if (
$c instanceof LegacySlate) {
68 $signal_id =
$c->getToggleSignal()->getId();
69 return $c->withAdditionalOnLoadCode(
static function ($id) use ($hashed) {
71 $('body').on('il-lm-show-glossary-slate', function(){
72 il.UI.maincontrols.mainbar.engageTool('$hashed');
78 ->withInitiallyHidden(
true)
80 ->withContentWrapper(
function () use ($l) {
86 $title =
$lng->txt(
"cont_tool_media");
88 $identification = $iff(
"lm_media");
89 $hashed = $this->hash($identification->serialize());
90 $tools[] = $this->factory->tool($identification)
91 ->addComponentDecorator(
static function (
ILIAS\
UI\Component\Component
$c) use ($hashed) :
ILIAS\
UI\Component\Component {
92 if (
$c instanceof LegacySlate) {
93 $signal_id =
$c->getToggleSignal()->getId();
94 return $c->withAdditionalOnLoadCode(
static function ($id) use ($hashed) {
96 $('body').on('il-lm-show-media-slate', function(){
97 il.UI.maincontrols.mainbar.engageTool('$hashed');
103 ->withInitiallyHidden(
true)
105 ->withContentWrapper(
function () use ($l) {
111 $title =
$lng->txt(
"cont_tool_faq");
113 $identification = $iff(
"lm_faq");
114 $hashed = $this->hash($identification->serialize());
115 $tools[] = $this->factory->tool($identification)
116 ->addComponentDecorator(
static function (
ILIAS\
UI\Component\Component
$c) use ($hashed) :
ILIAS\
UI\Component\Component {
117 if (
$c instanceof LegacySlate) {
118 $signal_id =
$c->getToggleSignal()->getId();
119 return $c->withAdditionalOnLoadCode(
static function ($id) use ($hashed) {
121 $('body').on('il-lm-show-faq-slate', function(){
122 il.UI.maincontrols.mainbar.engageTool('$hashed');
128 ->withInitiallyHidden(
true)
130 ->withContentWrapper(
function () use ($l) {
148 $iff =
function ($id) {
149 return $this->identification_provider->contextAwareIdentifier($id);
152 $this->hash($iff(
"lm_pres_toc")->serialize()),
153 $this->hash($iff(
"lm_glossary")->serialize()),
154 $this->hash($iff(
"lm_media")->serialize()),
155 $this->hash($iff(
"lm_faq")->serialize())
166 public function getTocTool($additional_data) : \
ILIAS\GlobalScreen\Scope\Tool\Factory\Tool
172 $iff =
function ($id) {
173 return $this->identification_provider->contextAwareIdentifier($id);
175 $l =
function (
string $content) {
176 return $this->dic->ui()->factory()->legacy($content);
179 $title =
$lng->txt(
"cont_toc");
181 return $this->factory->tool($iff(
"lm_pres_toc"))
183 ->withContentWrapper(
function () use ($l, $additional_data) {
184 return $l($this->
getToc($additional_data));
198 private function getToc($additional_data) : string
203 $params = $additional_data->get(self::LM_QUERY_PARAMS);
204 $offline = $additional_data->is(self::LM_OFFLINE,
true);
205 if (!is_array($params)) {
213 return $renderer->render();
214 }
catch (Exception
$e) {
227 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.