ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
ilLocatorGUI Class Reference

locator handling class More...

+ Collaboration diagram for ilLocatorGUI:

Public Member Functions

 ilLocatorGUI ()
 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

 $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.

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

121 {
122 global $tree, $ilCtrl, $objDefinition, $lng;
123
124 if ($a_ref_id == 0)
125 {
126 $a_ref_id = $_GET["ref_id"];
127 }
128
129 if ($a_ref_id > 0)
130 {
131 $path = $tree->getPathFull($a_ref_id);
132
133 // add item for each node on path
134 foreach ($path as $key => $row)
135 {
136 if (!in_array($row["type"], array("root", "cat", "crs", "fold", "grp")))
137 {
138 continue;
139 }
140
141 if ($row["child"] == ROOT_FOLDER_ID)
142 {
143 $row["title"] = $lng->txt("repository");
144 }
145
146 $class_name = $objDefinition->getClassName($row["type"]);
147 $class = strtolower("ilObj".$class_name."GUI");
148 $ilCtrl->setParameterByClass($class, "ref_id", $row["child"]);
149 $this->addItem($row["title"],
150 $ilCtrl->getLinkTargetbyClass($class, "view"), "", $row["child"]);
151 }
152 }
153 }
$_GET["client_id"]
addItem($a_title, $a_link, $a_frame="", $a_ref_id=0, $type=null)
add locator item
global $ilCtrl
Definition: ilias.php:18
$path
Definition: index.php:22

References $_GET, $ilCtrl, $lng, $path, $row, 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 155 of file class.ilLocatorGUI.php.

156 {
157 global $tree;
158
159 if ($a_ref_id > 0)
160 {
161 $path = $tree->getPathFull($a_ref_id);
162
163 // we want to show the full path, from the major container to the item
164 // (folders are not! treated as containers here), at least one parent item
165 $r_path = array_reverse($path);
166 $first = "";
167 $omit = array();
168 $do_omit = false;
169 foreach ($r_path as $key => $row)
170 {
171 if ($first == "")
172 {
173 if (in_array($row["type"], array("root", "cat", "grp", "crs")) &&
174 $row["child"] != $a_ref_id)
175 {
176 $first = $row["child"];
177 }
178 }
179 if ($a_stop == $row["child"])
180 {
181 $do_omit = true;
182 }
183 $omit[$row["child"]] = $do_omit;
184 }
185
186 $add_it = false;
187 foreach ($path as $key => $row)
188 {
189 if ($first == $row["child"])
190 {
191 $add_it = true;
192 }
193
194
195 if ($add_it && !$omit[$row["child"]] &&
196 (!$a_omit_node || ($row["child"] != $a_ref_id)))
197 {
198//echo "-".ilObject::_lookupTitle($row["obj_id"])."-";
199 if ($row["title"] == "ILIAS" && $row["type"] == "root")
200 {
201 $row["title"] = $this->lng->txt("repository");
202 }
203 $this->addItem($row["title"],
204 "./goto.php?client_id=".rawurlencode(CLIENT_ID)."&target=".$row["type"]."_".$row["child"],
205 "_top", $row["child"], $row["type"]);
206 }
207 }
208 }
209 }

References $path, $row, 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 218 of file class.ilLocatorGUI.php.

219 {
220 global $ilAccess;
221
222 if ($a_ref_id > 0 && !$ilAccess->checkAccess("visible", "", $a_ref_id))
223 {
224 return;
225 }
226
227 $this->entries[] = array("title" => $a_title,
228 "link" => $a_link, "frame" => $a_frame, "ref_id" => $a_ref_id, "type" => $type);
229 }

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

71 {
72 global $tree, $ilCtrl;
73
74 if ($a_ref_id == 0)
75 {
76 $a_ref_id = $_GET["ref_id"];
77 }
78
79 include_once './Services/Container/classes/class.ilMemberViewSettings.php';
80 if(ilMemberViewSettings::getInstance()->isActive() and $a_ref_id != ROOT_FOLDER_ID)
81 {
82 $a_start = ilMemberViewSettings::getInstance()->getContainer();
83 }
84 else
85 {
86 $a_start = ROOT_FOLDER_ID;
87 }
88
89 if ($a_ref_id > 0)
90 {
91 $path = $tree->getPathFull($a_ref_id,$a_start);
92
93 // add item for each node on path
94 foreach ((array) $path as $key => $row)
95 {
96 if (!in_array($row["type"], array("root", "cat","crs", "fold", "grp", "prg")))
97 {
98 continue;
99 }
100 if ($row["title"] == "ILIAS" && $row["type"] == "root")
101 {
102 $row["title"] = $this->lng->txt("repository");
103 }
104
105 $ilCtrl->setParameterByClass("ilrepositorygui", "ref_id", $row["child"]);
106 $this->addItem($row["title"],
107 $ilCtrl->getLinkTargetByClass("ilrepositorygui", "frameset"),
108 ilFrameTargetInfo::_getFrame("MainContent"), $row["child"]);
109 $ilCtrl->setParameterByClass("ilrepositorygui", "ref_id", $_GET["ref_id"]);
110 }
111 }
112 }
static _getFrame($a_class, $a_type='')
Get content frame name.
static getInstance()
Get instance.

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

+ Here is the call graph for this function:

◆ clearItems()

ilLocatorGUI::clearItems ( )

Clear all Items.

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

235 {
236 $this->entries = array();
237 }

◆ getHTML()

ilLocatorGUI::getHTML ( )

Get locator HTML.

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

251 {
252 global $lng, $ilSetting;
253
254 if ($this->getTextOnly())
255 {
256 $loc_tpl = new ilTemplate("tpl.locator_text_only.html", true, true, "Services/Locator");
257 }
258 else
259 {
260 $loc_tpl = new ilTemplate("tpl.locator.html", true, true, "Services/Locator");
261 }
262
263 $items = $this->getItems();
264 $first = true;
265
266 if (is_array($items))
267 {
268 foreach($items as $item)
269 {
270 if (!$first)
271 {
272 $loc_tpl->touchBlock("locator_separator_prefix");
273 }
274
275 if ($item["ref_id"] > 0)
276 {
277 $obj_id = ilObject::_lookupObjId($item["ref_id"]);
278 $type = ilObject::_lookupType($obj_id);
279
280 if (!$this->getTextOnly())
281 {
282 $icon_path = ilObject::_getIcon($obj_id, "tiny", $type,
283 $this->getOffline());
284 }
285
286 $loc_tpl->setCurrentBlock("locator_img");
287 $loc_tpl->setVariable("IMG_SRC", $icon_path);
288 $loc_tpl->setVariable("IMG_ALT",
289 $lng->txt("obj_".$type));
290 $loc_tpl->parseCurrentBlock();
291 }
292
293 $loc_tpl->setCurrentBlock("locator_item");
294 if ($item["link"] != "")
295 {
296 $loc_tpl->setVariable("LINK_ITEM", $item["link"]);
297 if ($item["frame"] != "")
298 {
299 $loc_tpl->setVariable("LINK_TARGET", ' target="'.$item["frame"].'" ');
300 }
301 $loc_tpl->setVariable("ITEM", $item["title"]);
302 }
303 else
304 {
305 $loc_tpl->setVariable("PREFIX", $item["title"]);
306 }
307 $loc_tpl->parseCurrentBlock();
308
309 $first = false;
310 }
311 }
312 else
313 {
314 $loc_tpl->setVariable("NOITEM", " ");
315 $loc_tpl->touchBlock("locator");
316 }
317 $loc_tpl->setVariable("TXT_BREADCRUMBS", $lng->txt("breadcrumb_navigation"));
318
319 return trim($loc_tpl->get());
320 }
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:40

References $ilSetting, $lng, 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 242 of file class.ilLocatorGUI.php.

243 {
244 return $this->entries;
245 }

References $entries.

Referenced by getHTML(), and getTextVersion().

+ Here is the caller graph for this function:

◆ getOffline()

ilLocatorGUI::getOffline ( )

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

50 {
51 return $this->offline;
52 }

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

60 {
61 return $this->textonly;
62 }

Referenced by getHTML().

+ Here is the caller graph for this function:

◆ getTextVersion()

ilLocatorGUI::getTextVersion ( )

Get text version.

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

326 {
327 global $lng, $ilSetting;
328
329 $items = $this->getItems();
330 $first = true;
331
332 $str = "";
333 if (is_array($items))
334 {
335 foreach($items as $item)
336 {
337 if (!$first)
338 {
339 $str.= " > ";
340 }
341
342 $str.= $item["title"];
343
344 $first = false;
345 }
346 }
347
348 return $str;
349 }

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

+ Here is the call graph for this function:

◆ ilLocatorGUI()

ilLocatorGUI::ilLocatorGUI ( )

Constructor.

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

25 {
26 global $lng;
27
28 $this->lng =& $lng;
29 $this->entries = array();
30 $this->setTextOnly(false);
31 $this->offline = false;
32 }
setTextOnly($a_textonly)
Set Only text, no HTML.

References $lng, and setTextOnly().

+ Here is the call graph for this function:

◆ setOffline()

ilLocatorGUI::setOffline (   $a_offline)

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

45 {
46 $this->offline = $a_offline;
47 }

◆ setTextOnly()

ilLocatorGUI::setTextOnly (   $a_textonly)

Set Only text, no HTML.

Parameters
boolean$a_textonlyOnly text, no HTML

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

40 {
41 $this->textonly = $a_textonly;
42 }

Referenced by ilLocatorGUI().

+ Here is the caller graph for this function:

Field Documentation

◆ $entries

ilLocatorGUI::$entries
protected

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

Referenced by getItems().

◆ $lng

ilLocatorGUI::$lng
protected

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