ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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.

References $lng, and $tree.

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

Member Function Documentation

◆ displayCut()

ilPathGUI::displayCut ( )

Display a cut with "...".

Returns
bool

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

References $display_cut.

Referenced by getHTML().

137  {
138  return $this->display_cut;
139  }
+ 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.

References textOnly().

Referenced by ilObjectCopyCourseGroupSelectionTableGUI\customizePath().

78  {
79  $this->textOnly = $a_status;
80  }
textOnly()
show text only
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getHTML()

ilPathGUI::getHTML ( )
protected

get html

Returns

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

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

Referenced by getPath().

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  {
165  $obj_id = ilObject::_lookupObjId($ref_id);
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  {
208  $obj_id = ilObject::_lookupObjId($ref_id);
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  }
getUseImages()
get use images
displayCut()
Display a cut with "...".
static _lookupTitle($a_id)
lookup object title
textOnly()
show text only
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...
global $tpl
Definition: ilias.php:8
static _lookupObjId($a_id)
special template class to simplify handling of ITX/PEAR
static _lookupType($a_id, $a_reference=false)
lookup object type
$ref_id
Definition: sahs_server.php:39
+ 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.

References getHTML().

65  {
66  $this->startnode = $a_startnode;
67  $this->endnode = $a_endnode;
68 
69  return $this->getHTML();
70  }
getHTML()
get html
+ Here is the call graph for this function:

◆ getPathIds()

ilPathGUI::getPathIds ( )
protected
Parameters

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

References $path, array, and hideLeaf().

Referenced by getHTML().

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: aliased.php:25
Create styles array
The data for the language used.
+ 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.

References $useImages.

Referenced by getHTML().

119  {
120  return $this->useImages;
121  }
+ Here is the caller graph for this function:

◆ hideLeaf()

ilPathGUI::hideLeaf ( )

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

References $hide_leaf.

Referenced by getPathIds().

101  {
102  return $this->hide_leaf;
103  }
+ 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.

Referenced by ilObjectCopyCourseGroupSelectionTableGUI\customizePath().

110  {
111  $this->useImages = $a_status;
112  }
+ Here is the caller graph for this function:

◆ textOnly()

ilPathGUI::textOnly ( )

show text only

Returns

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

References $textOnly.

Referenced by enableTextOnly(), and getHTML().

87  {
88  return $this->textOnly;
89  }
+ 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: