ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
ilLMMenuEditor Class Reference

class for editing lm menu More...

+ Collaboration diagram for ilLMMenuEditor:

Public Member Functions

 ilLMMenuEditor ()
 
 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...
 

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.

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 return true;
120 }
$r
Definition: example_031.php:79
global $ilDB

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 157 of file class.ilLMMenuEditor.php.

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

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 122 of file class.ilLMMenuEditor.php.

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

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 }

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 }

Referenced by create(), and update().

+ Here is the caller graph for this function:

◆ ilLMMenuEditor()

ilLMMenuEditor::ilLMMenuEditor ( )

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 }

References $ilDB.

◆ readEntry()

ilLMMenuEditor::readEntry (   $a_id)

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

193 {
194 global $ilDB;
195
196 if (!$a_id)
197 {
198 return false;
199 }
200
201 $q = "SELECT * FROM lm_menu WHERE id = ".
202 $ilDB->quote($a_id, "integer");
203 $r = $ilDB->query($q);
204
205 $row = $ilDB->fetchObject($r);
206
207 $this->setTitle($row->title);
208 $this->setTarget($row->target);
209 $this->setLinkType($row->link_type);
210 $this->setLinkRefId($row->link_ref_id);
211 $this->setEntryid($a_id);
212 }
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 177 of file class.ilLMMenuEditor.php.

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

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 219 of file class.ilLMMenuEditor.php.

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

References $ilDB.


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