ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ilPathGUI Class Reference

Creates a path for a start and endnode. More...

+ Collaboration diagram for ilPathGUI:

Public Member Functions

 __construct ()
 Constructor. More...
 
 getPath ($a_startnode, $a_endnode)
 get path More...
 
 enableTextOnly ($a_status)
 render path as text only More...
 
 textOnly ()
 show text only More...
 
 enableHideLeaf ($a_status)
 Hide leaf node in path. More...
 
 hideLeaf ()
 
 setUseImages ($a_status)
 set use images More...
 
 getUseImages ()
 get use images More...
 
 enableDisplayCut ($a_status)
 Display a cut with "...". More...
 
 displayCut ()
 Display a cut with "...". More...
 

Protected Member Functions

 getHTML ()
 get html More...
 
 getPathIds ()
 

Protected Attributes

 $lng = null
 
 $tree = null
 

Private Attributes

 $startnode = ROOT_FOLDER_ID
 
 $endnode = ROOT_FOLDER_ID
 
 $textOnly = true
 
 $useImages = false
 
 $hide_leaf = true
 
 $display_cut = false
 

Detailed Description

Creates a path for a start and endnode.

Author
Stefan Meyer meyer.nosp@m.@lei.nosp@m.fos.c.nosp@m.om
Version
$Id$

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

Constructor & Destructor Documentation

◆ __construct()

ilPathGUI::__construct ( )

Constructor.

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

50 {
51 global $tree,$lng;
52
53 $this->tree = $tree;
54 $this->lng = $lng;
55 }

References $lng, and $tree.

Member Function Documentation

◆ displayCut()

ilPathGUI::displayCut ( )

Display a cut with "...".

Returns
bool

Definition at line 135 of file class.ilPathGUI.php.

136 {
137 return $this->display_cut;
138 }

References $display_cut.

Referenced by getHTML().

+ Here is the caller graph for this function:

◆ enableDisplayCut()

ilPathGUI::enableDisplayCut (   $a_status)

Display a cut with "...".

Parameters
$a_statusbool

Definition at line 126 of file class.ilPathGUI.php.

127 {
128 $this->display_cut = $a_status;
129 }

◆ enableHideLeaf()

ilPathGUI::enableHideLeaf (   $a_status)

Hide leaf node in path.

Parameters
type$a_status

Definition at line 94 of file class.ilPathGUI.php.

95 {
96 $this->hide_leaf = $a_status;
97 }

◆ enableTextOnly()

ilPathGUI::enableTextOnly (   $a_status)

render path as text only

Parameters
bool$a_text_onlypath as text only true/false
Returns

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

77 {
78 $this->textOnly = $a_status;
79 }
textOnly()
show text only

References textOnly().

+ Here is the call graph for this function:

◆ getHTML()

ilPathGUI::getHTML ( )
protected

get html

Returns

Definition at line 144 of file class.ilPathGUI.php.

145 {
146 if ($this->textOnly()) {
147 $tpl = new ilTemplate('tpl.locator_text_only.html', true, true, "Services/Locator");
148
149 $first = true;
150
151 // Display cut
152 if ($this->displayCut() && $this->startnode != ROOT_FOLDER_ID) {
153 $tpl->setCurrentBlock('locator_item');
154 $tpl->setVariable('ITEM', "...");
155 $tpl->parseCurrentBlock();
156
157 $first = false;
158 }
159
160 foreach ($this->getPathIds() as $ref_id) {
161 $obj_id = ilObject::_lookupObjId($ref_id);
163
164 if ($first) {
165 if ($ref_id == ROOT_FOLDER_ID) {
166 $title = $this->lng->txt('repository');
167 }
168 } else {
169 $tpl->touchBlock('locator_separator_prefix');
170 }
171
172 $tpl->setCurrentBlock('locator_item');
173 $tpl->setVariable('ITEM', $title);
174 $tpl->parseCurrentBlock();
175 $first = false;
176 }
177 return $tpl->get();
178 } else {
179 // With images and links
180 include_once './Services/Link/classes/class.ilLink.php';
181
182 $tpl = new ilTemplate('tpl.locator.html', true, true, 'Services/Locator');
183
184 $first = true;
185
186 // Display cut
187 if ($this->displayCut() && $this->startnode != ROOT_FOLDER_ID) {
188 $tpl->setCurrentBlock('locator_item');
189 $tpl->setVariable('ITEM', "...");
190 $tpl->parseCurrentBlock();
191
192 $first = false;
193 }
194
195 foreach ($this->getPathIds() as $ref_id) {
196 $obj_id = ilObject::_lookupObjId($ref_id);
198 $type = ilObject::_lookupType($obj_id);
199
200 if ($first) {
201 if ($ref_id == ROOT_FOLDER_ID) {
202 $title = $this->lng->txt('repository');
203 }
204 } else {
205 $tpl->touchBlock('locator_separator_prefix');
206 }
207 if ($this->getUseImages()) {
208 $tpl->setCurrentBlock('locator_img');
209 $tpl->setVariable('IMG_SRC', ilUtil::getTypeIconPath($type, $obj_id));
210 $tpl->setVariable('IMG_ALT', $this->lng->txt('obj_' . $type));
211 $tpl->parseCurrentBlock();
212 }
213 $tpl->setCurrentBlock('locator_item');
214 $tpl->setVariable('LINK_ITEM', ilLink::_getLink($ref_id, $type));
215 $tpl->setVariable('ITEM', $title);
216 $tpl->parseCurrentBlock();
217 $first = false;
218 }
219 return $tpl->get();
220 }
221 }
$tpl
Definition: ilias.php:10
static _lookupObjId($a_id)
static _lookupTitle($a_id)
lookup object title
static _lookupType($a_id, $a_reference=false)
lookup object type
getUseImages()
get use images
displayCut()
Display a cut with "...".
special template class to simplify handling of ITX/PEAR
static getTypeIconPath($a_type, $a_obj_id, $a_size='small')
Get type icon path path Return image path for icon_xxx.pngs Or (if enabled) path to custom icon Depre...
$type

References $title, $tpl, $type, ilLink\_getLink(), ilObject\_lookupObjId(), ilObject\_lookupTitle(), ilObject\_lookupType(), displayCut(), getPathIds(), ilUtil\getTypeIconPath(), getUseImages(), and textOnly().

Referenced by getPath().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getPath()

ilPathGUI::getPath (   $a_startnode,
  $a_endnode 
)

get path

Parameters
int$a_startnoderef_id of startnode
int$a_endnoderef_id of endnode
Returns
string html

Definition at line 63 of file class.ilPathGUI.php.

64 {
65 $this->startnode = $a_startnode;
66 $this->endnode = $a_endnode;
67
68 return $this->getHTML();
69 }
getHTML()
get html

References getHTML().

+ Here is the call graph for this function:

◆ getPathIds()

ilPathGUI::getPathIds ( )
protected
Parameters

return

Definition at line 228 of file class.ilPathGUI.php.

229 {
230 $path = $this->tree->getPathId($this->endnode, $this->startnode);
231 if ($this->hideLeaf()) {
232 unset($path[count($path) - 1]);
233 }
234 return $path ? $path : array();
235 }

References $path, and hideLeaf().

Referenced by getHTML().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getUseImages()

ilPathGUI::getUseImages ( )

get use images

Returns

Definition at line 117 of file class.ilPathGUI.php.

118 {
119 return $this->useImages;
120 }

References $useImages.

Referenced by getHTML().

+ Here is the caller graph for this function:

◆ hideLeaf()

ilPathGUI::hideLeaf ( )

Definition at line 99 of file class.ilPathGUI.php.

100 {
101 return $this->hide_leaf;
102 }

References $hide_leaf.

Referenced by getPathIds().

+ Here is the caller graph for this function:

◆ setUseImages()

ilPathGUI::setUseImages (   $a_status)

set use images

Parameters
bool
Returns

Definition at line 108 of file class.ilPathGUI.php.

109 {
110 $this->useImages = $a_status;
111 }

◆ textOnly()

ilPathGUI::textOnly ( )

show text only

Returns

Definition at line 85 of file class.ilPathGUI.php.

86 {
87 return $this->textOnly;
88 }

References $textOnly.

Referenced by enableTextOnly(), and getHTML().

+ Here is the caller graph for this function:

Field Documentation

◆ $display_cut

ilPathGUI::$display_cut = false
private

Definition at line 41 of file class.ilPathGUI.php.

Referenced by displayCut().

◆ $endnode

ilPathGUI::$endnode = ROOT_FOLDER_ID
private

Definition at line 36 of file class.ilPathGUI.php.

◆ $hide_leaf

ilPathGUI::$hide_leaf = true
private

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

Referenced by hideLeaf().

◆ $lng

ilPathGUI::$lng = null
protected

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

Referenced by __construct().

◆ $startnode

ilPathGUI::$startnode = ROOT_FOLDER_ID
private

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

◆ $textOnly

ilPathGUI::$textOnly = true
private

Definition at line 38 of file class.ilPathGUI.php.

Referenced by textOnly().

◆ $tree

ilPathGUI::$tree = null
protected

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

Referenced by __construct().

◆ $useImages

ilPathGUI::$useImages = false
private

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

Referenced by getUseImages().


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