ILIAS  release_8 Revision v8.24
ilHelpMapping Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

+ Collaboration diagram for ilHelpMapping:

Public Member Functions

 __construct ()
 

Static Public Member Functions

static saveScreenIdsForChapter (int $a_chap, array $a_ids)
 
static saveMappingEntry (int $a_chap, string $a_comp, string $a_screen_id, string $a_screen_sub_id, string $a_perm, int $a_module_id=0)
 
static removeScreenIdsOfChapter (int $a_chap, int $a_module_id=0)
 
static getScreenIdsOfChapter (int $a_chap, int $a_module_id=0)
 
static getHelpSectionsForId (string $a_screen_id, int $a_ref_id)
 
static hasScreenIdSections (string $a_screen_id)
 Has given screen Id any sections? Note: We removed the "ref_id" parameter here, since this method should be fast. More...
 
static deleteEntriesOfModule (int $a_id)
 

Protected Attributes

ilDBInterface $db
 

Detailed Description

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning Help mapping

Author
Alexander Killing killi.nosp@m.ng@l.nosp@m.eifos.nosp@m..de

Definition at line 23 of file class.ilHelpMapping.php.

Constructor & Destructor Documentation

◆ __construct()

ilHelpMapping::__construct ( )

Definition at line 27 of file class.ilHelpMapping.php.

28 {
29 global $DIC;
30
31 $this->db = $DIC->database();
32 }
global $DIC
Definition: feed.php:28

References $DIC.

Member Function Documentation

◆ deleteEntriesOfModule()

static ilHelpMapping::deleteEntriesOfModule ( int  $a_id)
static

Definition at line 287 of file class.ilHelpMapping.php.

289 : void {
290 global $DIC;
291
292 $ilDB = $DIC->database();
293
294 $ilDB->manipulate("DELETE FROM help_map WHERE " .
295 " module_id = " . $ilDB->quote($a_id, "integer"));
296 }

◆ getHelpSectionsForId()

static ilHelpMapping::getHelpSectionsForId ( string  $a_screen_id,
int  $a_ref_id 
)
static

Definition at line 143 of file class.ilHelpMapping.php.

146 : array {
147 global $DIC;
148
149 $ilDB = $DIC->database();
150 $ilAccess = $DIC->access();
151 $ilSetting = $DIC->settings();
152 $rbacreview = $DIC->rbac()->review();
153 $ilUser = $DIC->user();
154 $ilObjDataCache = $DIC["ilObjDataCache"];
155
156 if (defined('OH_REF_ID') && (int) OH_REF_ID > 0) {
157 $module = 0;
158 } else {
159 $module = (int) $ilSetting->get("help_module");
160 if ($module === 0) {
161 return array();
162 }
163 }
164
165 $sc_id = explode("/", $a_screen_id);
166 $chaps = array();
167 if ($sc_id[0] != "") {
168 if ($sc_id[1] == "") {
169 $sc_id[1] = "-";
170 }
171 if ($sc_id[2] == "") {
172 $sc_id[2] = "-";
173 }
174 $set = $ilDB->query(
175 "SELECT chap, perm FROM help_map JOIN lm_tree" .
176 " ON (help_map.chap = lm_tree.child) " .
177 " WHERE (component = " . $ilDB->quote($sc_id[0], "text") .
178 " OR component = " . $ilDB->quote("*", "text") . ")" .
179 " AND screen_id = " . $ilDB->quote($sc_id[1], "text") .
180 " AND screen_sub_id = " . $ilDB->quote($sc_id[2], "text") .
181 " AND module_id = " . $ilDB->quote($module, "integer") .
182 " ORDER BY lm_tree.lft"
183 );
184 while ($rec = $ilDB->fetchAssoc($set)) {
185 if ($rec["perm"] != "" && $rec["perm"] != "-") {
186 // check special "create*" permission
187 if ($rec["perm"] === "create*") {
188 $has_create_perm = false;
189
190 // check owner
191 if ($ilUser->getId() === $ilObjDataCache->lookupOwner(ilObject::_lookupObjId($a_ref_id))) {
192 $has_create_perm = true;
193 } elseif ($rbacreview->isAssigned($ilUser->getId(), SYSTEM_ROLE_ID)) { // check admin
194 $has_create_perm = true;
195 } elseif ($ilAccess->checkAccess("read", "", $a_ref_id)) {
196 $perm = $rbacreview->getUserPermissionsOnObject($ilUser->getId(), $a_ref_id);
197 foreach ($perm as $p) {
198 if (strpos($p, "create_") === 0) {
199 $has_create_perm = true;
200 }
201 }
202 }
203 if ($has_create_perm) {
204 $chaps[] = $rec["chap"];
205 }
206 } elseif ($ilAccess->checkAccess($rec["perm"], "", $a_ref_id)) {
207 $chaps[] = $rec["chap"];
208 }
209 } else {
210 $chaps[] = $rec["chap"];
211 }
212 }
213 }
214 return $chaps;
215 }
static _lookupObjId(int $ref_id)
const SYSTEM_ROLE_ID
Definition: constants.php:29
$ilUser
Definition: imgupload.php:34
global $ilSetting
Definition: privfeed.php:17

Referenced by ilHelpGUI\getHelpSections(), and ilHelpGUI\showHelp().

+ Here is the caller graph for this function:

◆ getScreenIdsOfChapter()

static ilHelpMapping::getScreenIdsOfChapter ( int  $a_chap,
int  $a_module_id = 0 
)
static

Definition at line 112 of file class.ilHelpMapping.php.

115 : array {
116 global $DIC;
117
118 $ilDB = $DIC->database();
119
120 $set = $ilDB->query(
121 "SELECT * FROM help_map " .
122 " WHERE chap = " . $ilDB->quote($a_chap, "integer") .
123 " AND module_id = " . $ilDB->quote($a_module_id, "integer") .
124 " ORDER BY component, screen_id, screen_sub_id"
125 );
126 $screen_ids = array();
127 while ($rec = $ilDB->fetchAssoc($set)) {
128 if ($rec["screen_id"] == "-") {
129 $rec["screen_id"] = "";
130 }
131 if ($rec["screen_sub_id"] == "-") {
132 $rec["screen_sub_id"] = "";
133 }
134 $id = $rec["component"] . "/" . $rec["screen_id"] . "/" . $rec["screen_sub_id"];
135 if ($rec["perm"] != "" && $rec["perm"] != "-") {
136 $id .= "#" . $rec["perm"];
137 }
138 $screen_ids[] = $id;
139 }
140 return $screen_ids;
141 }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23

Referenced by ilHelpMappingTableGUI\fillRow().

+ Here is the caller graph for this function:

◆ hasScreenIdSections()

static ilHelpMapping::hasScreenIdSections ( string  $a_screen_id)
static

Has given screen Id any sections? Note: We removed the "ref_id" parameter here, since this method should be fast.

It is used to decide whether the help button should appear or not. We assume that there is at least one section for users with the "read" permission.

Definition at line 224 of file class.ilHelpMapping.php.

226 : bool {
227 global $DIC;
228
229 $ilDB = $DIC->database();
230 $ilSetting = $DIC->settings();
231 $ilUser = $DIC->user();
232
233 if ($ilUser->getLanguage() !== "de") {
234 return false;
235 }
236
237 if ($ilSetting->get("help_mode") === "2") {
238 return false;
239 }
240
241 if (defined('OH_REF_ID') && (int) OH_REF_ID > 0) {
242 $module = 0;
243 } else {
244 $module = (int) $ilSetting->get("help_module");
245 if ($module === 0) {
246 return false;
247 }
248 }
249
250 $sc_id = explode("/", $a_screen_id);
251 if ($sc_id[0] != "") {
252 if ($sc_id[1] == "") {
253 $sc_id[1] = "-";
254 }
255 if ($sc_id[2] == "") {
256 $sc_id[2] = "-";
257 }
258 $set = $ilDB->query(
259 "SELECT chap, perm FROM help_map " .
260 " WHERE (component = " . $ilDB->quote($sc_id[0], "text") .
261 " OR component = " . $ilDB->quote("*", "text") . ")" .
262 " AND screen_id = " . $ilDB->quote($sc_id[1], "text") .
263 " AND screen_sub_id = " . $ilDB->quote($sc_id[2], "text") .
264 " AND module_id = " . $ilDB->quote($module, "integer")
265 );
266 while ($rec = $ilDB->fetchAssoc($set)) {
267 return true;
268
269 // no permission check, since it takes to much performance
270 // getHelpSectionsForId() does the permission checks.
271 /*if ($rec["perm"] != "" && $rec["perm"] != "-")
272 {
273 if ($ilAccess->checkAccess($rec["perm"], "", (int) $a_ref_id))
274 {
275 return true;
276 }
277 }
278 else
279 {
280 return true;
281 }*/
282 }
283 }
284 return false;
285 }

Referenced by ilHelpGUI\hasSections().

+ Here is the caller graph for this function:

◆ removeScreenIdsOfChapter()

static ilHelpMapping::removeScreenIdsOfChapter ( int  $a_chap,
int  $a_module_id = 0 
)
static

Definition at line 97 of file class.ilHelpMapping.php.

100 : void {
101 global $DIC;
102
103 $ilDB = $DIC->database();
104
105 $ilDB->manipulate(
106 "DELETE FROM help_map WHERE " .
107 " chap = " . $ilDB->quote($a_chap, "integer") .
108 " AND module_id = " . $ilDB->quote($a_module_id, "integer")
109 );
110 }

Referenced by ilStructureObject\delete().

+ Here is the caller graph for this function:

◆ saveMappingEntry()

static ilHelpMapping::saveMappingEntry ( int  $a_chap,
string  $a_comp,
string  $a_screen_id,
string  $a_screen_sub_id,
string  $a_perm,
int  $a_module_id = 0 
)
static

Definition at line 72 of file class.ilHelpMapping.php.

79 : void {
80 global $DIC;
81
82 $ilDB = $DIC->database();
83
84 $ilDB->replace(
85 "help_map",
86 array("chap" => array("integer", $a_chap),
87 "component" => array("text", $a_comp),
88 "screen_id" => array("text", $a_screen_id),
89 "screen_sub_id" => array("text", $a_screen_sub_id),
90 "perm" => array("text", $a_perm),
91 "module_id" => array("integer", $a_module_id)
92 ),
93 array()
94 );
95 }

Referenced by ilHelpDataSet\importRecord().

+ Here is the caller graph for this function:

◆ saveScreenIdsForChapter()

static ilHelpMapping::saveScreenIdsForChapter ( int  $a_chap,
array  $a_ids 
)
static

Definition at line 34 of file class.ilHelpMapping.php.

37 : void {
38 global $DIC;
39
40 $ilDB = $DIC->database();
41
43 foreach ($a_ids as $id) {
44 $id = trim($id);
45 $id = explode("/", $id);
46 if ($id[0] != "") {
47 if (($id[1] ?? "") == "") {
48 $id[1] = "-";
49 }
50 $id2 = explode("#", ($id[2] ?? ""));
51 if ($id2[0] == "") {
52 $id2[0] = "-";
53 }
54 if (($id2[1] ?? "") == "") {
55 $id2[1] = "-";
56 }
57 $ilDB->replace(
58 "help_map",
59 array("chap" => array("integer", $a_chap),
60 "component" => array("text", $id[0]),
61 "screen_id" => array("text", $id[1]),
62 "screen_sub_id" => array("text", $id2[0]),
63 "perm" => array("text", $id2[1]),
64 "module_id" => array("integer", 0)
65 ),
66 array()
67 );
68 }
69 }
70 }
static removeScreenIdsOfChapter(int $a_chap, int $a_module_id=0)

Referenced by ilObjContentObjectGUI\saveHelpMapping().

+ Here is the caller graph for this function:

Field Documentation

◆ $db

ilDBInterface ilHelpMapping::$db
protected

Definition at line 25 of file class.ilHelpMapping.php.


The documentation for this class was generated from the following file: