ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
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
56 }

References $lng, and $tree.

Member Function Documentation

◆ displayCut()

ilPathGUI::displayCut ( )

Display a cut with "...".

Returns
bool

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

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

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 127 of file class.ilPathGUI.php.

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

◆ enableHideLeaf()

ilPathGUI::enableHideLeaf (   $a_status)

Hide leaf node in path.

Parameters
type$a_status

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

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

◆ enableTextOnly()

ilPathGUI::enableTextOnly (   $a_status)

render path as text only

Parameters
bool$a_text_onlypath as text only true/false
Returns

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

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

References textOnly().

+ Here is the call graph for this function:

◆ getHTML()

ilPathGUI::getHTML ( )
protected

get html

Returns

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

146 {
147 if($this->textOnly())
148 {
149 $tpl = new ilTemplate('tpl.locator_text_only.html',true,true, "Services/Locator");
150
151 $first = true;
152
153 // Display cut
154 if($this->displayCut() && $this->startnode != ROOT_FOLDER_ID)
155 {
156 $tpl->setCurrentBlock('locator_item');
157 $tpl->setVariable('ITEM',"...");
158 $tpl->parseCurrentBlock();
159
160 $first = false;
161 }
162
163 foreach($this->getPathIds() as $ref_id)
164 {
166 $title = ilObject::_lookupTitle($obj_id);
167
168 if($first)
169 {
170 if($ref_id == ROOT_FOLDER_ID)
171 {
172 $title = $this->lng->txt('repository');
173 }
174 }
175 else
176 {
177 $tpl->touchBlock('locator_separator_prefix');
178 }
179
180 $tpl->setCurrentBlock('locator_item');
181 $tpl->setVariable('ITEM',$title);
182 $tpl->parseCurrentBlock();
183 $first = false;
184 }
185 return $tpl->get();
186 }
187 else
188 {
189 // With images and links
190 include_once './Services/Link/classes/class.ilLink.php';
191
192 $tpl = new ilTemplate('tpl.locator.html',true,true,'Services/Locator');
193
194 $first = true;
195
196 // Display cut
197 if($this->displayCut() && $this->startnode != ROOT_FOLDER_ID)
198 {
199 $tpl->setCurrentBlock('locator_item');
200 $tpl->setVariable('ITEM',"...");
201 $tpl->parseCurrentBlock();
202
203 $first = false;
204 }
205
206 foreach($this->getPathIds() as $ref_id)
207 {
209 $title = ilObject::_lookupTitle($obj_id);
210 $type = ilObject::_lookupType($obj_id);
211
212 if($first)
213 {
214 if($ref_id == ROOT_FOLDER_ID)
215 {
216 $title = $this->lng->txt('repository');
217 }
218 }
219 else
220 {
221 $tpl->touchBlock('locator_separator_prefix');
222 }
223 if($this->getUseImages())
224 {
225 $tpl->setCurrentBlock('locator_img');
226 $tpl->setVariable('IMG_SRC',ilUtil::getTypeIconPath($type,$obj_id));
227 $tpl->setVariable('IMG_ALT',$this->lng->txt('obj_'.$type));
228 $tpl->parseCurrentBlock();
229 }
230 $tpl->setCurrentBlock('locator_item');
231 $tpl->setVariable('LINK_ITEM',ilLink::_getLink($ref_id,$type));
232 $tpl->setVariable('ITEM',$title);
233 $tpl->parseCurrentBlock();
234 $first = false;
235 }
236 return $tpl->get();
237 }
238 }
global $tpl
Definition: ilias.php:8
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...
$ref_id
Definition: sahs_server.php:39

References $ref_id, $tpl, 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 64 of file class.ilPathGUI.php.

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

References getHTML().

+ Here is the call graph for this function:

◆ getPathIds()

ilPathGUI::getPathIds ( )
protected
Parameters

return

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

246 {
247 $path = $this->tree->getPathId($this->endnode,$this->startnode);
248 if($this->hideLeaf())
249 {
250 unset($path[count($path) - 1]);
251 }
252 return $path ? $path : array();
253 }
$path
Definition: index.php:22

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 118 of file class.ilPathGUI.php.

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

References $useImages.

Referenced by getHTML().

+ Here is the caller graph for this function:

◆ hideLeaf()

ilPathGUI::hideLeaf ( )

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

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

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 109 of file class.ilPathGUI.php.

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

◆ textOnly()

ilPathGUI::textOnly ( )

show text only

Returns

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

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

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: