ILIAS  trunk Revision v12.0_alpha-377-g3641b37b9db
TooltipsManager.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
21namespace ILIAS\Help\Tooltips;
22
25
27{
28 protected \ILIAS\Help\GuidedTour\Admin\AdminManager $gd_admin;
29 protected \ilLanguage $lng;
30 protected \ilObjUser $user;
31 protected \ilSetting $settings;
34
35 public function __construct(
38 ) {
39 $this->repo = $repo->tooltips();
40 $this->domain = $domain;
41 $this->settings = $domain->settings();
42 $this->user = $domain->user();
43 $this->lng = $domain->lng();
44 $this->gd_admin = $domain->guidedTour()->admin();
45 }
46
47 public function isTooltipIdentifierVisible(): bool
48 {
49 return $this->gd_admin->areIdentifiersVisible();
50 }
51
53 string $a_tt_id
54 ): string {
55
56 $show_main_text = true;
57 if ($this->user->getLanguage() !== "de") {
58 $show_main_text = false;
59 }
60
61 if ($this->settings->get("help_mode") === "1") {
62 $show_main_text = false;
63 }
64
65 if ($this->user->getPref("hide_help_tt")) {
66 $show_main_text = false;
67 }
68
69 if (!$show_main_text) {
70 if ($this->isTooltipIdentifierVisible()) {
71 return $a_tt_id;
72 } else {
73 return "";
74 }
75 }
76
77 if ($this->domain->module()->isAuthoringMode()) {
78 $module_ids = [0];
79 } else {
80 $module_ids = $this->domain->module()->getActiveModules();
81 }
82 $text = $this->repo->getTooltipPresentationText(
83 $a_tt_id,
84 $module_ids
85 );
86 if ($this->isTooltipIdentifierVisible()) {
87 $text .= "[" . $a_tt_id . "]";
88 }
89 return $text;
90 }
91
96 string $a_type
97 ): string {
98 return $this->getTooltipPresentationText($a_type . "_create");
99 }
100
104 public function getMainMenuTooltip(
105 string $a_item_id
106 ): string {
107 return $this->getTooltipPresentationText($a_item_id);
108 }
109
110 public function getAllTooltips(
111 string $a_comp = "",
112 int $a_module_id = 0
113 ): array {
114 return $this->repo->getAllTooltips($a_comp, $a_module_id);
115 }
116
117 public function addTooltip(
118 string $a_tt_id,
119 string $a_text,
120 int $a_module_id = 0
121 ): void {
122 $this->repo->addTooltip($a_tt_id, $a_text, $a_module_id);
123 }
124
125 public function updateTooltip(
126 int $a_id,
127 string $a_text,
128 string $a_tt_id
129 ): void {
130 $this->repo->updateTooltip($a_id, $a_text, $a_tt_id);
131 }
132
133
134 public function getTooltipComponents(
135 int $a_module_id = 0
136 ): array {
137 $comps[""] = "- " . $this->lng->txt("help_all") . " -";
138 foreach ($this->repo->getTooltipComponents($a_module_id) as $c) {
139 $comps[$c] = $c;
140 }
141 return $comps;
142 }
143
144 public function deleteTooltip(
145 int $a_id
146 ): void {
147 $this->repo->deleteTooltip($a_id);
148 }
149
150 public function deleteTooltipsOfModule(
151 int $module_id
152 ): void {
153 $this->repo->deleteTooltipsOfModule($module_id);
154 }
155
156}
updateTooltip(int $a_id, string $a_text, string $a_tt_id)
getAllTooltips(string $a_comp="", int $a_module_id=0)
ILIAS Help GuidedTour Admin AdminManager $gd_admin
getObjCreationTooltipText(string $a_type)
Get object_creation tooltip tab text.
addTooltip(string $a_tt_id, string $a_text, int $a_module_id=0)
__construct(InternalRepoService $repo, InternalDomainService $domain)
return true
$c
Definition: deliver.php:25
return['delivery_method'=> 'php',]
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$text
Definition: xapiexit.php:21