ILIAS  Release_4_2_x_branch Revision 61807
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilNavigationHistory Class Reference

Navigation History of Repository Items. More...

+ Collaboration diagram for ilNavigationHistory:

Public Member Functions

 __construct ()
 Constructor.
 addItem ($a_ref_id, $a_link, $a_type, $a_title="", $a_sub_obj_id="", $a_goto_link="")
 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..nosp@m.kill.nosp@m.ing@g.nosp@m.mx.d.nosp@m.e
Version
$Id$

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

Constructor & Destructor Documentation

ilNavigationHistory::__construct ( )

Constructor.

Parameters
int$a_id

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

References $_SESSION, and $items.

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

Member Function Documentation

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

Add an item to the stack.

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

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

References $_SESSION, $ilDB, $items, ilObject\_exists(), ilObject\_lookupObjId(), ilObject\_lookupTitle(), and getItems().

{
global $ilUser, $ilDB;
$a_sub_obj_id = $a_sub_obj_id."";
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);
}
}
$id = $a_ref_id.":".$a_sub_obj_id;
$new_items[$id] = array("id" => $id,"ref_id" => $a_ref_id, "link" => $a_link, "title" => $a_title,
"type" => $a_type, "sub_obj_id" => $a_sub_obj_id, "goto_link" => $a_goto_link);
$cnt = 1;
foreach($this->items as $key => $item)
{
if ($item["id"] != $id && $cnt <= 10)
{
$new_items[$item["id"]] = $item;
$cnt++;
}
}
// put items in session
$this->items = $new_items;
$items = serialize($this->items);
$_SESSION["il_nav_history"] = $items;
//var_dump($this->getItems());
// update entries in db
$ilDB->update("usr_data",
array(
"last_visited" => array("clob", serialize($this->getItems()))),
array(
"usr_id" => array("integer", $ilUser->getId()))
);
}

+ Here is the call graph for this function:

ilNavigationHistory::getItems ( )

Get navigation item stack.

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

References $ilDB, $items, $title, ilLink\_getLink(), ilObject\_lookupObjId(), and ilObject\_lookupTitle().

Referenced by addItem().

{
global $tree, $ilDB, $ilUser;
$items = array();
foreach ($this->items as $it)
{
if ($tree->isInTree($it["ref_id"]))
{
$items[$it["ref_id"].":".$it["sub_obj_id"]] = $it;
}
}
// less than 10? -> get items from db
if (count($items) < 10 && $ilUser->getId() != ANONYMOUS_USER_ID)
{
$set = $ilDB->query("SELECT last_visited FROM usr_data ".
" WHERE usr_id = ".$ilDB->quote($ilUser->getId(), "integer")
);
$rec = $ilDB->fetchAssoc($set);
$db_entries = unserialize($rec["last_visited"]);
$cnt = count($items);
if (is_array($db_entries))
{
foreach ($db_entries as $rec)
{
include_once("./classes/class.ilLink.php");
if ($cnt <= 10 && ! isset($items[$rec["ref_id"].":".$rec["sub_obj_id"]]))
{
if ($tree->isInTree($rec["ref_id"]))
{
$link = ($rec["goto_link"] != "")
? $rec["goto_link"]
: ilLink::_getLink($rec["ref_id"]);
if ($rec["sub_obj_id"] != "")
{
$title = $rec["title"];
}
else
{
}
$items[$rec["ref_id"].":".$rec["sub_obj_id"]] = array("id" => $rec["ref_id"].":".$rec["sub_obj_id"],
"ref_id" => $rec["ref_id"], "link" => $link, "title" => $title,
"type" => $rec["type"], "sub_obj_id" => $rec["sub_obj_id"], "goto_link" => $rec["goto_link"]);
$cnt++;
}
}
}
}
}
//var_dump($items);
return $items;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Field Documentation

ilNavigationHistory::$items
private

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

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


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