ILIAS  trunk Revision v12.0_alpha-1541-g23eaa5e013d
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
52 public function areTooltipsVisible(): bool
53 {
54 return $this->gd_admin->areIdentifiersVisible() ||
56 }
57
58 public function areSubMenuTooltipsVisible(): bool
59 {
60 return $this->isTooltipMainTextVisible();
61 }
62
63 protected function isTooltipMainTextVisible(): bool
64 {
65 $show_main_text = true;
66 if ($this->user->getLanguage() !== "de") {
67 $show_main_text = false;
68 }
69
70 if ($this->settings->get("help_mode") === "1") {
71 $show_main_text = false;
72 }
73
74 if ($this->user->getPref("hide_help_tt")) {
75 $show_main_text = false;
76 }
77 return $show_main_text;
78 }
79
81 string $a_tt_id
82 ): string {
83
84 $show_main_text = $this->isTooltipMainTextVisible();
85
86 if (!$show_main_text) {
87 if ($this->isTooltipIdentifierVisible()) {
88 return $a_tt_id;
89 } else {
90 return "";
91 }
92 }
93 if ($this->domain->module()->isAuthoringMode()) {
94 $module_ids = [0];
95 } else {
96 $module_ids = $this->domain->module()->getActiveModules();
97 }
98 $text = $this->repo->getTooltipPresentationText(
99 $a_tt_id,
100 $module_ids
101 );
102 if ($this->isTooltipIdentifierVisible()) {
103 $text .= "[" . $a_tt_id . "]";
104 }
105 return $text;
106 }
107
112 string $a_type
113 ): string {
114 return $this->getTooltipPresentationText($a_type . "_create");
115 }
116
120 public function getMainMenuTooltip(
121 string $a_item_id
122 ): string {
123 return $a_item_id;
124 }
125
126 public function getAllTooltips(
127 string $a_comp = "",
128 int $a_module_id = 0
129 ): array {
130 return $this->repo->getAllTooltips($a_comp, $a_module_id);
131 }
132
133 public function addTooltip(
134 string $a_tt_id,
135 string $a_text,
136 int $a_module_id = 0
137 ): void {
138 $this->repo->addTooltip($a_tt_id, $a_text, $a_module_id);
139 }
140
141 public function updateTooltip(
142 int $a_id,
143 string $a_text,
144 string $a_tt_id
145 ): void {
146 $this->repo->updateTooltip($a_id, $a_text, $a_tt_id);
147 }
148
149
150 public function getTooltipComponents(
151 int $a_module_id = 0
152 ): array {
153 $comps[""] = "- " . $this->lng->txt("help_all") . " -";
154 foreach ($this->repo->getTooltipComponents($a_module_id) as $c) {
155 $comps[$c] = $c;
156 }
157 return $comps;
158 }
159
160 public function deleteTooltip(
161 int $a_id
162 ): void {
163 $this->repo->deleteTooltip($a_id);
164 }
165
166 public function deleteTooltipsOfModule(
167 int $module_id
168 ): void {
169 $this->repo->deleteTooltipsOfModule($module_id);
170 }
171
172}
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)
$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