ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
ILIAS\Help\Map\MapDBRepository Class Reference
+ Collaboration diagram for ILIAS\Help\Map\MapDBRepository:

Public Member Functions

 __construct (\ilDBInterface $db)
 
 saveScreenIdsForChapter (int $a_chap, array $a_ids)
 
 saveMappingEntry (int $a_chap, string $a_comp, string $a_screen_id, string $a_screen_sub_id, string $a_perm, int $a_module_id=0)
 
 removeScreenIdsOfChapter (int $a_chap, int $a_module_id=0)
 
 getScreenIdsOfChapter (int $a_chap, int $a_module_id=0)
 
 getChaptersForScreenId (string $a_screen_id, array $module_ids)
 
 deleteEntriesOfModule (int $a_id)
 

Protected Attributes

ilDBInterface $db
 

Detailed Description

Definition at line 23 of file MapDBRepository.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\Help\Map\MapDBRepository::__construct ( \ilDBInterface  $db)

Definition at line 27 of file MapDBRepository.php.

References ILIAS\Help\Map\MapDBRepository\$db.

29  {
30  $this->db = $db;
31  }

Member Function Documentation

◆ deleteEntriesOfModule()

ILIAS\Help\Map\MapDBRepository::deleteEntriesOfModule ( int  $a_id)

Definition at line 157 of file MapDBRepository.php.

159  : void {
160  $this->db->manipulate("DELETE FROM help_map WHERE " .
161  " module_id = " . $this->db->quote($a_id, "integer"));
162  }

◆ getChaptersForScreenId()

ILIAS\Help\Map\MapDBRepository::getChaptersForScreenId ( string  $a_screen_id,
array  $module_ids 
)

Definition at line 126 of file MapDBRepository.php.

129  : \Generator {
130  $sc_id = explode("/", $a_screen_id);
131  $chaps = array();
132  foreach ($module_ids as $module_id) {
133  if (($sc_id[0] ?? "") != "") {
134  if (($sc_id[1] ?? "") == "") {
135  $sc_id[1] = "-";
136  }
137  if (($sc_id[2] ?? "") == "") {
138  $sc_id[2] = "-";
139  }
140  $set = $this->db->query(
141  "SELECT chap, perm FROM help_map JOIN lm_tree" .
142  " ON (help_map.chap = lm_tree.child) " .
143  " WHERE (component = " . $this->db->quote($sc_id[0], "text") .
144  " OR component = " . $this->db->quote("*", "text") . ")" .
145  " AND screen_id = " . $this->db->quote($sc_id[1], "text") .
146  " AND screen_sub_id = " . $this->db->quote($sc_id[2], "text") .
147  " AND module_id = " . $this->db->quote($module_id, "integer") .
148  " ORDER BY lm_tree.lft"
149  );
150  while ($rec = $this->db->fetchAssoc($set)) {
151  yield $rec;
152  }
153  }
154  }
155  }

◆ getScreenIdsOfChapter()

ILIAS\Help\Map\MapDBRepository::getScreenIdsOfChapter ( int  $a_chap,
int  $a_module_id = 0 
)

Definition at line 99 of file MapDBRepository.php.

References $id.

102  : array {
103  $set = $this->db->query(
104  "SELECT * FROM help_map " .
105  " WHERE chap = " . $this->db->quote($a_chap, "integer") .
106  " AND module_id = " . $this->db->quote($a_module_id, "integer") .
107  " ORDER BY component, screen_id, screen_sub_id"
108  );
109  $screen_ids = array();
110  while ($rec = $this->db->fetchAssoc($set)) {
111  if ($rec["screen_id"] == "-") {
112  $rec["screen_id"] = "";
113  }
114  if ($rec["screen_sub_id"] == "-") {
115  $rec["screen_sub_id"] = "";
116  }
117  $id = $rec["component"] . "/" . $rec["screen_id"] . "/" . $rec["screen_sub_id"];
118  if ($rec["perm"] != "" && $rec["perm"] != "-") {
119  $id .= "#" . $rec["perm"];
120  }
121  $screen_ids[] = $id;
122  }
123  return $screen_ids;
124  }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23

◆ removeScreenIdsOfChapter()

ILIAS\Help\Map\MapDBRepository::removeScreenIdsOfChapter ( int  $a_chap,
int  $a_module_id = 0 
)

Definition at line 88 of file MapDBRepository.php.

Referenced by ILIAS\Help\Map\MapDBRepository\saveScreenIdsForChapter().

91  : void {
92  $this->db->manipulate(
93  "DELETE FROM help_map WHERE " .
94  " chap = " . $this->db->quote($a_chap, "integer") .
95  " AND module_id = " . $this->db->quote($a_module_id, "integer")
96  );
97  }
+ Here is the caller graph for this function:

◆ saveMappingEntry()

ILIAS\Help\Map\MapDBRepository::saveMappingEntry ( int  $a_chap,
string  $a_comp,
string  $a_screen_id,
string  $a_screen_sub_id,
string  $a_perm,
int  $a_module_id = 0 
)

Definition at line 67 of file MapDBRepository.php.

74  : void {
75  $this->db->replace(
76  "help_map",
77  array("chap" => array("integer", $a_chap),
78  "component" => array("text", $a_comp),
79  "screen_id" => array("text", $a_screen_id),
80  "screen_sub_id" => array("text", $a_screen_sub_id),
81  "perm" => array("text", $a_perm),
82  "module_id" => array("integer", $a_module_id)
83  ),
84  array()
85  );
86  }

◆ saveScreenIdsForChapter()

ILIAS\Help\Map\MapDBRepository::saveScreenIdsForChapter ( int  $a_chap,
array  $a_ids 
)

Definition at line 33 of file MapDBRepository.php.

References $id, and ILIAS\Help\Map\MapDBRepository\removeScreenIdsOfChapter().

36  : void {
37  $this->removeScreenIdsOfChapter($a_chap);
38  foreach ($a_ids as $id) {
39  $id = trim($id);
40  $id = explode("/", $id);
41  if ($id[0] != "") {
42  if (($id[1] ?? "") == "") {
43  $id[1] = "-";
44  }
45  $id2 = explode("#", ($id[2] ?? ""));
46  if (($id2[0] ?? "") == "") {
47  $id2[0] = "-";
48  }
49  if (($id2[1] ?? "") == "") {
50  $id2[1] = "-";
51  }
52  $this->db->replace(
53  "help_map",
54  array("chap" => array("integer", $a_chap),
55  "component" => array("text", $id[0]),
56  "screen_id" => array("text", $id[1]),
57  "screen_sub_id" => array("text", $id2[0]),
58  "perm" => array("text", $id2[1]),
59  "module_id" => array("integer", 0)
60  ),
61  array()
62  );
63  }
64  }
65  }
removeScreenIdsOfChapter(int $a_chap, int $a_module_id=0)
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
+ Here is the call graph for this function:

Field Documentation

◆ $db

ilDBInterface ILIAS\Help\Map\MapDBRepository::$db
protected

Definition at line 25 of file MapDBRepository.php.

Referenced by ILIAS\Help\Map\MapDBRepository\__construct().


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