34 protected \ILIAS\Repository\InternalGUIService
$gui;
48 protected \ILIAS\DI\UIServices
$ui;
55 $domain = $this->
internal()->domain();
57 $this->
settings = $domain->settings();
58 $this->
lng = $domain->lng();
59 $this->
user = $domain->user();
61 $this->help_map = $domain->map();
62 $this->presentation = $domain->presentation();
64 if (!isset($DIC[
'help.screen_id_collector'])) {
65 $DIC[
'help.screen_id_collector'] =
function () use ($DIC) {
69 $DIC->ctrl()->attachObserver($DIC[
'help.screen_id_collector']);
70 $this->observer = $DIC[
'help.screen_id_collector'];
75 $this->
ui = $this->
internal()->gui()->ui();
76 $gui = $this->
internal()->gui();
77 $this->
ctrl = $gui->ctrl();
78 $this->help_request = $gui->standardRequest();
84 return $DIC->repository()->internal()->gui()->symbol();
91 $this->def_screen_id[$a_part] = $a_id;
96 $this->screen_id[self::ID_PART_SCREEN] = $a_id;
101 $this->screen_id[self::ID_PART_SUB_SCREEN] = $a_id;
106 $this->screen_id_component = $a_comp;
111 return $this->observer->getScreenId();
113 $comp = ($this->screen_id_component !=
"")
114 ? $this->screen_id_component
115 : ($this->def_screen_id[self::ID_PART_COMPONENT] ??
'');
121 $scr_id = (isset($this->screen_id[self::ID_PART_SCREEN]) && $this->screen_id[self::ID_PART_SCREEN] !=
"")
122 ? $this->screen_id[self::ID_PART_SCREEN]
123 : ($this->def_screen_id[self::ID_PART_SCREEN] ??
'');
125 $sub_scr_id = (isset($this->screen_id[self::ID_PART_SUB_SCREEN]) && $this->screen_id[self::ID_PART_SUB_SCREEN] !=
"")
126 ? $this->screen_id[self::ID_PART_SUB_SCREEN]
127 : ($this->def_screen_id[self::ID_PART_SUB_SCREEN] ??
'');
129 $screen_id = $comp .
"/" .
140 $this->help_sections[] = array(
"help_id" => $a_help_id, $a_level);
145 return $this->help_map->hasScreenIdSections($this->
getScreenId());
150 return $this->help_map->getHelpSectionsForId(
152 $this->help_request->getRefId()
159 $refId = (string) $this->help_request->getRefId();
160 $ilCtrl->setParameterByClass(
"ilhelpgui",
"help_screen_id", $this->
getScreenId() .
"." .
$refId);
166 $cmd = $this->
ctrl->getCmd(
"showHelp") ?:
"showHelp";
167 return (
string) $this->$cmd();
175 if ($this->help_request->getHelpScreenId() !==
"") {
176 ilSession::set(
"help_screen_id", $this->help_request->getHelpScreenId());
177 $help_screen_id = $this->help_request->getHelpScreenId();
186 $id_arr = explode(
".", $help_screen_id);
187 $help_arr = $this->help_map->getHelpSectionsForId($id_arr[0], (
int) $id_arr[1]);
189 if (count($help_arr) > 0) {
191 $acc->setId(
"oh_acc");
192 $acc->setUseSessionStorage(
true);
195 foreach ($help_arr as $h_id) {
203 foreach ($pages as $pg) {
204 $items[] = $this->
ui->factory()->button()->shy(
207 )->withOnLoadCode(
function (
$id) use ($pg) {
208 return "document.getElementById('$id').addEventListener('click', () => {return il.Help.showPage(" . $pg[
"child"] .
");})";
211 $list = $this->
ui->factory()->listing()->unordered($items);
215 $h_tpl =
new ilTemplate(
"tpl.help.html",
true,
true,
"components/ILIAS/Help");
216 $h_tpl->setVariable(
"HEAD", $lng->
txt(
"help"));
218 $h_tpl->setCurrentBlock(
"search");
219 $h_tpl->setVariable(
"GL_SEARCH", $this->
symbol()->glyph(
"search")->render());
220 $h_tpl->setVariable(
"HELP_SEARCH_LABEL", $this->
lng->txt(
"help_search_label"));
221 $h_tpl->parseCurrentBlock();
223 if (count($help_arr) > 0) {
224 $h_tpl->setVariable(
"CONTENT", $acc->getHTML(
true));
226 $mess = $ui->factory()->messageBox()->info($lng->
txt(
"help_no_content"));
227 $h_tpl->setVariable(
"CONTENT", $ui->renderer()->render([$mess]));
230 $h_tpl->setVariable(
"CLOSE_IMG", $this->
symbol()->glyph(
"close")->render());
241 $page_id = $this->help_request->getHelpPage();
243 $h_tpl =
new ilTemplate(
"tpl.help.html",
true,
true,
"components/ILIAS/Help");
246 $back_button = $ui->factory()->button()->bulky($ui->factory()->symbol()->glyph()->back(), $lng->
txt(
"back"),
"#")->
withOnLoadCode(
function (
$id) use ($t) {
250 ) .
"'); return false;});";
253 $back_button = $ui->factory()->button()->bulky($ui->factory()->symbol()->glyph()->back(), $lng->
txt(
"back"),
"#")->
withOnLoadCode(
function (
$id) {
255 "$(\"#$id\").click(function() { return il.Help.listHelp(event, true); return false;});";
258 $h_tpl->setVariable(
"BACKBUTTON", $ui->renderer()->renderAsync($back_button));
271 $cfg = $page_gui->getPageConfig();
272 $page_gui->setPresentationTitle(
"");
273 $page_gui->setTemplateOutput(
false);
274 $page_gui->setHeader(
"");
275 $page_gui->setRawPageContent(
true);
276 $cfg->setEnablePCType(
"Map",
false);
277 $cfg->setEnablePCType(
"Tabs",
false);
278 $cfg->setEnablePCType(
"FileList",
false);
280 $page_gui->getPageObject()->buildDom();
281 $int_links = $page_gui->getPageObject()->getInternalLinks();
285 $page_gui->setLinkXml($link_xml);
289 $h_tpl->setVariable(
"CONTENT", $ret);
290 $h_tpl->setVariable(
"CLOSE_IMG", $this->
symbol()->glyph(
"close")->render());
294 $page = $h_tpl->get();
310 if ($this->screen_id_component !=
"") {
311 return $this->
internal()->domain()->tooltips()->getTooltipPresentationText($this->screen_id_component .
"_" . $a_tab_id);
323 $ilUser = $DIC->user();
325 $ctrl = $DIC->ctrl();
330 $a_tpl->
addJavaScript(
"components/ILIAS/COPage/js/ilCOPagePres.js");
334 "il.Help.setAjaxUrl('" .
340 if ($this->presentation->isHelpActive()) {
372 $link_info =
"<IntLinkInfos>";
373 foreach ($a_int_links as $int_link) {
374 $target = $int_link[
"Target"];
375 if (strpos($target,
"il__") === 0) {
376 $target_arr = explode(
"_", $target);
377 $target_id = $target_arr[count($target_arr) - 1];
378 $type = $int_link[
"Type"];
379 $targetframe =
"None";
382 $anc = $anc_add =
"";
383 if (($int_link[
"Anchor"] ??
"") !=
"") {
384 $anc = $int_link[
"Anchor"];
385 $anc_add =
"_" . rawurlencode($int_link[
"Anchor"]);
390 case "StructureObject":
391 if ($type ===
"PageObject") {
392 $href =
"#pg_" . $target_id;
399 $link_info .=
"<IntLinkInfo Target=\"$target\" Type=\"$type\" " .
400 "TargetFrame=\"$targetframe\" LinkHref=\"$href\" LinkTarget=\"\" Anchor=\"\"/>";
403 $link_info .=
"</IntLinkInfos>";
413 $link_info =
"<LinkTargets>";
414 $link_info .=
"<LinkTarget TargetFrame=\"None\" LinkTarget=\"\" OnClick=\"return il.Help.openLink(event);\" />";
415 $link_info .=
"</LinkTargets>";
424 $term = $this->help_request->getTerm();
432 $h_tpl =
new ilTemplate(
"tpl.help.html",
true,
true,
"components/ILIAS/Help");
434 $back_button = $ui->factory()->button()->bulky($ui->factory()->symbol()->glyph()->back(), $lng->
txt(
"back"),
"#")->
withOnLoadCode(
function (
$id) {
436 "$(\"#$id\").click(function() { return il.Help.listHelp(event, true); return false;});";
438 $h_tpl->setVariable(
"BACKBUTTON", $ui->renderer()->renderAsync($back_button));
440 $h_tpl->setVariable(
"HEAD", $lng->
txt(
"help") .
" - " .
441 $lng->
txt(
"search_result"));
443 $h_tpl->setCurrentBlock(
"search");
444 $h_tpl->setVariable(
"GL_SEARCH", $this->
symbol()->glyph(
"search")->render());
445 $h_tpl->setVariable(
"HELP_SEARCH_LABEL", $this->
lng->txt(
"help_search_label"));
447 $h_tpl->parseCurrentBlock();
449 $h_tpl->setVariable(
"CLOSE_IMG", $this->
symbol()->glyph(
"close")->render());
452 $module = $this->
internal()->domain()->module();
453 foreach ($module->getActiveModules() as $module_id) {
454 $lm_id = $module->lookupModuleLmId($module_id);
456 $s->setQueryString($term);
457 $result = $s->performSearch();
458 foreach ($result->getResults() as
$r) {
459 $items[] = $this->
ui->factory()->button()->shy(
462 )->withOnLoadCode(
function (
$id) use (
$r) {
463 return "document.getElementById('$id').addEventListener('click', () => {return il.Help.showPage(" .
$r[
"item_id"] .
");})";
468 $list = $this->
ui->factory()->listing()->unordered($items);
469 $h_tpl->setVariable(
"CONTENT", $this->
ui->renderer()->renderAsync($list));
482 $mmc = $DIC->globalScreen()->collector()->mainmenu();
483 if ($this->raw_menu_items ==
null) {
485 $this->raw_menu_items = iterator_to_array($mmc->getRawItems());
488 foreach ($this->raw_menu_items as $item) {
489 if ($item instanceof Item\
LinkList) {
490 foreach ($item->getLinks() as $link) {
504 $mmc = $DIC->globalScreen()->collector()->mainmenu();
506 $id = $item->getProviderIdentification()->getInternalIdentifier();
507 $ws =
"[ \t\r\f\v\n]*";
510 while (preg_match(
"~\[(menu" . $ws .
"path$ws=$ws(\"$id\")$ws)/\]~i", $content, $found)) {
513 $parent = $mmc->getItemInformation()->getParent($item);
514 if ($parent !==
null) {
515 $parent = $mmc->getSingleItemFromRaw($parent);
516 $path = $this->getTitleForItem($parent) .
" > ";
519 $path .= $this->getTitleForItem($item);
520 $content = preg_replace(
521 '~\[' . $found[1] .
'/\]~i',
522 "<strong>" .
$path .
"</strong>",
527 while (preg_match(
"~\[(menu" . $ws .
"item$ws=$ws(\"$id\")$ws)/\]~i", $content, $found)) {
528 $content = preg_replace(
529 '~\[' . $found[1] .
'/\]~i',
530 "<strong>" . $this->getTitleForItem($item) .
"</strong>",
541 protected function getTitleForItem(
548 $mmc = $DIC->globalScreen()->collector()->mainmenu();
549 return $mmc->getItemInformation()->customTranslationForUser($i)->getTitle();
554 return $this->presentation->showTooltips();
559 return $this->
internal()->domain()->module()->isHelpActive();
564 return $this->
internal()->domain()->module()->areTooltipsActive();
570 $this->
user->setPref(
'hide_help_tt', (
string) (
int) !$form->
getInput(
'help_tooltips'));
577 $this->
lng->loadLanguageModule(
'help');
579 $cb->setChecked(!($this->
user->prefs[
'hide_help_tt'] ??
false));
580 $cb->setInfo($this->
lng->txt(
'help_toggle_tooltips_info'));
588 public function internal(): \
ILIAS\Help\InternalService
592 if (is_null(self::$internal_service)) {
593 self::$internal_service = new \ILIAS\Help\InternalService(
597 return self::$internal_service;
static get(string $a_var)
writePref(string $a_keyword, string $a_value)
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
ILIAS Help Map MapManager $help_map
string $screen_id_component
Interface Observer Contains several chained tasks and infos about them.
addOnLoadCode(string $a_code, int $a_batch=2)
Add on load code.
ILIAS Repository InternalGUIService $gui
addHelpSection(string $a_help_id, int $a_level=1)
addPersonalSettingToLegacyForm(ilPropertyFormGUI $form)
loadLanguageModule(string $a_module)
Load language module.
static ILIAS Help InternalService $internal_service
withOnLoadCode(Closure $binder)
savePersonalSettingFromLegacyForm(ilPropertyFormGUI $form)
static _lookupTitle(int $a_obj_id)
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static initMaphilight()
Inits and add maphilight to the general template.
static _existsAndNotEmpty(string $a_parent_type, int $a_id, string $a_lang="-")
checks whether page exists and is not empty (may return true on some empty pages) ...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setScreenId(string $a_id)
replaceItemTag(string $content, \ILIAS\GlobalScreen\Scope\MainMenu\Factory\isItem $item)
setSubScreenId(string $a_id)
setScreenIdComponent(string $a_comp)
Extension of ilPageObjectGUI for learning modules.
getTabTooltipText(string $a_tab_id)
static getPagesOfChapter(int $a_lm_id, int $a_chap_id)
Get pages of chapter.
getLinkXML(array $a_int_links)
getLinkTargetsXML()
Get XMl for Link Targets.
initHelp(ilGlobalTemplateInterface $a_tpl, string $ajax_url)
static _exists(int $a_id)
checks wether a lm content object with specified id exists or not
StandardGUIRequest $help_request
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
ILIAS Help Presentation PresentationManager $presentation
addJavaScript(string $a_js_file, bool $a_add_version_parameter=true, int $a_batch=2)
Add a javascript file that should be included in the header.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _lookupContObjID(int $a_id)
get learning module id for lm object
setDefaultScreenId(string $a_part, string $a_id)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static clear(string $a_var)
replaceMenuItemTags(string $content)
static set(string $a_var, $a_val)
Set a value.
HelpScreenIdObserver $observer
getLinkTargetByClass( $a_class, ?string $a_cmd=null, ?string $a_anchor=null, bool $is_async=false, bool $has_xml_style=false)