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

Public Member Functions

 __construct (\ilDBInterface $db)
 
 create ()
 
 writeHelpModuleLmId (int $a_id, int $a_lm_id)
 
 saveOrder (array $order)
 
 getHelpModules ()
 
 lookupModuleTitle (int $a_id)
 
 lookupModuleLmId (int $a_id)
 
 deleteModule (int $id)
 
 isHelpLM (int $a_lm_id)
 Check if LM is a help LM. More...
 
 writeActive (int $module_id, bool $active)
 

Protected Attributes

ilDBInterface $db
 

Detailed Description

Definition at line 23 of file ModuleDBRepository.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\Help\Module\ModuleDBRepository::__construct ( \ilDBInterface  $db)

Definition at line 27 of file ModuleDBRepository.php.

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

References ILIAS\Help\Module\ModuleDBRepository\$db.

Member Function Documentation

◆ create()

ILIAS\Help\Module\ModuleDBRepository::create ( )

Definition at line 33 of file ModuleDBRepository.php.

33 : int
34 {
35 $id = $this->db->nextId("help_module");
36
37 $this->db->manipulate("INSERT INTO help_module " .
38 "(id) VALUES (" .
39 $this->db->quote($id, "integer") .
40 ")");
41
42 return $id;
43 }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23

References $id.

◆ deleteModule()

ILIAS\Help\Module\ModuleDBRepository::deleteModule ( int  $id)

Definition at line 114 of file ModuleDBRepository.php.

116 : void {
117 $this->db->manipulate("DELETE FROM help_module WHERE " .
118 " id = " . $this->db->quote($id, "integer"));
119 }

◆ getHelpModules()

ILIAS\Help\Module\ModuleDBRepository::getHelpModules ( )

Definition at line 71 of file ModuleDBRepository.php.

71 : array
72 {
73 $set = $this->db->query("SELECT * FROM help_module ORDER BY order_nr ASC");
74
75 $mods = array();
76 while ($rec = $this->db->fetchAssoc($set)) {
77 if (\ilObject::_lookupType((int) $rec["lm_id"]) === "lm") {
78 $rec["title"] = \ilObject::_lookupTitle((int) $rec["lm_id"]);
79 $rec["create_date"] = \ilObject::_lookupCreationDate((int) $rec["lm_id"]);
80 }
81
82 $mods[] = $rec;
83 }
84
85 return $mods;
86 }
static _lookupType(int $id, bool $reference=false)
static _lookupCreationDate(int $obj_id)
static _lookupTitle(int $obj_id)

References ilObject\_lookupCreationDate(), ilObject\_lookupTitle(), and ilObject\_lookupType().

+ Here is the call graph for this function:

◆ isHelpLM()

ILIAS\Help\Module\ModuleDBRepository::isHelpLM ( int  $a_lm_id)

Check if LM is a help LM.

Definition at line 124 of file ModuleDBRepository.php.

126 : bool {
127 $set = $this->db->query(
128 "SELECT id FROM help_module " .
129 " WHERE lm_id = " . $this->db->quote($a_lm_id, "integer")
130 );
131 if ($rec = $this->db->fetchAssoc($set)) {
132 return true;
133 }
134 return false;
135 }

◆ lookupModuleLmId()

ILIAS\Help\Module\ModuleDBRepository::lookupModuleLmId ( int  $a_id)

Definition at line 103 of file ModuleDBRepository.php.

105 : int {
106 $set = $this->db->query(
107 "SELECT lm_id FROM help_module " .
108 " WHERE id = " . $this->db->quote($a_id, "integer")
109 );
110 $rec = $this->db->fetchAssoc($set);
111 return (int) $rec["lm_id"];
112 }

◆ lookupModuleTitle()

ILIAS\Help\Module\ModuleDBRepository::lookupModuleTitle ( int  $a_id)

Definition at line 88 of file ModuleDBRepository.php.

90 : string {
91
92 $set = $this->db->query(
93 "SELECT * FROM help_module " .
94 " WHERE id = " . $this->db->quote($a_id, "integer")
95 );
96 $rec = $this->db->fetchAssoc($set);
97 if (\ilObject::_lookupType((int) $rec["lm_id"]) === "lm") {
98 return \ilObject::_lookupTitle((int) $rec["lm_id"]);
99 }
100 return "";
101 }

◆ saveOrder()

ILIAS\Help\Module\ModuleDBRepository::saveOrder ( array  $order)

Definition at line 56 of file ModuleDBRepository.php.

56 : void
57 {
58 foreach ($order as $id => $order_nr) {
59 $this->db->update(
60 "help_module",
61 [
62 "order_nr" => ["integer", (int) $order_nr]
63 ],
64 [ // where
65 "id" => ["integer", (int) $id]
66 ]
67 );
68 }
69 }

References $id.

◆ writeActive()

ILIAS\Help\Module\ModuleDBRepository::writeActive ( int  $module_id,
bool  $active 
)

Definition at line 137 of file ModuleDBRepository.php.

137 : void
138 {
139 $this->db->update(
140 "help_module",
141 [
142 "active" => ["integer", (int) $active]
143 ],
144 [ // where
145 "id" => ["integer", $module_id]
146 ]
147 );
148
149 }

◆ writeHelpModuleLmId()

ILIAS\Help\Module\ModuleDBRepository::writeHelpModuleLmId ( int  $a_id,
int  $a_lm_id 
)

Definition at line 45 of file ModuleDBRepository.php.

48 : void {
49 $this->db->manipulate(
50 "UPDATE help_module SET " .
51 " lm_id = " . $this->db->quote($a_lm_id, "integer") .
52 " WHERE id = " . $this->db->quote($a_id, "integer")
53 );
54 }

Field Documentation

◆ $db

ilDBInterface ILIAS\Help\Module\ModuleDBRepository::$db
protected

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