Public Member Functions

ilLMMenuEditor Class Reference
[Modules/IliasLearningModule]

class for editing lm menu More...

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 <saschahofmann@gmx.de>
Version:
Id:
class.ilLMMenuEditor.php 13025 2007-01-17 13:36:54Z 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 $q, getLinkRefId(), getLinkType(), getObjId(), getTarget(), and getTitle().

        {
                $q = "INSERT INTO lm_menu (lm_id,link_type,title,target,link_ref_id) ".
                         "VALUES ".
                         "(".
                         $this->db->quote($this->getObjId()).",".
                         $this->db->quote($this->getLinkType()).",".
                         $this->db->quote($this->getTitle()).",".
                         $this->db->quote($this->getTarget()).",".
                         $this->db->quote($this->getLinkRefId()).")";
                $r = $this->db->query($q);
                
                return true;
        }

Here is the call graph for this function:

ilLMMenuEditor::delete ( a_id  ) 

delete menu entry

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

References $q.

        {
                if (!$a_id)
                {
                        return false;
                }
                
                $q = "DELETE FROM lm_menu WHERE id = ".$this->db->quote($a_id);
                $this->db->query($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 118 of file class.ilLMMenuEditor.php.

References $entries, $q, and $row.

        {
                global $ilDB;
                
                $entries = array();
                
                if ($a_only_active === true)
                {
                        $and = " AND active = 'y'";
                }
                
                $q = "SELECT * FROM lm_menu ".
                         "WHERE lm_id = ".$ilDB->quote($this->lm_id).
                         $and;
                         
                $r = $this->db->query($q);

                while($row = $r->fetchRow(DB_FETCHMODE_OBJECT))
                {
                        $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.

        {
                global $ilDB;

                $this->db =& $ilDB;
                $this->link_type = "extern";
                $this->link_ref_id = null;
        }

ilLMMenuEditor::readEntry ( a_id  ) 

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

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

        {
                if (!$a_id)
                {
                        return false;
                }
                
                $q = "SELECT * FROM lm_menu WHERE id = ".$this->db->quote($a_id);
                $r = $this->db->query($q);

                $row = $this->db->getRow($q,DB_FETCHMODE_OBJECT);
                
                $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 170 of file class.ilLMMenuEditor.php.

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

        {
                global $ilDB;
                
                $q = "UPDATE lm_menu SET ".
                        " link_type = ".$ilDB->quote($this->getLinkType()).",".
                        " title = ".$ilDB->quote($this->getTitle()).",".
                        " target = ".$ilDB->quote($this->getTarget()).",".
                        " link_ref_id = ".$ilDB->quote($this->getLinkRefId()).
                        " WHERE id = ".$ilDB->quote($this->getEntryId());
                $r = $this->db->query($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:
array entry ids

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

References $q.

        {
                if (!is_array($a_entries))
                {
                        return false;
                }
                
                // update active status
                $q = "UPDATE lm_menu SET " .
                         "active = CASE " .
                         "WHEN id IN (".implode(',',$a_entries).") " .
                         "THEN 'y' ".
                         "ELSE 'n' ".
                         "END " .
                         "WHERE lm_id = ".$this->lm_id;
                $this->db->query($q);
        }


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