ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ILIAS\Help\Tooltips\TooltipsDBRepository Class Reference
+ Collaboration diagram for ILIAS\Help\Tooltips\TooltipsDBRepository:

Public Member Functions

 __construct (\ilDBInterface $db)
 
 getTooltipPresentationText (string $a_tt_id, array $module_ids)
 
 getAllTooltips (string $a_comp="", int $a_module_id=0)
 
 addTooltip (string $a_tt_id, string $a_text, int $a_module_id=0)
 
 updateTooltip (int $a_id, string $a_text, string $a_tt_id)
 
 getTooltipComponents (int $a_module_id=0)
 Get all tooltip components. More...
 
 deleteTooltip (int $a_id)
 
 deleteTooltipsOfModule (int $a_id)
 

Protected Attributes

ilDBInterface $db
 

Detailed Description

Definition at line 23 of file TooltipsDBRepository.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\Help\Tooltips\TooltipsDBRepository::__construct ( \ilDBInterface  $db)

Definition at line 27 of file TooltipsDBRepository.php.

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

References ILIAS\Help\Tooltips\TooltipsDBRepository\$db.

Member Function Documentation

◆ addTooltip()

ILIAS\Help\Tooltips\TooltipsDBRepository::addTooltip ( string  $a_tt_id,
string  $a_text,
int  $a_module_id = 0 
)

Definition at line 95 of file TooltipsDBRepository.php.

99 : void {
100 $fu = strpos($a_tt_id, "_");
101 $comp = substr($a_tt_id, 0, $fu);
102
103 $nid = $this->db->nextId("help_tooltip");
104 $this->db->manipulate("INSERT INTO help_tooltip " .
105 "(id, tt_text, tt_id, comp,module_id) VALUES (" .
106 $this->db->quote($nid, "integer") . "," .
107 $this->db->quote($a_text, "text") . "," .
108 $this->db->quote($a_tt_id, "text") . "," .
109 $this->db->quote($comp, "text") . "," .
110 $this->db->quote($a_module_id, "integer") .
111 ")");
112 }

◆ deleteTooltip()

ILIAS\Help\Tooltips\TooltipsDBRepository::deleteTooltip ( int  $a_id)

Definition at line 148 of file TooltipsDBRepository.php.

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

◆ deleteTooltipsOfModule()

ILIAS\Help\Tooltips\TooltipsDBRepository::deleteTooltipsOfModule ( int  $a_id)

Definition at line 157 of file TooltipsDBRepository.php.

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

◆ getAllTooltips()

ILIAS\Help\Tooltips\TooltipsDBRepository::getAllTooltips ( string  $a_comp = "",
int  $a_module_id = 0 
)

Definition at line 77 of file TooltipsDBRepository.php.

80 : array {
81 $q = "SELECT * FROM help_tooltip";
82 $q .= " WHERE module_id = " . $this->db->quote($a_module_id, "integer");
83 if ($a_comp !== "") {
84 $q .= " AND comp = " . $this->db->quote($a_comp, "text");
85 }
86 $set = $this->db->query($q);
87 $tts = array();
88 while ($rec = $this->db->fetchAssoc($set)) {
89 $tts[$rec["id"]] = array("id" => $rec["id"], "text" => $rec["tt_text"],
90 "tt_id" => $rec["tt_id"]);
91 }
92 return $tts;
93 }
$q
Definition: shib_logout.php:23

References $q.

◆ getTooltipComponents()

ILIAS\Help\Tooltips\TooltipsDBRepository::getTooltipComponents ( int  $a_module_id = 0)

Get all tooltip components.

Definition at line 135 of file TooltipsDBRepository.php.

137 : array {
138 $set = $this->db->query("SELECT DISTINCT comp FROM help_tooltip " .
139 " WHERE module_id = " . $this->db->quote($a_module_id, "integer") .
140 " ORDER BY comp ");
141 $comps = [];
142 while ($rec = $this->db->fetchAssoc($set)) {
143 $comps[] = $rec["comp"];
144 }
145 return $comps;
146 }

◆ getTooltipPresentationText()

ILIAS\Help\Tooltips\TooltipsDBRepository::getTooltipPresentationText ( string  $a_tt_id,
array  $module_ids 
)

Definition at line 33 of file TooltipsDBRepository.php.

36 : string {
37 $set = $this->db->query(
38 $q =
39 "SELECT tt.tt_text FROM help_tooltip tt LEFT JOIN help_module hmod " .
40 " ON (tt.module_id = hmod.id) " .
41 " WHERE tt.tt_id = " . $this->db->quote($a_tt_id, "text") .
42 " AND " . $this->db->in("tt.module_id", $module_ids, false, "integer") .
43 " ORDER BY hmod.order_nr "
44 );
45 $rec = $this->db->fetchAssoc($set);
46 if (is_array($rec) && $rec["tt_text"] != "") {
47 $t = $rec["tt_text"];
48 if (count($module_ids) === 1 && current($module_ids) === 0) {
49 $t .= "<br/><i>(" . $a_tt_id . ")</i>";
50 }
51 return $t;
52 } else { // try to get general version
53 $fu = (int) strpos($a_tt_id, "_");
54 $gen_tt_id = "*" . substr($a_tt_id, $fu);
55 $set = $this->db->query(
56 "SELECT tt.tt_text FROM help_tooltip tt LEFT JOIN help_module hmod " .
57 " ON (tt.module_id = hmod.id) " .
58 " WHERE tt.tt_id = " . $this->db->quote($gen_tt_id, "text") .
59 " AND " . $this->db->in("tt.module_id", $module_ids, false, "integer") .
60 " ORDER BY hmod.order_nr "
61 );
62 $rec = $this->db->fetchAssoc($set);
63 if (is_array($rec) && $rec["tt_text"] != "") {
64 $t = $rec["tt_text"];
65 if (count($module_ids) === 1 && current($module_ids) === 0) {
66 $t .= "<br/><i>(" . $a_tt_id . ")</i>";
67 }
68 return $t;
69 }
70 }
71 if (count($module_ids) === 1 && current($module_ids) === 0) {
72 return "<i>" . $a_tt_id . "</i>";
73 }
74 return "";
75 }

◆ updateTooltip()

ILIAS\Help\Tooltips\TooltipsDBRepository::updateTooltip ( int  $a_id,
string  $a_text,
string  $a_tt_id 
)

Definition at line 114 of file TooltipsDBRepository.php.

118 : void {
119 $fu = strpos($a_tt_id, "_");
120 $comp = substr($a_tt_id, 0, $fu);
121
122 $this->db->manipulate(
123 "UPDATE help_tooltip SET " .
124 " tt_text = " . $this->db->quote($a_text, "text") . ", " .
125 " tt_id = " . $this->db->quote($a_tt_id, "text") . ", " .
126 " comp = " . $this->db->quote($comp, "text") .
127 " WHERE id = " . $this->db->quote($a_id, "integer")
128 );
129 }

Field Documentation

◆ $db

ilDBInterface ILIAS\Help\Tooltips\TooltipsDBRepository::$db
protected

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