ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
ilLMMenuEditor Class Reference

class for editing lm menu More...

+ Collaboration diagram for ilLMMenuEditor:

Public Member Functions

 __construct ()
 
 setObjId ($a_obj_id)
 
 getObjId ()
 
 setEntryId ($a_id)
 
 getEntryId ()
 
 setLinkType ($a_link_type)
 
 getLinkType ()
 
 setTitle ($a_title)
 
 getTitle ()
 
 setTarget ($a_target)
 
 getTarget ()
 
 setLinkRefId ($a_link_ref_id)
 
 getLinkRefId ()
 
 create ()
 
 getMenuEntries ($a_only_active=false)
 
 delete ($a_id)
 delete menu entry More...
 
 update ()
 update menu entry More...
 
 readEntry ($a_id)
 
 updateActiveStatus ($a_entries)
 update active status of all menu entries of lm More...
 

Static Public Member Functions

static writeActive ($entry_id, $active)
 Write status for entry id. More...
 

Detailed Description

class for editing lm menu

Author
Sascha Hofmann sasch.nosp@m.ahof.nosp@m.mann@.nosp@m.gmx..nosp@m.de
Version
$Id$

Definition at line 32 of file class.ilLMMenuEditor.php.

Constructor & Destructor Documentation

◆ __construct()

ilLMMenuEditor::__construct ( )

Definition at line 34 of file class.ilLMMenuEditor.php.

35 {
36 global $ilDB;
37
38 $this->db = $ilDB;
39 $this->link_type = "extern";
40 $this->link_ref_id = null;
41 }
global $ilDB

References $ilDB.

Member Function Documentation

◆ create()

ilLMMenuEditor::create ( )

Definition at line 103 of file class.ilLMMenuEditor.php.

104 {
105 global $ilDB;
106
107 $id = $ilDB->nextId("lm_menu");
108 $q = "INSERT INTO lm_menu (id, lm_id,link_type,title,target,link_ref_id) ".
109 "VALUES ".
110 "(".
111 $ilDB->quote($id, "integer").",".
112 $ilDB->quote((int) $this->getObjId(), "integer").",".
113 $ilDB->quote($this->getLinkType(), "text").",".
114 $ilDB->quote($this->getTitle(), "text").",".
115 $ilDB->quote($this->getTarget(), "text").",".
116 $ilDB->quote((int) $this->getLinkRefId(), "integer").")";
117 $r = $ilDB->manipulate($q);
118
119 $this->entry_id = $id;
120
121 return true;
122 }
$r
Definition: example_031.php:79

References $ilDB, $r, getLinkRefId(), getLinkType(), getObjId(), getTarget(), and getTitle().

+ Here is the call graph for this function:

◆ delete()

ilLMMenuEditor::delete (   $a_id)

delete menu entry

Definition at line 159 of file class.ilLMMenuEditor.php.

160 {
161 global $ilDB;
162
163 if (!$a_id)
164 {
165 return false;
166 }
167
168 $q = "DELETE FROM lm_menu WHERE id = ".
169 $ilDB->quote($a_id, "integer");
170 $ilDB->manipulate($q);
171
172 return true;
173 }

References $ilDB.

◆ getEntryId()

ilLMMenuEditor::getEntryId ( )

Definition at line 58 of file class.ilLMMenuEditor.php.

59 {
60 return $this->entry_id;
61 }

Referenced by update().

+ Here is the caller graph for this function:

◆ getLinkRefId()

ilLMMenuEditor::getLinkRefId ( )

Definition at line 98 of file class.ilLMMenuEditor.php.

99 {
100 return $this->link_ref_id;
101 }

Referenced by create(), and update().

+ Here is the caller graph for this function:

◆ getLinkType()

ilLMMenuEditor::getLinkType ( )

Definition at line 68 of file class.ilLMMenuEditor.php.

69 {
70 return $this->link_type;
71 }

Referenced by create(), and update().

+ Here is the caller graph for this function:

◆ getMenuEntries()

ilLMMenuEditor::getMenuEntries (   $a_only_active = false)

Definition at line 124 of file class.ilLMMenuEditor.php.

125 {
126 global $ilDB;
127
128 $entries = array();
129
130 if ($a_only_active === true)
131 {
132 $and = " AND active = ".$ilDB->quote("y", "text");
133 }
134
135 $q = "SELECT * FROM lm_menu ".
136 "WHERE lm_id = ".$ilDB->quote($this->lm_id, "integer").
137 $and;
138
139 $r = $ilDB->query($q);
140
141 while($row = $ilDB->fetchObject($r))
142 {
143 $entries[] = array('id' => $row->id,
144 'title' => $row->title,
145 'link' => $row->target,
146 'type' => $row->link_type,
147 'ref_id' => $row->link_ref_id,
148 'active' => $row->active
149 );
150 }
151
152 return $entries;
153 }

References $ilDB, $r, and $row.

◆ getObjId()

ilLMMenuEditor::getObjId ( )

Definition at line 48 of file class.ilLMMenuEditor.php.

49 {
50 return $this->lm_id;
51 }

Referenced by create().

+ Here is the caller graph for this function:

◆ getTarget()

ilLMMenuEditor::getTarget ( )

Definition at line 88 of file class.ilLMMenuEditor.php.

89 {
90 return $this->target;
91 }

References $target.

Referenced by create(), and update().

+ Here is the caller graph for this function:

◆ getTitle()

ilLMMenuEditor::getTitle ( )

Definition at line 78 of file class.ilLMMenuEditor.php.

79 {
80 return $this->title;
81 }

References $title.

Referenced by create(), and update().

+ Here is the caller graph for this function:

◆ readEntry()

ilLMMenuEditor::readEntry (   $a_id)

Definition at line 194 of file class.ilLMMenuEditor.php.

195 {
196 global $ilDB;
197
198 if (!$a_id)
199 {
200 return false;
201 }
202
203 $q = "SELECT * FROM lm_menu WHERE id = ".
204 $ilDB->quote($a_id, "integer");
205 $r = $ilDB->query($q);
206
207 $row = $ilDB->fetchObject($r);
208
209 $this->setTitle($row->title);
210 $this->setTarget($row->target);
211 $this->setLinkType($row->link_type);
212 $this->setLinkRefId($row->link_ref_id);
213 $this->setEntryid($a_id);
214 }
setLinkType($a_link_type)
setLinkRefId($a_link_ref_id)

References $ilDB, $r, $row, setLinkRefId(), setLinkType(), setTarget(), and setTitle().

+ Here is the call graph for this function:

◆ setEntryId()

ilLMMenuEditor::setEntryId (   $a_id)

Definition at line 53 of file class.ilLMMenuEditor.php.

54 {
55 $this->entry_id = $a_id;
56 }

◆ setLinkRefId()

ilLMMenuEditor::setLinkRefId (   $a_link_ref_id)

Definition at line 93 of file class.ilLMMenuEditor.php.

94 {
95 $this->link_ref_id = $a_link_ref_id;
96 }

Referenced by readEntry().

+ Here is the caller graph for this function:

◆ setLinkType()

ilLMMenuEditor::setLinkType (   $a_link_type)

Definition at line 63 of file class.ilLMMenuEditor.php.

64 {
65 $this->link_type = $a_link_type;
66 }

Referenced by readEntry().

+ Here is the caller graph for this function:

◆ setObjId()

ilLMMenuEditor::setObjId (   $a_obj_id)

Definition at line 43 of file class.ilLMMenuEditor.php.

44 {
45 $this->lm_id = $a_obj_id;
46 }

◆ setTarget()

ilLMMenuEditor::setTarget (   $a_target)

Definition at line 83 of file class.ilLMMenuEditor.php.

84 {
85 $this->target = $a_target;
86 }

Referenced by readEntry().

+ Here is the caller graph for this function:

◆ setTitle()

ilLMMenuEditor::setTitle (   $a_title)

Definition at line 73 of file class.ilLMMenuEditor.php.

74 {
75 $this->title = $a_title;
76 }

Referenced by readEntry().

+ Here is the caller graph for this function:

◆ update()

ilLMMenuEditor::update ( )

update menu entry

Definition at line 179 of file class.ilLMMenuEditor.php.

180 {
181 global $ilDB;
182
183 $q = "UPDATE lm_menu SET ".
184 " link_type = ".$ilDB->quote($this->getLinkType(), "text").",".
185 " title = ".$ilDB->quote($this->getTitle(), "text").",".
186 " target = ".$ilDB->quote($this->getTarget(), "text").",".
187 " link_ref_id = ".$ilDB->quote((int) $this->getLinkRefId(), "integer").
188 " WHERE id = ".$ilDB->quote($this->getEntryId(), "integer");
189 $r = $ilDB->manipulate($q);
190
191 return true;
192 }

References $ilDB, $r, getEntryId(), getLinkRefId(), getLinkType(), getTarget(), and getTitle().

+ Here is the call graph for this function:

◆ updateActiveStatus()

ilLMMenuEditor::updateActiveStatus (   $a_entries)

update active status of all menu entries of lm

Parameters
arrayentry ids

Definition at line 221 of file class.ilLMMenuEditor.php.

222 {
223 global $ilDB;
224
225 if (!is_array($a_entries))
226 {
227 $q = "UPDATE lm_menu SET active = ".$ilDB->quote("n", "text").
228 " WHERE lm_id = ".$ilDB->quote($this->lm_id, "integer");
229 }
230
231 // update active status
232 $q = "UPDATE lm_menu SET " .
233 "active = CASE " .
234 "WHEN ".$ilDB->in("id", $a_entries, false, "integer")." ".
235 "THEN ".$ilDB->quote("y", "text")." ".
236 "ELSE ".$ilDB->quote("n", "text")." ".
237 "END " .
238 "WHERE lm_id = ".$ilDB->quote($this->lm_id, "integer");
239
240 $ilDB->manipulate($q);
241 }

References $ilDB.

◆ writeActive()

static ilLMMenuEditor::writeActive (   $entry_id,
  $active 
)
static

Write status for entry id.

Parameters
$entry_id
$active

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

250 {
251 global $DIC;
252
253 $db = $DIC->database();
254
255 $db->update("lm_menu", array(
256 "active" => array("text", ($active ? "y" : "n"))
257 ), array( // where
258 "id" => array("", $entry_id)
259 ));
260
261
262 }
global $DIC

References $DIC.

Referenced by ilObjContentObject\cloneObject().

+ Here is the caller graph for this function:

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