ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilPathGUI Class Reference

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

+ Inheritance diagram for ilPathGUI:
+ 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...
 
 buildTitle ($a_obj_id)
 
 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 $DIC, $lng, and $tree.

50  {
51  global $DIC;
52 
53  $tree = $DIC['tree'];
54  $lng = $DIC['lng'];
55 
56  $this->tree = $tree;
57  $this->lng = $lng;
58  }
global $DIC
Definition: saml.php:7

Member Function Documentation

◆ buildTitle()

ilPathGUI::buildTitle (   $a_obj_id)
protected
Parameters
$a_obj_id
Returns
string

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

References ilObject\_lookupTitle().

Referenced by getHTML().

231  {
232  return ilObject::_lookupTitle($a_obj_id);
233  }
static _lookupTitle($a_id)
lookup object title
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ displayCut()

ilPathGUI::displayCut ( )

Display a cut with "...".

Returns
bool

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

References $display_cut.

Referenced by getHTML().

139  {
140  return $this->display_cut;
141  }
+ Here is the caller graph for this function:

◆ enableDisplayCut()

ilPathGUI::enableDisplayCut (   $a_status)

Display a cut with "...".

Parameters
$a_statusbool

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

130  {
131  $this->display_cut = $a_status;
132  }

◆ enableHideLeaf()

ilPathGUI::enableHideLeaf (   $a_status)

Hide leaf node in path.

Parameters
type$a_status

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

Referenced by ilSessionClassificationPathGUI\getPathIds().

98  {
99  $this->hide_leaf = $a_status;
100  }
+ Here is the caller graph for this function:

◆ enableTextOnly()

ilPathGUI::enableTextOnly (   $a_status)

render path as text only

Parameters
bool$a_text_onlypath as text only true/false
Returns

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

References textOnly().

Referenced by ilObjectCopyCourseGroupSelectionTableGUI\customizePath().

80  {
81  $this->textOnly = $a_status;
82  }
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 147 of file class.ilPathGUI.php.

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

Referenced by getPath().

148  {
149  if ($this->textOnly()) {
150  $tpl = new ilTemplate('tpl.locator_text_only.html', true, true, "Services/Locator");
151 
152  $first = true;
153 
154  // Display cut
155  if ($this->displayCut() && $this->startnode != ROOT_FOLDER_ID) {
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  $obj_id = ilObject::_lookupObjId($ref_id);
165  $title = $this->buildTitle($obj_id);
166 
167  if ($first) {
168  if ($ref_id == ROOT_FOLDER_ID) {
169  $title = $this->lng->txt('repository');
170  }
171  } else {
172  $tpl->touchBlock('locator_separator_prefix');
173  }
174 
175  $tpl->setCurrentBlock('locator_item');
176  $tpl->setVariable('ITEM', $title);
177  $tpl->parseCurrentBlock();
178  $first = false;
179  }
180  return $tpl->get();
181  } else {
182  // With images and links
183  include_once './Services/Link/classes/class.ilLink.php';
184 
185  $tpl = new ilTemplate('tpl.locator.html', true, true, 'Services/Locator');
186 
187  $first = true;
188 
189  // Display cut
190  if ($this->displayCut() && $this->startnode != ROOT_FOLDER_ID) {
191  $tpl->setCurrentBlock('locator_item');
192  $tpl->setVariable('ITEM', "...");
193  $tpl->parseCurrentBlock();
194 
195  $first = false;
196  }
197 
198  foreach ($this->getPathIds() as $ref_id) {
199  $obj_id = ilObject::_lookupObjId($ref_id);
200  $title = $this->buildTitle($obj_id);
201  $type = ilObject::_lookupType($obj_id);
202 
203  if ($first) {
204  if ($ref_id == ROOT_FOLDER_ID) {
205  $title = $this->lng->txt('repository');
206  }
207  } else {
208  $tpl->touchBlock('locator_separator_prefix');
209  }
210  if ($this->getUseImages()) {
211  $tpl->setCurrentBlock('locator_img');
212  $tpl->setVariable('IMG_SRC', ilUtil::getTypeIconPath($type, $obj_id));
213  $tpl->setVariable('IMG_ALT', $this->lng->txt('obj_' . $type));
214  $tpl->parseCurrentBlock();
215  }
216  $tpl->setCurrentBlock('locator_item');
217  $tpl->setVariable('LINK_ITEM', ilLink::_getLink($ref_id, $type));
218  $tpl->setVariable('ITEM', $title);
219  $tpl->parseCurrentBlock();
220  $first = false;
221  }
222  return $tpl->get();
223  }
224  }
getUseImages()
get use images
$type
$tpl
Definition: ilias.php:10
displayCut()
Display a cut with "...".
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...
static _lookupObjId($a_id)
special template class to simplify handling of ITX/PEAR
buildTitle($a_obj_id)
static _lookupType($a_id, $a_reference=false)
lookup object type
+ 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 66 of file class.ilPathGUI.php.

References getHTML().

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

◆ getPathIds()

ilPathGUI::getPathIds ( )
protected
Parameters

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

References $path, and hideLeaf().

Referenced by getHTML().

241  {
242  $path = $this->tree->getPathId($this->endnode, $this->startnode);
243  if ($this->hideLeaf()) {
244  unset($path[count($path) - 1]);
245  }
246  return $path ? $path : array();
247  }
$path
Definition: aliased.php:25
+ 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 120 of file class.ilPathGUI.php.

References $useImages.

Referenced by getHTML().

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

◆ hideLeaf()

ilPathGUI::hideLeaf ( )

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

References $hide_leaf.

Referenced by getPathIds().

103  {
104  return $this->hide_leaf;
105  }
+ Here is the caller graph for this function:

◆ setUseImages()

ilPathGUI::setUseImages (   $a_status)

set use images

Parameters
bool
Returns

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

Referenced by ilObjectCopyCourseGroupSelectionTableGUI\customizePath().

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

◆ textOnly()

ilPathGUI::textOnly ( )

show text only

Returns

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

References $textOnly.

Referenced by enableTextOnly(), and getHTML().

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