ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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 148 of file class.ilLocatorGUI.php.

149 {
152 $objDefinition = $this->obj_definition;
154
155 if ($a_ref_id == 0) {
156 $a_ref_id = $_GET["ref_id"];
157 }
158
159 if ($a_ref_id > 0) {
160 $path = $tree->getPathFull($a_ref_id);
161
162 // add item for each node on path
163 foreach ($path as $key => $row) {
164 if (!in_array($row["type"], array("root", "cat", "crs", "fold", "grp"))) {
165 continue;
166 }
167
168 if ($row["child"] == ROOT_FOLDER_ID) {
169 $row["title"] = $lng->txt("repository");
170 }
171
172 $class_name = $objDefinition->getClassName($row["type"]);
173 $class = strtolower("ilObj" . $class_name . "GUI");
174 $ilCtrl->setParameterByClass($class, "ref_id", $row["child"]);
175 $this->addItem(
176 $row["title"],
177 $ilCtrl->getLinkTargetbyClass($class, "view"),
178 "",
179 $row["child"]
180 );
181 }
182 }
183 }
$_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

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 185 of file class.ilLocatorGUI.php.

186 {
188
189 if ($a_ref_id > 0) {
190 $path = $tree->getPathFull($a_ref_id);
191
192 // we want to show the full path, from the major container to the item
193 // (folders are not! treated as containers here), at least one parent item
194 $r_path = array_reverse($path);
195 $first = "";
196 $omit = array();
197 $do_omit = false;
198 foreach ($r_path as $key => $row) {
199 if ($first == "") {
200 if (in_array($row["type"], array("root", "cat", "grp", "crs")) &&
201 $row["child"] != $a_ref_id) {
202 $first = $row["child"];
203 }
204 }
205 if ($a_stop == $row["child"]) {
206 $do_omit = true;
207 }
208 $omit[$row["child"]] = $do_omit;
209 }
210
211 $add_it = false;
212 foreach ($path as $key => $row) {
213 if ($first == $row["child"]) {
214 $add_it = true;
215 }
216
217
218 if ($add_it && !$omit[$row["child"]] &&
219 (!$a_omit_node || ($row["child"] != $a_ref_id))) {
220 //echo "-".ilObject::_lookupTitle($row["obj_id"])."-";
221 if ($row["title"] == "ILIAS" && $row["type"] == "root") {
222 $row["title"] = $this->lng->txt("repository");
223 }
224 $this->addItem(
225 $row["title"],
226 "./goto.php?client_id=" . rawurlencode(CLIENT_ID) . "&target=" . $row["type"] . "_" . $row["child"],
227 "_top",
228 $row["child"],
229 $row["type"]
230 );
231 }
232 }
233 }
234 }

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 243 of file class.ilLocatorGUI.php.

244 {
245 // LTI
246 global $DIC;
247 $ltiview = $DIC['lti'];
248
249 $ilAccess = $this->access;
250
251 if ($a_ref_id > 0 && !$ilAccess->checkAccess("visible", "", $a_ref_id)) {
252 return;
253 }
254 // LTI
255 if ($ltiview->isActive()) {
256 $a_frame = "_self";
257 }
258 $this->entries[] = array("title" => $a_title,
259 "link" => $a_link, "frame" => $a_frame, "ref_id" => $a_ref_id, "type" => $type);
260 }
$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 {
106
107 if ($a_ref_id == 0) {
108 $a_ref_id = $_GET["ref_id"];
109 }
110
111 include_once './Services/Container/classes/class.ilMemberViewSettings.php';
112 if (ilMemberViewSettings::getInstance()->isActive() and $a_ref_id != ROOT_FOLDER_ID) {
113 $a_start = ilMemberViewSettings::getInstance()->getContainer();
114 } else {
115 $a_start = ROOT_FOLDER_ID;
116 }
117
118 if ($a_ref_id > 0) {
119 $path = $tree->getPathFull($a_ref_id, $a_start);
120
121 // add item for each node on path
122 foreach ((array) $path as $key => $row) {
123 if (!in_array($row["type"], array("root", "cat","crs", "fold", "grp", "prg"))) {
124 continue;
125 }
126 if ($row["title"] == "ILIAS" && $row["type"] == "root") {
127 $row["title"] = $this->lng->txt("repository");
128 }
129
130 $ilCtrl->setParameterByClass("ilrepositorygui", "ref_id", $row["child"]);
131 $this->addItem(
132 $row["title"],
133 $ilCtrl->getLinkTargetByClass("ilrepositorygui", "frameset"),
134 ilFrameTargetInfo::_getFrame("MainContent"),
135 $row["child"]
136 );
137 $ilCtrl->setParameterByClass("ilrepositorygui", "ref_id", $_GET["ref_id"]);
138 }
139 }
140 }
static _getFrame($a_class, $a_type='')
Get content frame name.
static getInstance()
Get instance.

References $_GET, $ctrl, $ilCtrl, $key, $path, $row, $tree, ilFrameTargetInfo\_getFrame(), addItem(), and ilMemberViewSettings\getInstance().

+ Here is the call graph for this function:

◆ clearItems()

ilLocatorGUI::clearItems ( )

Clear all Items.

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

266 {
267 $this->entries = array();
268 }

◆ getHTML()

ilLocatorGUI::getHTML ( )

Get locator HTML.

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

282 {
283 global $DIC;
284 $ltiview = $DIC["lti"];
285 if ($ltiview->isActive() && !$ltiview->show_locator) {
286 return "";
287 }
290
291 if ($this->getTextOnly()) {
292 $loc_tpl = new ilTemplate("tpl.locator_text_only.html", true, true, "Services/Locator");
293 } else {
294 $loc_tpl = new ilTemplate("tpl.locator.html", true, true, "Services/Locator");
295 }
296
297 $items = $this->getItems();
298 $first = true;
299
300 if (is_array($items)) {
301 foreach ($items as $item) {
302 if (!$first) {
303 $loc_tpl->touchBlock("locator_separator_prefix");
304 }
305
306 if ($item["ref_id"] > 0) {
307 $obj_id = ilObject::_lookupObjId($item["ref_id"]);
308 $type = ilObject::_lookupType($obj_id);
309
310 if (!$this->getTextOnly()) {
311 $icon_path = ilObject::_getIcon(
312 $obj_id,
313 "tiny",
314 $type,
315 $this->getOffline()
316 );
317 }
318
319 $loc_tpl->setCurrentBlock("locator_img");
320 $loc_tpl->setVariable("IMG_SRC", $icon_path);
321 $loc_tpl->setVariable(
322 "IMG_ALT",
323 $lng->txt("obj_" . $type)
324 );
325 $loc_tpl->parseCurrentBlock();
326 }
327
328 $loc_tpl->setCurrentBlock("locator_item");
329 if ($item["link"] != "") {
330 $loc_tpl->setVariable("LINK_ITEM", $item["link"]);
331 if ($item["frame"] != "") {
332 $loc_tpl->setVariable("LINK_TARGET", ' target="' . $item["frame"] . '" ');
333 }
334 $loc_tpl->setVariable("ITEM", $item["title"]);
335 } else {
336 $loc_tpl->setVariable("PREFIX", $item["title"]);
337 }
338 $loc_tpl->parseCurrentBlock();
339
340 $first = false;
341 }
342 } else {
343 $loc_tpl->setVariable("NOITEM", " ");
344 $loc_tpl->touchBlock("locator");
345 }
346 $loc_tpl->setVariable("TXT_BREADCRUMBS", $lng->txt("breadcrumb_navigation"));
347
348 return trim($loc_tpl->get());
349 }
getTextOnly()
Get Only text, no HTML.
getItems()
Get all locator entries.
static _lookupObjId($a_id)
static _getIcon( $a_obj_id="", $a_size="big", $a_type="", $a_offline=false)
Get icon for repository item.
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\_getIcon(), 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 273 of file class.ilLocatorGUI.php.

274 {
275 return $this->entries;
276 }

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 354 of file class.ilLocatorGUI.php.

355 {
358
359 $items = $this->getItems();
360 $first = true;
361
362 $str = "";
363 if (is_array($items)) {
364 foreach ($items as $item) {
365 if (!$first) {
366 $str.= " > ";
367 }
368
369 $str.= $item["title"];
370
371 $first = false;
372 }
373 }
374
375 return $str;
376 }

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 getHTML(), and getTextVersion().

◆ $tree

ilLocatorGUI::$tree
protected

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