ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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.

References $DIC.

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

Member Function Documentation

◆ deleteEntriesOfModule()

static ilHelpMapping::deleteEntriesOfModule (   $a_id)
static

Delete entries of module.

Parameters

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

References $DIC, and $ilDB.

Referenced by ilObjHelpSettings\deleteModule().

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 $DIC
Definition: saml.php:7
global $ilDB
+ 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

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

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

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

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  }
global $DIC
Definition: saml.php:7
if($modEnd===false) $module
Definition: module.php:59
static _lookupObjId($a_id)
$ilUser
Definition: imgupload.php:18
Create styles array
The data for the language used.
global $ilSetting
Definition: privfeed.php:17
global $ilDB
+ 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

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

References $DIC, $id, $ilDB, and array.

Referenced by ilHelpMappingTableGUI\fillRow().

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  }
global $DIC
Definition: saml.php:7
if(!array_key_exists('StateId', $_REQUEST)) $id
Create styles array
The data for the language used.
global $ilDB
+ 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

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

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

Referenced by ilHelpGUI\hasSections().

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  }
global $DIC
Definition: saml.php:7
if($modEnd===false) $module
Definition: module.php:59
$ilUser
Definition: imgupload.php:18
global $ilSetting
Definition: privfeed.php:17
global $ilDB
+ 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

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

References $DIC, and $ilDB.

Referenced by ilStructureObject\delete().

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  }
global $DIC
Definition: saml.php:7
global $ilDB
+ 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

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

References $DIC, $ilDB, and array.

Referenced by ilHelpDataSet\importRecord().

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  }
global $DIC
Definition: saml.php:7
Create styles array
The data for the language used.
global $ilDB
+ Here is the caller graph for this function:

◆ saveScreenIdsForChapter()

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

Save screen ids for chapter.

Parameters

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

References $DIC, $id, $ilDB, and array.

Referenced by ilObjContentObjectGUI\saveHelpMapping().

37  {
38  global $DIC;
39 
40  $ilDB = $DIC->database();
41 
42  self::removeScreenIdsOfChapter($a_chap);
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  }
global $DIC
Definition: saml.php:7
if(!array_key_exists('StateId', $_REQUEST)) $id
Create styles array
The data for the language used.
global $ilDB
+ 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: