24 $this->items = array();
40 public function addItem($a_ref_id, $a_link, $a_type, $a_title =
"", $a_sub_obj_id =
"",
46 if ($ilUser->prefs[
"store_last_visited"] == 2)
51 $a_sub_obj_id = $a_sub_obj_id.
"";
53 if ($a_title ==
"" && $a_ref_id > 0)
62 $id = $a_ref_id.
":".$a_sub_obj_id;
64 $new_items[$id] = array(
"id" => $id,
"ref_id" => $a_ref_id,
"link" => $a_link,
"title" => $a_title,
65 "type" => $a_type,
"sub_obj_id" => $a_sub_obj_id,
"goto_link" => $a_goto_link);
68 foreach($this->items as $key => $item)
70 if ($item[
"id"] != $id && $cnt <= 10)
72 $new_items[$item[
"id"]] = $item;
78 $this->items = $new_items;
80 $items = serialize($this->items);
86 if ($ilUser->prefs[
"store_last_visited"] == 1)
93 $ilDB->update(
"usr_data",
95 "last_visited" => array(
"clob", serialize($this->
getItems()))),
97 "usr_id" => array(
"integer", $ilUser->getId()))
110 foreach ($this->items as $it)
112 if ($tree->isInTree($it[
"ref_id"]))
114 $items[$it[
"ref_id"].
":".$it[
"sub_obj_id"]] = $it;
118 if (count(
$items) < 10 && $ilUser->getId() != ANONYMOUS_USER_ID)
120 $set = $ilDB->query(
"SELECT last_visited FROM usr_data ".
121 " WHERE usr_id = ".$ilDB->quote($ilUser->getId(),
"integer")
123 $rec = $ilDB->fetchAssoc($set);
124 $db_entries = unserialize($rec[
"last_visited"]);
126 if (is_array($db_entries))
128 foreach ($db_entries as $rec)
130 include_once(
"./Services/Link/classes/class.ilLink.php");
132 if ($cnt <= 10 && ! isset(
$items[$rec[
"ref_id"].
":".$rec[
"sub_obj_id"]]))
134 if ($tree->isInTree($rec[
"ref_id"]))
136 $link = ($rec[
"goto_link"] !=
"")
139 if ($rec[
"sub_obj_id"] !=
"")
147 $items[$rec[
"ref_id"].
":".$rec[
"sub_obj_id"]] = array(
"id" => $rec[
"ref_id"].
":".$rec[
"sub_obj_id"],
148 "ref_id" => $rec[
"ref_id"],
"link" => $link,
"title" =>
$title,
149 "type" => $rec[
"type"],
"sub_obj_id" => $rec[
"sub_obj_id"],
"goto_link" => $rec[
"goto_link"]);
171 $ilDB->update(
"usr_data",
173 "last_visited" => array(
"clob", serialize(array()))),
175 "usr_id" => array(
"integer", $ilUser->getId()))
187 $_SESSION[
"il_nav_history"] = serialize(array());