ILIAS  Release_5_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
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
 update ()
 update menu entry
 readEntry ($a_id)
 updateActiveStatus ($a_entries)
 update active status of all menu entries of lm

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:
class.ilLMMenuEditor.php 22144 2009-10-18 11:02:15Z akill

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

Member Function Documentation

ilLMMenuEditor::create ( )

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

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

{
global $ilDB;
$id = $ilDB->nextId("lm_menu");
$q = "INSERT INTO lm_menu (id, lm_id,link_type,title,target,link_ref_id) ".
"VALUES ".
"(".
$ilDB->quote($id, "integer").",".
$ilDB->quote((int) $this->getObjId(), "integer").",".
$ilDB->quote($this->getLinkType(), "text").",".
$ilDB->quote($this->getTitle(), "text").",".
$ilDB->quote($this->getTarget(), "text").",".
$ilDB->quote((int) $this->getLinkRefId(), "integer").")";
$r = $ilDB->manipulate($q);
return true;
}

+ Here is the call graph for this function:

ilLMMenuEditor::delete (   $a_id)

delete menu entry

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

References $ilDB.

{
global $ilDB;
if (!$a_id)
{
return false;
}
$q = "DELETE FROM lm_menu WHERE id = ".
$ilDB->quote($a_id, "integer");
$ilDB->manipulate($q);
return true;
}
ilLMMenuEditor::getEntryId ( )

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

Referenced by update().

{
return $this->entry_id;
}

+ Here is the caller graph for this function:

ilLMMenuEditor::getLinkRefId ( )

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

Referenced by create(), and update().

{
return $this->link_ref_id;
}

+ Here is the caller graph for this function:

ilLMMenuEditor::getLinkType ( )

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

Referenced by create(), and update().

{
return $this->link_type;
}

+ Here is the caller graph for this function:

ilLMMenuEditor::getMenuEntries (   $a_only_active = false)

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

References $ilDB, and $row.

{
global $ilDB;
$entries = array();
if ($a_only_active === true)
{
$and = " AND active = ".$ilDB->quote("y", "text");
}
$q = "SELECT * FROM lm_menu ".
"WHERE lm_id = ".$ilDB->quote($this->lm_id, "integer").
$and;
$r = $ilDB->query($q);
while($row = $ilDB->fetchObject($r))
{
$entries[] = array('id' => $row->id,
'title' => $row->title,
'link' => $row->target,
'type' => $row->link_type,
'ref_id' => $row->link_ref_id,
'active' => $row->active
);
}
return $entries;
}
ilLMMenuEditor::getObjId ( )

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

Referenced by create().

{
return $this->lm_id;
}

+ Here is the caller graph for this function:

ilLMMenuEditor::getTarget ( )

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

Referenced by create(), and update().

{
return $this->target;
}

+ Here is the caller graph for this function:

ilLMMenuEditor::getTitle ( )

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

Referenced by create(), and update().

{
return $this->title;
}

+ Here is the caller graph for this function:

ilLMMenuEditor::ilLMMenuEditor ( )

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

References $ilDB.

{
global $ilDB;
$this->db =& $ilDB;
$this->link_type = "extern";
$this->link_ref_id = null;
}
ilLMMenuEditor::readEntry (   $a_id)

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

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

{
global $ilDB;
if (!$a_id)
{
return false;
}
$q = "SELECT * FROM lm_menu WHERE id = ".
$ilDB->quote($a_id, "integer");
$r = $ilDB->query($q);
$row = $ilDB->fetchObject($r);
$this->setTitle($row->title);
$this->setTarget($row->target);
$this->setLinkType($row->link_type);
$this->setLinkRefId($row->link_ref_id);
$this->setEntryid($a_id);
}

+ Here is the call graph for this function:

ilLMMenuEditor::setEntryId (   $a_id)

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

{
$this->entry_id = $a_id;
}
ilLMMenuEditor::setLinkRefId (   $a_link_ref_id)

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

Referenced by readEntry().

{
$this->link_ref_id = $a_link_ref_id;
}

+ Here is the caller graph for this function:

ilLMMenuEditor::setLinkType (   $a_link_type)

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

Referenced by readEntry().

{
$this->link_type = $a_link_type;
}

+ Here is the caller graph for this function:

ilLMMenuEditor::setObjId (   $a_obj_id)

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

{
$this->lm_id = $a_obj_id;
}
ilLMMenuEditor::setTarget (   $a_target)

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

Referenced by readEntry().

{
$this->target = $a_target;
}

+ Here is the caller graph for this function:

ilLMMenuEditor::setTitle (   $a_title)

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

Referenced by readEntry().

{
$this->title = $a_title;
}

+ Here is the caller graph for this function:

ilLMMenuEditor::update ( )

update menu entry

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

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

{
global $ilDB;
$q = "UPDATE lm_menu SET ".
" link_type = ".$ilDB->quote($this->getLinkType(), "text").",".
" title = ".$ilDB->quote($this->getTitle(), "text").",".
" target = ".$ilDB->quote($this->getTarget(), "text").",".
" link_ref_id = ".$ilDB->quote((int) $this->getLinkRefId(), "integer").
" WHERE id = ".$ilDB->quote($this->getEntryId(), "integer");
$r = $ilDB->manipulate($q);
return true;
}

+ Here is the call graph for this function:

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.

References $ilDB.

{
global $ilDB;
if (!is_array($a_entries))
{
$q = "UPDATE lm_menu SET active = ".$ilDB->quote("n", "text").
" WHERE lm_id = ".$ilDB->quote($this->lm_id, "integer");
}
// update active status
$q = "UPDATE lm_menu SET " .
"active = CASE " .
"WHEN ".$ilDB->in("id", $a_entries, false, "integer")." ".
"THEN ".$ilDB->quote("y", "text")." ".
"ELSE ".$ilDB->quote("n", "text")." ".
"END " .
"WHERE lm_id = ".$ilDB->quote($this->lm_id, "integer");
$ilDB->manipulate($q);
}

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