ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
ilHelpMapping Class Reference

Help mapping. More...

+ Collaboration diagram for ilHelpMapping:

Public Member Functions

 __construct ()
 Constructor. More...
 

Static Public Member Functions

static saveScreenIdsForChapter ($a_chap, $a_ids)
 Save screen ids for chapter. More...
 
static saveMappingEntry ( $a_chap, $a_comp, $a_screen_id, $a_screen_sub_id, $a_perm, $a_module_id=0)
 Save mapping entry. More...
 
static removeScreenIdsOfChapter ($a_chap, $a_module_id=0)
 Remove screen ids of chapter. More...
 
static getScreenIdsOfChapter ($a_chap, $a_module_id=0)
 Get screen ids of chapter. More...
 
static getHelpSectionsForId ($a_screen_id, $a_ref_id)
 Get help sections for screen id. More...
 
static hasScreenIdSections ($a_screen_id)
 Has given screen Id any sections? More...
 
static deleteEntriesOfModule ($a_id)
 Delete entries of module. More...
 

Protected Attributes

 $db
 

Detailed Description

Help mapping.

Author
Alex Killing alex..nosp@m.kill.nosp@m.ing@g.nosp@m.mx.d.nosp@m.e
Version
$Id$

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

Constructor & Destructor Documentation

◆ __construct()

ilHelpMapping::__construct ( )

Constructor.

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

24 {
25 global $DIC;
26
27 $this->db = $DIC->database();
28 }
$DIC
Definition: xapitoken.php:46

References $DIC.

Member Function Documentation

◆ deleteEntriesOfModule()

static ilHelpMapping::deleteEntriesOfModule (   $a_id)
static

Delete entries of module.

Parameters

return

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

319 {
320 global $DIC;
321
322 $ilDB = $DIC->database();
323
324 $ilDB->manipulate("DELETE FROM help_map WHERE " .
325 " module_id = " . $ilDB->quote($a_id, "integer"));
326 }
global $ilDB

References $DIC, and $ilDB.

Referenced by ilObjHelpSettings\deleteModule().

+ Here is the caller graph for this function:

◆ getHelpSectionsForId()

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

Get help sections for screen id.

Parameters

return

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

167 {
168 global $DIC;
169
170 $ilDB = $DIC->database();
171 $ilAccess = $DIC->access();
172 $ilSetting = $DIC->settings();
173 $rbacreview = $DIC->rbac()->review();
174 $ilUser = $DIC->user();
175 $ilObjDataCache = $DIC["ilObjDataCache"];
176
177 if (OH_REF_ID > 0) {
178 $module = 0;
179 } else {
180 $module = (int) $ilSetting->get("help_module");
181 if ($module == 0) {
182 return array();
183 }
184 }
185
186 $sc_id = explode("/", $a_screen_id);
187 $chaps = array();
188 if ($sc_id[0] != "") {
189 if ($sc_id[1] == "") {
190 $sc_id[1] = "-";
191 }
192 if ($sc_id[2] == "") {
193 $sc_id[2] = "-";
194 }
195 $set = $ilDB->query(
196 "SELECT chap, perm FROM help_map JOIN lm_tree" .
197 " ON (help_map.chap = lm_tree.child) " .
198 " WHERE (component = " . $ilDB->quote($sc_id[0], "text") .
199 " OR component = " . $ilDB->quote("*", "text") . ")" .
200 " AND screen_id = " . $ilDB->quote($sc_id[1], "text") .
201 " AND screen_sub_id = " . $ilDB->quote($sc_id[2], "text") .
202 " AND module_id = " . $ilDB->quote($module, "integer") .
203 " ORDER BY lm_tree.lft"
204 );
205 while ($rec = $ilDB->fetchAssoc($set)) {
206 if ($rec["perm"] != "" && $rec["perm"] != "-") {
207 // check special "create*" permission
208 if ($rec["perm"] == "create*") {
209 $has_create_perm = false;
210
211 // check owner
212 if ($ilUser->getId() == $ilObjDataCache->lookupOwner(ilObject::_lookupObjId($a_ref_id))) {
213 $has_create_perm = true;
214 } elseif ($rbacreview->isAssigned($ilUser->getId(), SYSTEM_ROLE_ID)) { // check admin
215 $has_create_perm = true;
216 } elseif ($ilAccess->checkAccess("read", "", (int) $a_ref_id)) {
217 $perm = $rbacreview->getUserPermissionsOnObject($ilUser->getId(), (int) $a_ref_id);
218 foreach ($perm as $p) {
219 if (substr($p, 0, 7) == "create_") {
220 $has_create_perm = true;
221 }
222 }
223 }
224 if ($has_create_perm) {
225 $chaps[] = $rec["chap"];
226 }
227 } elseif ($ilAccess->checkAccess($rec["perm"], "", (int) $a_ref_id)) {
228 $chaps[] = $rec["chap"];
229 }
230 } else {
231 $chaps[] = $rec["chap"];
232 }
233 }
234 }
235 return $chaps;
236 }
static _lookupObjId($a_id)
global $ilSetting
Definition: privfeed.php:17
$ilUser
Definition: imgupload.php:18

References $DIC, $ilDB, $ilSetting, $ilUser, and ilObject\_lookupObjId().

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

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getScreenIdsOfChapter()

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

Get screen ids of chapter.

Parameters

return

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

132 {
133 global $DIC;
134
135 $ilDB = $DIC->database();
136
137 $set = $ilDB->query(
138 "SELECT * FROM help_map " .
139 " WHERE chap = " . $ilDB->quote($a_chap, "integer") .
140 " AND module_id = " . $ilDB->quote($a_module_id, "integer") .
141 " ORDER BY component, screen_id, screen_sub_id"
142 );
143 $screen_ids = array();
144 while ($rec = $ilDB->fetchAssoc($set)) {
145 if ($rec["screen_id"] == "-") {
146 $rec["screen_id"] = "";
147 }
148 if ($rec["screen_sub_id"] == "-") {
149 $rec["screen_sub_id"] = "";
150 }
151 $id = $rec["component"] . "/" . $rec["screen_id"] . "/" . $rec["screen_sub_id"];
152 if ($rec["perm"] != "" && $rec["perm"] != "-") {
153 $id .= "#" . $rec["perm"];
154 }
155 $screen_ids[] = $id;
156 }
157 return $screen_ids;
158 }

References $DIC, and $ilDB.

Referenced by ilHelpMappingTableGUI\fillRow().

+ Here is the caller graph for this function:

◆ hasScreenIdSections()

static ilHelpMapping::hasScreenIdSections (   $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.

Parameters

return

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

250 {
251 global $DIC;
252
253 $ilDB = $DIC->database();
254 $ilAccess = $DIC->access();
255 $ilSetting = $DIC->settings();
256 $ilUser = $DIC->user();
257
258 if ($ilUser->getLanguage() != "de") {
259 return false;
260 }
261
262 if ($ilSetting->get("help_mode") == "2") {
263 return false;
264 }
265
266 if (OH_REF_ID > 0) {
267 $module = 0;
268 } else {
269 $module = (int) $ilSetting->get("help_module");
270 if ($module == 0) {
271 return false;
272 }
273 }
274
275 $sc_id = explode("/", $a_screen_id);
276 if ($sc_id[0] != "") {
277 if ($sc_id[1] == "") {
278 $sc_id[1] = "-";
279 }
280 if ($sc_id[2] == "") {
281 $sc_id[2] = "-";
282 }
283 $set = $ilDB->query(
284 "SELECT chap, perm FROM help_map " .
285 " WHERE (component = " . $ilDB->quote($sc_id[0], "text") .
286 " OR component = " . $ilDB->quote("*", "text") . ")" .
287 " AND screen_id = " . $ilDB->quote($sc_id[1], "text") .
288 " AND screen_sub_id = " . $ilDB->quote($sc_id[2], "text") .
289 " AND module_id = " . $ilDB->quote($module, "integer")
290 );
291 while ($rec = $ilDB->fetchAssoc($set)) {
292 return true;
293
294 // no permission check, since it takes to much performance
295 // getHelpSectionsForId() does the permission checks.
296 /*if ($rec["perm"] != "" && $rec["perm"] != "-")
297 {
298 if ($ilAccess->checkAccess($rec["perm"], "", (int) $a_ref_id))
299 {
300 return true;
301 }
302 }
303 else
304 {
305 return true;
306 }*/
307 }
308 }
309 return false;
310 }

References $DIC, $ilDB, $ilSetting, and $ilUser.

Referenced by ilHelpGUI\hasSections().

+ Here is the caller graph for this function:

◆ removeScreenIdsOfChapter()

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

Remove screen ids of chapter.

Parameters

return

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

113 {
114 global $DIC;
115
116 $ilDB = $DIC->database();
117
118 $ilDB->manipulate(
119 "DELETE FROM help_map WHERE " .
120 " chap = " . $ilDB->quote($a_chap, "integer") .
121 " AND module_id = " . $ilDB->quote($a_module_id, "integer")
122 );
123 }

References $DIC, and $ilDB.

Referenced by ilStructureObject\delete(), and saveScreenIdsForChapter().

+ Here is the caller graph for this function:

◆ saveMappingEntry()

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

Save mapping entry.

Parameters

return

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

87 {
88 global $DIC;
89
90 $ilDB = $DIC->database();
91
92 $ilDB->replace(
93 "help_map",
94 array("chap" => array("integer", $a_chap),
95 "component" => array("text", $a_comp),
96 "screen_id" => array("text", $a_screen_id),
97 "screen_sub_id" => array("text", $a_screen_sub_id),
98 "perm" => array("text", $a_perm),
99 "module_id" => array("integer", $a_module_id)
100 ),
101 array()
102 );
103 }

References $DIC, and $ilDB.

Referenced by ilHelpDataSet\importRecord().

+ Here is the caller graph for this function:

◆ saveScreenIdsForChapter()

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

Save screen ids for chapter.

Parameters

return

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

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

References $DIC, $ilDB, and removeScreenIdsOfChapter().

Referenced by ilObjContentObjectGUI\saveHelpMapping().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $db

ilHelpMapping::$db
protected

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


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