32 protected \ILIAS\Repository\InternalGUIService
$gui;
46 protected \ILIAS\DI\UIServices
$ui;
51 $domain = $this->
internal()->domain();
53 $this->
settings = $domain->settings();
54 $this->
lng = $domain->lng();
55 $this->
user = $domain->user();
57 $this->help_map = $domain->map();
58 $this->presentation = $domain->presentation();
63 $this->
ui = $this->
internal()->gui()->ui();
64 $gui = $this->
internal()->gui();
65 $this->
ctrl = $gui->ctrl();
66 $this->help_request = $gui->standardRequest();
72 return $DIC->repository()->internal()->gui()->symbol();
79 $this->def_screen_id[$a_part] = $a_id;
84 $this->screen_id[self::ID_PART_SCREEN] = $a_id;
89 $this->screen_id[self::ID_PART_SUB_SCREEN] = $a_id;
94 $this->screen_id_component = $a_comp;
99 $comp = ($this->screen_id_component !=
"")
100 ? $this->screen_id_component
101 : ($this->def_screen_id[self::ID_PART_COMPONENT] ??
'');
107 $scr_id = (isset($this->screen_id[self::ID_PART_SCREEN]) && $this->screen_id[self::ID_PART_SCREEN] !=
"")
108 ? $this->screen_id[self::ID_PART_SCREEN]
109 : ($this->def_screen_id[self::ID_PART_SCREEN] ??
'');
111 $sub_scr_id = (isset($this->screen_id[self::ID_PART_SUB_SCREEN]) && $this->screen_id[self::ID_PART_SUB_SCREEN] !=
"")
112 ? $this->screen_id[self::ID_PART_SUB_SCREEN]
113 : ($this->def_screen_id[self::ID_PART_SUB_SCREEN] ??
'');
115 $screen_id = $comp .
"/" .
126 $this->help_sections[] = array(
"help_id" => $a_help_id, $a_level);
131 return $this->help_map->hasScreenIdSections($this->
getScreenId());
136 return $this->help_map->getHelpSectionsForId(
138 $this->help_request->getRefId()
145 $refId = (string) $this->help_request->getRefId();
146 $ilCtrl->setParameterByClass(
"ilhelpgui",
"help_screen_id", $this->
getScreenId() .
"." .
$refId);
152 $cmd = $this->
ctrl->getCmd(
"showHelp") ?:
"showHelp";
153 return (
string) $this->$cmd();
162 if ($this->help_request->getHelpScreenId() !==
"") {
163 ilSession::set(
"help_screen_id", $this->help_request->getHelpScreenId());
164 $help_screen_id = $this->help_request->getHelpScreenId();
173 $id_arr = explode(
".", $help_screen_id);
174 $help_arr = $this->help_map->getHelpSectionsForId($id_arr[0], (
int) $id_arr[1]);
176 if (count($help_arr) > 0) {
178 $acc->setId(
"oh_acc");
179 $acc->setUseSessionStorage(
true);
182 foreach ($help_arr as $h_id) {
190 foreach ($pages as $pg) {
191 $items[] = $this->
ui->factory()->button()->shy(
194 )->withOnLoadCode(
function (
$id) use ($pg) {
195 return "document.getElementById('$id').addEventListener('click', () => {return il.Help.showPage(" . $pg[
"child"] .
");})";
198 $list = $this->
ui->factory()->listing()->unordered($items);
202 $h_tpl =
new ilTemplate(
"tpl.help.html",
true,
true,
"Services/Help");
203 $h_tpl->setVariable(
"HEAD", $lng->
txt(
"help"));
205 $h_tpl->setCurrentBlock(
"search");
206 $h_tpl->setVariable(
"GL_SEARCH", $this->
symbol()->glyph(
"search")->render());
207 $h_tpl->setVariable(
"HELP_SEARCH_LABEL", $this->
lng->txt(
"help_search_label"));
208 $h_tpl->parseCurrentBlock();
210 if (count($help_arr) > 0) {
211 $h_tpl->setVariable(
"CONTENT", $acc->getHTML(
true));
213 $mess = $ui->factory()->messageBox()->info($lng->
txt(
"help_no_content"));
214 $h_tpl->setVariable(
"CONTENT", $ui->renderer()->render([$mess]));
217 $h_tpl->setVariable(
"CLOSE_IMG", $this->
symbol()->glyph(
"close")->render());
228 $page_id = $this->help_request->getHelpPage();
230 $h_tpl =
new ilTemplate(
"tpl.help.html",
true,
true,
"Services/Help");
233 $back_button = $ui->factory()->button()->bulky($ui->factory()->symbol()->glyph()->back(), $lng->
txt(
"back"),
"#")->
withOnLoadCode(
function (
$id) use ($t) {
237 ) .
"'); return false;});";
240 $back_button = $ui->factory()->button()->bulky($ui->factory()->symbol()->glyph()->back(), $lng->
txt(
"back"),
"#")->
withOnLoadCode(
function (
$id) {
242 "$(\"#$id\").click(function() { return il.Help.listHelp(event, true); return false;});";
245 $h_tpl->setVariable(
"BACKBUTTON", $ui->renderer()->renderAsync($back_button));
258 $cfg = $page_gui->getPageConfig();
259 $page_gui->setPresentationTitle(
"");
260 $page_gui->setTemplateOutput(
false);
261 $page_gui->setHeader(
"");
262 $page_gui->setRawPageContent(
true);
263 $cfg->setEnablePCType(
"Map",
false);
264 $cfg->setEnablePCType(
"Tabs",
false);
265 $cfg->setEnablePCType(
"FileList",
false);
267 $page_gui->getPageObject()->buildDom();
268 $int_links = $page_gui->getPageObject()->getInternalLinks();
272 $page_gui->setLinkXml($link_xml);
276 $h_tpl->setVariable(
"CONTENT", $ret);
277 $h_tpl->setVariable(
"CLOSE_IMG", $this->
symbol()->glyph(
"close")->render());
281 $page = $h_tpl->get();
297 if ($this->screen_id_component !=
"") {
298 return $this->
internal()->domain()->tooltips()->getTooltipPresentationText($this->screen_id_component .
"_" . $a_tab_id);
310 $ilUser = $DIC->user();
312 $ctrl = $DIC->ctrl();
315 $a_tpl->
addJavaScript(
"./Services/Accordion/js/accordion.js");
317 $a_tpl->
addJavaScript(
"./Services/COPage/js/ilCOPagePres.js");
321 "il.Help.setAjaxUrl('" .
327 if ($this->presentation->isHelpActive()) {
359 $link_info =
"<IntLinkInfos>";
360 foreach ($a_int_links as $int_link) {
361 $target = $int_link[
"Target"];
362 if (strpos($target,
"il__") === 0) {
363 $target_arr = explode(
"_", $target);
364 $target_id = $target_arr[count($target_arr) - 1];
365 $type = $int_link[
"Type"];
366 $targetframe =
"None";
369 $anc = $anc_add =
"";
370 if (($int_link[
"Anchor"] ??
"") !=
"") {
371 $anc = $int_link[
"Anchor"];
372 $anc_add =
"_" . rawurlencode($int_link[
"Anchor"]);
377 case "StructureObject":
378 if ($type ===
"PageObject") {
379 $href =
"#pg_" . $target_id;
386 $link_info .=
"<IntLinkInfo Target=\"$target\" Type=\"$type\" " .
387 "TargetFrame=\"$targetframe\" LinkHref=\"$href\" LinkTarget=\"\" Anchor=\"\"/>";
390 $link_info .=
"</IntLinkInfos>";
400 $link_info =
"<LinkTargets>";
401 $link_info .=
"<LinkTarget TargetFrame=\"None\" LinkTarget=\"\" OnClick=\"return il.Help.openLink(event);\" />";
402 $link_info .=
"</LinkTargets>";
411 $term = $this->help_request->getTerm();
419 $h_tpl =
new ilTemplate(
"tpl.help.html",
true,
true,
"Services/Help");
421 $back_button = $ui->factory()->button()->bulky($ui->factory()->symbol()->glyph()->back(), $lng->
txt(
"back"),
"#")->
withOnLoadCode(
function (
$id) {
423 "$(\"#$id\").click(function() { return il.Help.listHelp(event, true); return false;});";
425 $h_tpl->setVariable(
"BACKBUTTON", $ui->renderer()->renderAsync($back_button));
427 $h_tpl->setVariable(
"HEAD", $lng->
txt(
"help") .
" - " .
428 $lng->
txt(
"search_result"));
430 $h_tpl->setCurrentBlock(
"search");
431 $h_tpl->setVariable(
"GL_SEARCH", $this->
symbol()->glyph(
"search")->render());
432 $h_tpl->setVariable(
"HELP_SEARCH_LABEL", $this->
lng->txt(
"help_search_label"));
434 $h_tpl->parseCurrentBlock();
436 $h_tpl->setVariable(
"CLOSE_IMG", $this->
symbol()->glyph(
"close")->render());
439 $module = $this->
internal()->domain()->module();
440 foreach ($module->getActiveModules() as $module_id) {
441 $lm_id = $module->lookupModuleLmId($module_id);
443 $s->setQueryString($term);
444 $result = $s->performSearch();
445 foreach ($result->getResults() as
$r) {
446 $items[] = $this->
ui->factory()->button()->shy(
449 )->withOnLoadCode(
function (
$id) use (
$r) {
450 return "document.getElementById('$id').addEventListener('click', () => {return il.Help.showPage(" .
$r[
"item_id"] .
");})";
455 $list = $this->
ui->factory()->listing()->unordered($items);
456 $h_tpl->setVariable(
"CONTENT", $this->
ui->renderer()->renderAsync($list));
469 $mmc = $DIC->globalScreen()->collector()->mainmenu();
470 if ($this->raw_menu_items == null) {
472 $this->raw_menu_items = iterator_to_array($mmc->getRawItems());
475 foreach ($this->raw_menu_items as $item) {
476 if ($item instanceof Item\
LinkList) {
477 foreach ($item->getLinks() as $link) {
491 $mmc = $DIC->globalScreen()->collector()->mainmenu();
493 $id = $item->getProviderIdentification()->getInternalIdentifier();
494 $ws =
"[ \t\r\f\v\n]*";
497 while (preg_match(
"~\[(menu" . $ws .
"path$ws=$ws(\"$id\")$ws)/\]~i", $content, $found)) {
500 $parent = $mmc->getItemInformation()->getParent($item);
501 if ($parent !== null) {
502 $parent = $mmc->getSingleItemFromRaw($parent);
503 $path = $this->getTitleForItem($parent) .
" > ";
506 $path .= $this->getTitleForItem($item);
507 $content = preg_replace(
508 '~\[' . $found[1] .
'/\]~i',
509 "<strong>" .
$path .
"</strong>",
514 while (preg_match(
"~\[(menu" . $ws .
"item$ws=$ws(\"$id\")$ws)/\]~i", $content, $found)) {
515 $content = preg_replace(
516 '~\[' . $found[1] .
'/\]~i',
517 "<strong>" . $this->getTitleForItem($item) .
"</strong>",
528 protected function getTitleForItem(
535 $mmc = $DIC->globalScreen()->collector()->mainmenu();
536 return $mmc->getItemInformation()->customTranslationForUser($i)->getTitle();
541 return $this->presentation->showTooltips();
546 return $this->
internal()->domain()->module()->isHelpActive();
551 return $this->
internal()->domain()->module()->areTooltipsActive();
557 $this->
user->setPref(
'hide_help_tt', (
string) (
int) !$form->
getInput(
'help_tooltips'));
564 $this->
lng->loadLanguageModule(
'help');
566 $cb->setChecked(!($this->
user->prefs[
'hide_help_tt'] ??
false));
567 $cb->setInfo($this->
lng->txt(
'help_toggle_tooltips_info'));
575 public function internal(): \
ILIAS\Help\InternalService
579 if (is_null(self::$internal_service)) {
580 self::$internal_service = new \ILIAS\Help\InternalService(
584 return self::$internal_service;
static get(string $a_var)
getLinkTargetByClass( $a_class, string $a_cmd=null, string $a_anchor=null, bool $is_async=false, bool $has_xml_style=false)
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...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
ILIAS Help Map MapManager $help_map
string $screen_id_component
Class ChatMainBarProvider .
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)
Interface ilCtrlBaseClassInterface describes ilCtrl base classes.
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)
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.
getLinkTargetsXML()
Get XMl for Link Targets.
addOnLoadCode(string $a_code, int $a_batch=2)
Add on load code.
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
ILIAS Help Presentation PresentationManager $presentation
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
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.