ILIAS  trunk Revision v12.0_alpha-377-g3641b37b9db
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, string $full_id="")
 
 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.

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

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

Member Function Documentation

◆ deleteEntriesOfModule()

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

Definition at line 149 of file MapDBRepository.php.

151 : void {
152 $this->db->manipulate("DELETE FROM help_map WHERE " .
153 " module_id = " . $this->db->quote($a_id, "integer"));
154 }

◆ getChaptersForScreenId()

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

Definition at line 129 of file MapDBRepository.php.

132 : \Generator {
133 $chaps = [];
134 foreach ($module_ids as $module_id) {
135 $set = $this->db->query(
136 $q =
137 "SELECT chap, perm FROM help_map JOIN lm_tree" .
138 " ON (help_map.chap = lm_tree.child) " .
139 " WHERE full_id = " . $this->db->quote($a_screen_id, "text") .
140 " AND module_id = " . $this->db->quote($module_id, "integer") .
141 " ORDER BY lm_tree.lft"
142 );
143 while ($rec = $this->db->fetchAssoc($set)) {
144 yield $rec;
145 }
146 }
147 }
$q
Definition: shib_logout.php:23

References $q.

◆ getScreenIdsOfChapter()

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

Definition at line 108 of file MapDBRepository.php.

111 : array {
112 $set = $this->db->query(
113 "SELECT * FROM help_map " .
114 " WHERE chap = " . $this->db->quote($a_chap, "integer") .
115 " AND module_id = " . $this->db->quote($a_module_id, "integer") .
116 " ORDER BY full_id"
117 );
118 $screen_ids = array();
119 while ($rec = $this->db->fetchAssoc($set)) {
120 $id = $rec["full_id"];
121 if ($rec["perm"] != "" && $rec["perm"] != "-") {
122 $id .= "#" . $rec["perm"];
123 }
124 $screen_ids[] = $id;
125 }
126 return $screen_ids;
127 }
$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 97 of file MapDBRepository.php.

100 : void {
101 $this->db->manipulate(
102 "DELETE FROM help_map WHERE " .
103 " chap = " . $this->db->quote($a_chap, "integer") .
104 " AND module_id = " . $this->db->quote($a_module_id, "integer")
105 );
106 }

◆ 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,
string  $full_id = "" 
)

Definition at line 77 of file MapDBRepository.php.

85 : void {
86 $this->db->insert(
87 "help_map",
88 array("chap" => array("integer", $a_chap),
89 "perm" => array("text", $a_perm),
90 "module_id" => array("integer", $a_module_id),
91 "full_id" => array("text", $full_id)
92 ),
93 array()
94 );
95 }

◆ saveScreenIdsForChapter()

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

Definition at line 33 of file MapDBRepository.php.

36 : void {
37 $this->removeScreenIdsOfChapter($a_chap);
38 foreach ($a_ids as $id) {
39 $full_id = trim($id);
40 $id = trim($id);
41 $id = explode("/", $id);
42 if ($id[0] != "") {
43 if (($id[1] ?? "") == "") {
44 $id[1] = "-";
45 }
46 $pos2 = strpos($full_id, "/", strpos($full_id, "/") + 1);
47 if ($pos2 === false) {
48 $id2 = "";
49 } else {
50 $id2 = substr($full_id, $pos2 + 1);
51 }
52 $id2 = explode("#", ($id2 ?? ""));
53 if (($id2[0] ?? "") == "") {
54 $id2[0] = "-";
55 }
56 if (($id2[1] ?? "") == "") {
57 $id2[1] = "-";
58 }
59 // strip perm from full id
60 $pos = strpos($full_id, "#");
61 if ($pos !== false) {
62 $full_id = substr($full_id, 0, $pos);
63 }
64 $this->db->insert(
65 "help_map",
66 array("chap" => array("integer", $a_chap),
67 "perm" => array("text", $id2[1]),
68 "full_id" => array("text", trim($full_id)),
69 "module_id" => array("integer", 0)
70 ),
71 array()
72 );
73 }
74 }
75 }
removeScreenIdsOfChapter(int $a_chap, int $a_module_id=0)

References $id.

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: