ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
ilNavigationHistoryGUI Class Reference

User Interface Class for Navigation History. More...

+ Inheritance diagram for ilNavigationHistoryGUI:
+ Collaboration diagram for ilNavigationHistoryGUI:

Public Member Functions

 __construct ()
 
 executeCommand ()
 
 getHTML ()
 
 handleNavigationRequest ()
 
 removeEntries ()
 

Protected Attributes

StandardGUIRequest $request
 
ilCtrl $ctrl
 
ilNavigationHistory $nav_history
 
ilLanguage $lng
 

Detailed Description

User Interface Class for Navigation History.

Author
Alexander Killing killi.nosp@m.ng@l.nosp@m.eifos.nosp@m..de ilNavigationHistoryGUI:

Definition at line 26 of file class.ilNavigationHistoryGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilNavigationHistoryGUI::__construct ( )

Definition at line 33 of file class.ilNavigationHistoryGUI.php.

References $DIC, ILIAS\Repository\ctrl(), and ILIAS\Repository\lng().

34  {
35  global $DIC;
36 
37  $this->ctrl = $DIC->ctrl();
38  $this->nav_history = $DIC["ilNavigationHistory"];
39  $this->lng = $DIC->language();
40  $this->request = new StandardGUIRequest(
41  $DIC->http(),
42  $DIC->refinery()
43  );
44  }
global $DIC
Definition: feed.php:28
+ Here is the call graph for this function:

Member Function Documentation

◆ executeCommand()

ilNavigationHistoryGUI::executeCommand ( )

Definition at line 46 of file class.ilNavigationHistoryGUI.php.

References $ctrl, and ilCtrl\getNextClass().

46  : void
47  {
48  $ilCtrl = $this->ctrl;
49 
50  $next_class = $ilCtrl->getNextClass();
51  $cmd = $ilCtrl->getCmd();
52 
53  switch ($next_class) {
54  default:
55  $this->$cmd();
56  break;
57  }
58  }
getNextClass($a_gui_class=null)
+ Here is the call graph for this function:

◆ getHTML()

ilNavigationHistoryGUI::getHTML ( )

Definition at line 60 of file class.ilNavigationHistoryGUI.php.

References $lng, $nav_history, ilObject\_getIcon(), ilObject\_lookupObjId(), ilAdvancedSelectionListGUI\NO_ICON, and ilLanguage\txt().

60  : string
61  {
62  $ilNavigationHistory = $this->nav_history;
63  $lng = $this->lng;
64 
65  $selection = new ilAdvancedSelectionListGUI();
66  $selection->setFormSelectMode(
67  "url_ref_id",
68  "ilNavHistorySelect",
69  true,
70  "goto.php?target=navi_request",
71  "ilNavHistory",
72  "ilNavHistoryForm",
73  "_top",
74  $lng->txt("go"),
75  "ilNavHistorySubmit"
76  );
77  $selection->setListTitle($lng->txt("last_visited"));
78  $selection->setId("lastvisited");
79  $selection->setSelectionHeaderClass("MMInactive");
80  $selection->setHeaderIcon(ilAdvancedSelectionListGUI::NO_ICON);
81  $selection->setItemLinkClass("small");
82  $selection->setUseImages(true);
83 
84  $items = $ilNavigationHistory->getItems();
85  //$sel_arr = array(0 => "-- ".$lng->txt("last_visited")." --");
86  reset($items);
87  $cnt = 0;
88  foreach ($items as $k => $item) {
89  if ($cnt++ > 20) {
90  break;
91  }
92  if (!isset($item["ref_id"]) || $this->request->getRefId() === 0 ||
93  $item["ref_id"] != $this->request->getRefId() || $k > 0) { // do not list current item
94  $obj_id = ilObject::_lookupObjId((int) $item["ref_id"]);
95  $selection->addItem(
96  $item["title"],
97  $item["ref_id"],
98  $item["link"],
99  ilObject::_getIcon($obj_id, "tiny", $item["type"]),
100  $lng->txt("obj_" . $item["type"]),
101  "_top"
102  );
103  }
104  }
105  $html = $selection->getHTML();
106 
107  if ($html === "") {
108  $selection->addItem(
109  $lng->txt("no_items"),
110  "",
111  "#",
112  "",
113  "",
114  "_top"
115  );
116  $selection->setUseImages(false);
117  $html = $selection->getHTML();
118  }
119  return $html;
120  }
static _getIcon(int $obj_id=0, string $size="big", string $type="", bool $offline=false)
Get icon for repository item.
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
static _lookupObjId(int $ref_id)
+ Here is the call graph for this function:

◆ handleNavigationRequest()

ilNavigationHistoryGUI::handleNavigationRequest ( )

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

References $ctrl, $nav_history, and ilUtil\redirect().

122  : void
123  {
124  $ilNavigationHistory = $this->nav_history;
125  $ilCtrl = $this->ctrl;
126 
127  if ($this->request->getTarget() === "navi_request") {
128  $items = $ilNavigationHistory->getItems();
129  foreach ($items as $item) {
130  if ($item["ref_id"] == $this->request->getUrlRefId()) {
131  ilUtil::redirect($item["link"]);
132  }
133  }
134  reset($items);
135  $item = current($items);
136  if ($this->request->getUrlRefId() === 0 && $item["ref_id"] == $this->request->getRefId()) {
137  $item = next($items); // omit current item
138  }
139  if ($this->request->getUrlRefId() === 0 && $item["link"] != "") {
140  ilUtil::redirect($item["link"]);
141  }
142 
143  $ilCtrl->setParameterByClass("ilrepositorygui", "ref_id", "");
144  $ilCtrl->setParameterByClass("ilrepositorygui", "getlast", "true");
145  $ilCtrl->redirectByClass("ilrepositorygui", "");
146  }
147  }
static redirect(string $a_script)
+ Here is the call graph for this function:

◆ removeEntries()

ilNavigationHistoryGUI::removeEntries ( )

Definition at line 149 of file class.ilNavigationHistoryGUI.php.

References $nav_history, and ilNavigationHistory\deleteDBEntries().

149  : void
150  {
151  $ilNavigationHistory = $this->nav_history;
152 
153  $ilNavigationHistory->deleteDBEntries();
154  $ilNavigationHistory->deleteSessionEntries();
155  }
+ Here is the call graph for this function:

Field Documentation

◆ $ctrl

ilCtrl ilNavigationHistoryGUI::$ctrl
protected

Definition at line 29 of file class.ilNavigationHistoryGUI.php.

Referenced by executeCommand(), and handleNavigationRequest().

◆ $lng

ilLanguage ilNavigationHistoryGUI::$lng
protected

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

Referenced by getHTML().

◆ $nav_history

ilNavigationHistory ilNavigationHistoryGUI::$nav_history
protected

◆ $request

StandardGUIRequest ilNavigationHistoryGUI::$request
protected

Definition at line 28 of file class.ilNavigationHistoryGUI.php.


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