ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
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 \ilLanguage $lng;
29 protected \ilObjUser $user;
30 protected \ilSetting $settings;
33
34 public function __construct(
37 ) {
38 $this->repo = $repo->tooltips();
39 $this->domain = $domain;
40 $this->settings = $domain->settings();
41 $this->user = $domain->user();
42 $this->lng = $domain->lng();
43 }
44
46 string $a_tt_id
47 ): string {
48
49 if ($this->user->getLanguage() !== "de") {
50 return "";
51 }
52
53 if ($this->settings->get("help_mode") === "1") {
54 return "";
55 }
56
57 if ($this->user->getPref("hide_help_tt")) {
58 return "";
59 }
60
61 if ($this->domain->module()->isAuthoringMode()) {
62 $module_ids = [0];
63 } else {
64 $module_ids = $this->domain->module()->getActiveModules();
65 }
66 return $this->repo->getTooltipPresentationText(
67 $a_tt_id,
68 $module_ids
69 );
70 }
71
76 string $a_type
77 ): string {
78 return $this->getTooltipPresentationText($a_type . "_create");
79 }
80
84 public function getMainMenuTooltip(
85 string $a_item_id
86 ): string {
87 return $this->getTooltipPresentationText($a_item_id);
88 }
89
90 public function getAllTooltips(
91 string $a_comp = "",
92 int $a_module_id = 0
93 ): array {
94 return $this->repo->getAllTooltips($a_comp, $a_module_id);
95 }
96
97 public function addTooltip(
98 string $a_tt_id,
99 string $a_text,
100 int $a_module_id = 0
101 ): void {
102 $this->repo->addTooltip($a_tt_id, $a_text, $a_module_id);
103 }
104
105 public function updateTooltip(
106 int $a_id,
107 string $a_text,
108 string $a_tt_id
109 ): void {
110 $this->repo->updateTooltip($a_id, $a_text, $a_tt_id);
111 }
112
113
114 public function getTooltipComponents(
115 int $a_module_id = 0
116 ): array {
117 $comps[""] = "- " . $this->lng->txt("help_all") . " -";
118 foreach ($this->repo->getTooltipComponents($a_module_id) as $c) {
119 $comps[$c] = $c;
120 }
121 return $comps;
122 }
123
124 public function deleteTooltip(
125 int $a_id
126 ): void {
127 $this->repo->deleteTooltip($a_id);
128 }
129
130 public function deleteTooltipsOfModule(
131 int $module_id
132 ): void {
133 $this->repo->deleteTooltipsOfModule($module_id);
134 }
135
136}
updateTooltip(int $a_id, string $a_text, string $a_tt_id)
getAllTooltips(string $a_comp="", int $a_module_id=0)
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...
if(!file_exists('../ilias.ini.php'))
getLanguage()