ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilLocatorGUI Class Reference

locator handling class More...

+ Collaboration diagram for ilLocatorGUI:

Public Member Functions

 __construct ()
 Constructor. More...
 
 setTextOnly ($a_textonly)
 Set Only text, no HTML. More...
 
 setOffline ($a_offline)
 
 getOffline ()
 
 getTextOnly ()
 Get Only text, no HTML. More...
 
 addRepositoryItems ($a_ref_id=0)
 add repository item More...
 
 addAdministrationItems ($a_ref_id=0)
 add administration tree items More...
 
 addContextItems ($a_ref_id, $a_omit_node=false, $a_stop=0)
 
 addItem ($a_title, $a_link, $a_frame="", $a_ref_id=0, $type=null)
 add locator item More...
 
 clearItems ()
 Clear all Items. More...
 
 getItems ()
 Get all locator entries. More...
 
 getHTML ()
 Get locator HTML. More...
 
 getTextVersion ()
 Get text version. More...
 

Protected Attributes

 $tree
 
 $ctrl
 
 $obj_definition
 
 $access
 
 $settings
 
 $lng
 
 $entries
 

Detailed Description

locator handling class

This class supplies an implementation for the locator. The locator will send its output to ist own frame, enabling more flexibility in the design of the desktop.

Author
Arjan Ammerlaan a.l.a.nosp@m.mmer.nosp@m.laan@.nosp@m.web..nosp@m.de
Version
$Id$

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

Constructor & Destructor Documentation

◆ __construct()

ilLocatorGUI::__construct ( )

Constructor.

Definition at line 49 of file class.ilLocatorGUI.php.

50 {
51 global $DIC;
52
53 $this->tree = $DIC->repositoryTree();
54 $this->ctrl = $DIC->ctrl();
55 $this->obj_definition = $DIC["objDefinition"];
56 $this->access = $DIC->access();
57 $this->settings = $DIC->settings();
58 $lng = $DIC->language();
59
60 $this->lng = $lng;
61 $this->entries = array();
62 $this->setTextOnly(false);
63 $this->offline = false;
64 }
setTextOnly($a_textonly)
Set Only text, no HTML.
global $DIC
Definition: saml.php:7
settings()
Definition: settings.php:2

References $DIC, $lng, setTextOnly(), and settings().

+ Here is the call graph for this function:

Member Function Documentation

◆ addAdministrationItems()

ilLocatorGUI::addAdministrationItems (   $a_ref_id = 0)

add administration tree items

Parameters
int$a_ref_idcurrent ref id (optional); if empty $_GET["ref_id"] is used

Definition at line 176 of file class.ilLocatorGUI.php.

177 {
180 $objDefinition = $this->obj_definition;
182
183 if ($a_ref_id == 0) {
184 $a_ref_id = $_GET["ref_id"];
185 }
186
187 if ($a_ref_id > 0) {
188 $path = $tree->getPathFull($a_ref_id);
189
190 // add item for each node on path
191 foreach ($path as $key => $row) {
192 if (!in_array($row["type"], array("root", "cat", "crs", "fold", "grp"))) {
193 continue;
194 }
195
196 if ($row["child"] == ROOT_FOLDER_ID) {
197 $row["title"] = $lng->txt("repository");
198 }
199
200 $class_name = $objDefinition->getClassName($row["type"]);
201 $class = strtolower("ilObj" . $class_name . "GUI");
202 $ilCtrl->setParameterByClass($class, "ref_id", $row["child"]);
203 $this->addItem(
204 $row["title"],
205 $ilCtrl->getLinkTargetbyClass($class, "view"),
206 "",
207 $row["child"]
208 );
209 }
210 }
211 }
$path
Definition: aliased.php:25
$_GET["client_id"]
addItem($a_title, $a_link, $a_frame="", $a_ref_id=0, $type=null)
add locator item
$key
Definition: croninfo.php:18
global $ilCtrl
Definition: ilias.php:18
$row

References $_GET, $ctrl, $ilCtrl, $key, $lng, $obj_definition, $path, $row, $tree, and addItem().

+ Here is the call graph for this function:

◆ addContextItems()

ilLocatorGUI::addContextItems (   $a_ref_id,
  $a_omit_node = false,
  $a_stop = 0 
)

Definition at line 213 of file class.ilLocatorGUI.php.

214 {
216
217 if ($a_ref_id > 0) {
218 $path = $tree->getPathFull($a_ref_id);
219
220 // we want to show the full path, from the major container to the item
221 // (folders are not! treated as containers here), at least one parent item
222 $r_path = array_reverse($path);
223 $first = "";
224 $omit = array();
225 $do_omit = false;
226 foreach ($r_path as $key => $row) {
227 if ($first == "") {
228 if (in_array($row["type"], array("root", "cat", "grp", "crs")) &&
229 $row["child"] != $a_ref_id) {
230 $first = $row["child"];
231 }
232 }
233 if ($a_stop == $row["child"]) {
234 $do_omit = true;
235 }
236 $omit[$row["child"]] = $do_omit;
237 }
238
239 $add_it = false;
240 foreach ($path as $key => $row) {
241 if ($first == $row["child"]) {
242 $add_it = true;
243 }
244
245
246 if ($add_it && !$omit[$row["child"]] &&
247 (!$a_omit_node || ($row["child"] != $a_ref_id))) {
248 //echo "-".ilObject::_lookupTitle($row["obj_id"])."-";
249 if ($row["title"] == "ILIAS" && $row["type"] == "root") {
250 $row["title"] = $this->lng->txt("repository");
251 }
252 $this->addItem(
253 $row["title"],
254 "./goto.php?client_id=" . rawurlencode(CLIENT_ID) . "&target=" . $row["type"] . "_" . $row["child"],
255 "_top",
256 $row["child"],
257 $row["type"]
258 );
259 }
260 }
261 }
262 }

References $key, $path, $row, $tree, and addItem().

+ Here is the call graph for this function:

◆ addItem()

ilLocatorGUI::addItem (   $a_title,
  $a_link,
  $a_frame = "",
  $a_ref_id = 0,
  $type = null 
)

add locator item

Parameters
string$a_titleitem title
string$a_linkitem link
string$a_frameframe target

Definition at line 271 of file class.ilLocatorGUI.php.

272 {
273 // LTI
274 global $DIC;
275 $ltiview = $DIC['lti'];
276
277 $ilAccess = $this->access;
278
279 if ($a_ref_id > 0 && !$ilAccess->checkAccess("visible", "", $a_ref_id)) {
280 return;
281 }
282 // LTI
283 if ($ltiview->isActive()) {
284 $a_frame = "_self";
285 }
286 $this->entries[] = array("title" => $a_title,
287 "link" => $a_link, "frame" => $a_frame, "ref_id" => $a_ref_id, "type" => $type);
288 }
$type

References $access, $DIC, and $type.

Referenced by addAdministrationItems(), addContextItems(), and addRepositoryItems().

+ Here is the caller graph for this function:

◆ addRepositoryItems()

ilLocatorGUI::addRepositoryItems (   $a_ref_id = 0)

add repository item

Parameters
int$a_ref_idcurrent ref id (optional); if empty $_GET["ref_id"] is used

Definition at line 102 of file class.ilLocatorGUI.php.

103 {
104 $setting = $this->settings;
107
108 if ($a_ref_id == 0) {
109 $a_ref_id = $_GET["ref_id"];
110 }
111
112 include_once './Services/Container/classes/class.ilMemberViewSettings.php';
113 if (ilMemberViewSettings::getInstance()->isActive() and $a_ref_id != ROOT_FOLDER_ID) {
114 $a_start = ilMemberViewSettings::getInstance()->getContainer();
115 } else {
116 $a_start = ROOT_FOLDER_ID;
117 }
118
119 if ($a_ref_id > 0) {
120 $path = $tree->getPathFull($a_ref_id, $a_start);
121
122 // check if path contains crs
123 $crs_ref_id = 0;
124 foreach ($path as $k => $v) {
125 if ($v["type"] == "crs") {
126 $crs_ref_id = $v["child"];
127 }
128 }
129 if (!$setting->get("rep_breadcr_crs")) { // no overwrite
130 $crs_ref_id = 0;
131 } elseif ($setting->get("rep_breadcr_crs_overwrite")) { // overwrite
132 // course wants full path
134 $crs_ref_id = 0;
135 }
136 // course wants default and default wants full path
137 if (ilContainer::_lookupContainerSetting(ilObject::_lookupObjId($crs_ref_id), "rep_breacrumb") == ilObjCourseGUI::BREADCRUMB_DEFAULT && !$setting->get("rep_breadcr_crs_default")) {
138 $crs_ref_id = 0;
139 }
140 }
141
142 // add item for each node on path
143 foreach ((array) $path as $key => $row) {
144 if (!in_array($row["type"], array("root", "cat", "crs", "fold", "grp", "prg", "lso"))) {
145 continue;
146 }
147 if ($crs_ref_id > 0 && $row["child"] == $crs_ref_id) {
148 $crs_ref_id = 0;
149 }
150 if ($crs_ref_id > 0) {
151 continue;
152 }
153
154 if ($row["title"] == "ILIAS" && $row["type"] == "root") {
155 $row["title"] = $this->lng->txt("repository");
156 }
157
158 $ilCtrl->setParameterByClass("ilrepositorygui", "ref_id", $row["child"]);
159 $this->addItem(
160 $row["title"],
161 $ilCtrl->getLinkTargetByClass("ilrepositorygui", "frameset"),
162 ilFrameTargetInfo::_getFrame("MainContent"),
163 $row["child"]
164 );
165 $ilCtrl->setParameterByClass("ilrepositorygui", "ref_id", $_GET["ref_id"]);
166 }
167 }
168 }
static _lookupContainerSetting($a_id, $a_keyword, $a_default_value=null)
Lookup a container setting.
static _getFrame($a_class, $a_type='')
Get content frame name.
static getInstance()
Get instance.
static _lookupObjId($a_id)

References $_GET, $ctrl, $ilCtrl, $key, $path, $row, $settings, $tree, ilFrameTargetInfo\_getFrame(), ilContainer\_lookupContainerSetting(), ilObject\_lookupObjId(), addItem(), ilObjCourseGUI\BREADCRUMB_DEFAULT, ilObjCourseGUI\BREADCRUMB_FULL_PATH, and ilMemberViewSettings\getInstance().

+ Here is the call graph for this function:

◆ clearItems()

ilLocatorGUI::clearItems ( )

Clear all Items.

Definition at line 293 of file class.ilLocatorGUI.php.

294 {
295 $this->entries = array();
296 }

◆ getHTML()

ilLocatorGUI::getHTML ( )

Get locator HTML.

Definition at line 309 of file class.ilLocatorGUI.php.

310 {
311 global $DIC;
312 $ltiview = $DIC["lti"];
313 if ($ltiview->isActive() && !$ltiview->show_locator) {
314 return "";
315 }
318
319 if ($this->getTextOnly()) {
320 $loc_tpl = new ilTemplate("tpl.locator_text_only.html", true, true, "Services/Locator");
321 } else {
322 $loc_tpl = new ilTemplate("tpl.locator.html", true, true, "Services/Locator");
323 }
324
325 $items = $this->getItems();
326 $first = true;
327
328 if (is_array($items)) {
329 foreach ($items as $item) {
330 if (!$first) {
331 $loc_tpl->touchBlock("locator_separator_prefix");
332 }
333
334 if ($item["ref_id"] > 0) {
335 $obj_id = ilObject::_lookupObjId($item["ref_id"]);
336 $type = ilObject::_lookupType($obj_id);
337
338 if (!$this->getTextOnly()) {
339 $icon_path = ilObject::_getIcon(
340 $obj_id,
341 "tiny",
342 $type,
343 $this->getOffline()
344 );
345 }
346
347 $loc_tpl->setCurrentBlock("locator_img");
348 $loc_tpl->setVariable("IMG_SRC", $icon_path);
349 $loc_tpl->setVariable(
350 "IMG_ALT",
351 $lng->txt("obj_" . $type)
352 );
353 $loc_tpl->parseCurrentBlock();
354 }
355
356 $loc_tpl->setCurrentBlock("locator_item");
357 if ($item["link"] != "") {
358 $loc_tpl->setVariable("LINK_ITEM", $item["link"]);
359 if ($item["frame"] != "") {
360 $loc_tpl->setVariable("LINK_TARGET", ' target="' . $item["frame"] . '" ');
361 }
362 $loc_tpl->setVariable("ITEM", $item["title"]);
363 } else {
364 $loc_tpl->setVariable("PREFIX", $item["title"]);
365 }
366 $loc_tpl->parseCurrentBlock();
367
368 $first = false;
369 }
370 } else {
371 $loc_tpl->setVariable("NOITEM", " ");
372 $loc_tpl->touchBlock("locator");
373 }
374 $loc_tpl->setVariable("TXT_BREADCRUMBS", $lng->txt("breadcrumb_navigation"));
375
376 return trim($loc_tpl->get());
377 }
getTextOnly()
Get Only text, no HTML.
getItems()
Get all locator entries.
static _lookupType($a_id, $a_reference=false)
lookup object type
special template class to simplify handling of ITX/PEAR
global $ilSetting
Definition: privfeed.php:17

References $DIC, $ilSetting, $lng, $settings, $type, ilObject\_lookupObjId(), ilObject\_lookupType(), getItems(), getOffline(), and getTextOnly().

+ Here is the call graph for this function:

◆ getItems()

ilLocatorGUI::getItems ( )

Get all locator entries.

Definition at line 301 of file class.ilLocatorGUI.php.

302 {
303 return $this->entries;
304 }

References $entries.

Referenced by getHTML(), and getTextVersion().

+ Here is the caller graph for this function:

◆ getOffline()

ilLocatorGUI::getOffline ( )

Definition at line 81 of file class.ilLocatorGUI.php.

82 {
83 return $this->offline;
84 }

Referenced by getHTML().

+ Here is the caller graph for this function:

◆ getTextOnly()

ilLocatorGUI::getTextOnly ( )

Get Only text, no HTML.

Returns
boolean Only text, no HTML

Definition at line 91 of file class.ilLocatorGUI.php.

92 {
93 return $this->textonly;
94 }

Referenced by getHTML().

+ Here is the caller graph for this function:

◆ getTextVersion()

ilLocatorGUI::getTextVersion ( )

Get text version.

Definition at line 382 of file class.ilLocatorGUI.php.

383 {
386
387 $items = $this->getItems();
388 $first = true;
389
390 $str = "";
391 if (is_array($items)) {
392 foreach ($items as $item) {
393 if (!$first) {
394 $str .= " > ";
395 }
396
397 $str .= $item["title"];
398
399 $first = false;
400 }
401 }
402
403 return $str;
404 }

References $ilSetting, $lng, $settings, and getItems().

+ Here is the call graph for this function:

◆ setOffline()

ilLocatorGUI::setOffline (   $a_offline)

Definition at line 76 of file class.ilLocatorGUI.php.

77 {
78 $this->offline = $a_offline;
79 }

◆ setTextOnly()

ilLocatorGUI::setTextOnly (   $a_textonly)

Set Only text, no HTML.

Parameters
boolean$a_textonlyOnly text, no HTML

Definition at line 71 of file class.ilLocatorGUI.php.

72 {
73 $this->textonly = $a_textonly;
74 }

Referenced by __construct().

+ Here is the caller graph for this function:

Field Documentation

◆ $access

ilLocatorGUI::$access
protected

Definition at line 35 of file class.ilLocatorGUI.php.

Referenced by addItem().

◆ $ctrl

ilLocatorGUI::$ctrl
protected

Definition at line 25 of file class.ilLocatorGUI.php.

Referenced by addAdministrationItems(), and addRepositoryItems().

◆ $entries

ilLocatorGUI::$entries
protected

Definition at line 43 of file class.ilLocatorGUI.php.

Referenced by getItems().

◆ $lng

ilLocatorGUI::$lng
protected

◆ $obj_definition

ilLocatorGUI::$obj_definition
protected

Definition at line 30 of file class.ilLocatorGUI.php.

Referenced by addAdministrationItems().

◆ $settings

ilLocatorGUI::$settings
protected

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

Referenced by addRepositoryItems(), getHTML(), and getTextVersion().

◆ $tree

ilLocatorGUI::$tree
protected

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