ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
ilHelpMapping Class Reference

Help mapping. More...

+ Collaboration diagram for ilHelpMapping:

Public Member Functions

 saveScreenIdsForChapter ($a_chap, $a_ids)
 Save screen ids for chapter. More...
 
 removeScreenIdsOfChapter ($a_chap, $a_module_id=0)
 Remove screen ids of chapter. More...
 
 getScreenIdsOfChapter ($a_chap, $a_module_id=0)
 Get screen ids of chapter. More...
 
 hasScreenIdSections ($a_screen_id)
 Has given screen Id any sections? More...
 

Static Public Member Functions

static saveMappingEntry ($a_chap, $a_comp, $a_screen_id, $a_screen_sub_id, $a_perm, $a_module_id=0)
 Save mapping entry. More...
 
static getHelpSectionsForId ($a_screen_id, $a_ref_id)
 Get help sections for screen id. More...
 
static deleteEntriesOfModule ($a_id)
 Delete entries of module. More...
 

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.

Member Function Documentation

◆ deleteEntriesOfModule()

static ilHelpMapping::deleteEntriesOfModule (   $a_id)
static

Delete entries of module.

Parameters

return

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

314 {
315 global $ilDB;
316
317 $ilDB->manipulate("DELETE FROM help_map WHERE ".
318 " module_id = ".$ilDB->quote($a_id, "integer"));
319
320 }
global $ilDB

References $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 143 of file class.ilHelpMapping.php.

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

References $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()

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

Get screen ids of chapter.

Parameters

return

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

108 {
109 global $ilDB;
110
111 $set = $ilDB->query("SELECT * FROM help_map ".
112 " WHERE chap = ".$ilDB->quote($a_chap, "integer").
113 " AND module_id = ".$ilDB->quote($a_module_id, "integer").
114 " ORDER BY component, screen_id, screen_sub_id"
115 );
116 $screen_ids = array();
117 while ($rec = $ilDB->fetchAssoc($set))
118 {
119 if ($rec["screen_id"] == "-")
120 {
121 $rec["screen_id"] = "";
122 }
123 if ($rec["screen_sub_id"] == "-")
124 {
125 $rec["screen_sub_id"] = "";
126 }
127 $id = $rec["component"]."/".$rec["screen_id"]."/".$rec["screen_sub_id"];
128 if ($rec["perm"] != "" && $rec["perm"] != "-")
129 {
130 $id.= "#".$rec["perm"];
131 }
132 $screen_ids[] = $id;
133 }
134 return $screen_ids;
135 }

References $ilDB.

Referenced by ilHelpMappingTableGUI\fillRow().

+ Here is the caller graph for this function:

◆ hasScreenIdSections()

ilHelpMapping::hasScreenIdSections (   $a_screen_id)

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 240 of file class.ilHelpMapping.php.

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

References $ilDB, $ilSetting, and $ilUser.

Referenced by ilHelpGUI\hasSections().

+ Here is the caller graph for this function:

◆ removeScreenIdsOfChapter()

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

Remove screen ids of chapter.

Parameters

return

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

92 {
93 global $ilDB;
94
95 $ilDB->manipulate("DELETE FROM help_map WHERE ".
96 " chap = ".$ilDB->quote($a_chap, "integer").
97 " AND module_id = ".$ilDB->quote($a_module_id, "integer")
98 );
99 }

References $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 67 of file class.ilHelpMapping.php.

69 {
70 global $ilDB;
71
72 $ilDB->replace("help_map",
73 array("chap" => array("integer", $a_chap),
74 "component" => array("text", $a_comp),
75 "screen_id" => array("text", $a_screen_id),
76 "screen_sub_id" => array("text", $a_screen_sub_id),
77 "perm" => array("text", $a_perm),
78 "module_id" => array("integer", $a_module_id)
79 ),
80 array()
81 );
82 }

References $ilDB.

Referenced by ilHelpDataSet\importRecord().

+ Here is the caller graph for this function:

◆ saveScreenIdsForChapter()

ilHelpMapping::saveScreenIdsForChapter (   $a_chap,
  $a_ids 
)

Save screen ids for chapter.

Parameters

return

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

21 {
22 global $ilDB;
23
25 if (is_array($a_ids))
26 {
27 foreach ($a_ids as $id)
28 {
29 $id = trim($id);
30 $id = explode("/", $id);
31 if ($id[0] != "")
32 {
33 if ($id[1] == "")
34 {
35 $id[1] = "-";
36 }
37 $id2 = explode("#", $id[2]);
38 if ($id2[0] == "")
39 {
40 $id2[0] = "-";
41 }
42 if ($id2[1] == "")
43 {
44 $id2[1] = "-";
45 }
46 $ilDB->replace("help_map",
47 array("chap" => array("integer", $a_chap),
48 "component" => array("text", $id[0]),
49 "screen_id" => array("text", $id[1]),
50 "screen_sub_id" => array("text", $id2[0]),
51 "perm" => array("text", $id2[1]),
52 "module_id" => array("integer", 0)
53 ),
54 array()
55 );
56 }
57 }
58 }
59 }
removeScreenIdsOfChapter($a_chap, $a_module_id=0)
Remove screen ids of chapter.

References $ilDB, and removeScreenIdsOfChapter().

Referenced by ilObjContentObjectGUI\saveHelpMapping().

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

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