Public Member Functions | Private Attributes

ilNavigationHistory Class Reference

Navigation History of Repository Items. More...

Public Member Functions

 __construct ()
 Constructor.
 addItem ($a_ref_id, $a_link, $a_type, $a_title="")
 Add an item to the stack.
 getItems ()
 Get navigation item stack.

Private Attributes

 $items

Detailed Description

Navigation History of Repository Items.

Author:
Alex Killing <alex.killing@gmx.de>
Version:
$Id$

Definition at line 31 of file class.ilNavigationHistory.php.


Constructor & Destructor Documentation

ilNavigationHistory::__construct (  ) 

Constructor.

Parameters:
int $a_id

Definition at line 41 of file class.ilNavigationHistory.php.

References $_SESSION, and $items.

        {
                if (is_string($_SESSION["il_nav_history"]))
                {
                        $items = unserialize($_SESSION["il_nav_history"]);
                }
                if (is_array($items))
                {
                        $this->items = $items;
                }
                else
                {
                        $this->items = array();
                }
        }


Member Function Documentation

ilNavigationHistory::addItem ( a_ref_id,
a_link,
a_type,
a_title = "" 
)

Add an item to the stack.

If ref_id is already used, the item is moved to the top.

Definition at line 61 of file class.ilNavigationHistory.php.

References $_SESSION, $items, ilObject::_exists(), ilObject::_lookupObjId(), and ilObject::_lookupTitle().

        {
                if ($a_title == "" && $a_ref_id > 0)
                {
                        $obj_id = ilObject::_lookupObjId($a_ref_id);
                        if (ilObject::_exists($obj_id))
                        {
                                $a_title = ilObject::_lookupTitle($obj_id);
                        }
                }
                
                // remove ref id from stack, if existing
                foreach($this->items as $key => $item)
                {
                        if ($item["ref_id"] == $a_ref_id)
                        {
                                array_splice($this->items, $key, 1);
                                break;
                        }
                }
                
                $this->items = array_merge(
                        array(array("ref_id" => $a_ref_id, "link" => $a_link, "title" => $a_title,
                        "type" => $a_type)), $this->items);
                
                $items  = serialize($this->items);
                $_SESSION["il_nav_history"] = $items;
        }

Here is the call graph for this function:

ilNavigationHistory::getItems (  ) 

Get navigation item stack.

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

References $items.

        {
                global $tree;
                
                $items = array();
                
                foreach ($this->items as $it)
                {
                        if ($tree->isInTree($it["ref_id"]))
                        {
                                $items[] = $it;
                        }
                }
                
                return $items;
        }


Field Documentation

ilNavigationHistory::$items [private]

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

Referenced by __construct(), addItem(), and getItems().


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