ILIAS  release_4-4 Revision
All Data Structures Namespaces Files Functions Variables Modules Pages
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...
 

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
 

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

References $lng, and $tree.

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

Member Function Documentation

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

References textOnly().

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

◆ getHTML()

ilPathGUI::getHTML ( )
protected

get html

Returns

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

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

Referenced by getPath().

127  {
128  if($this->textOnly())
129  {
130  $tpl = new ilTemplate('tpl.locator_text_only.html',true,true, "Services/Locator");
131 
132  $first = true;
133  foreach($this->getPathIds() as $ref_id)
134  {
135  $obj_id = ilObject::_lookupObjId($ref_id);
136  $title = ilObject::_lookupTitle($obj_id);
137 
138  if($first)
139  {
140  if($ref_id == ROOT_FOLDER_ID)
141  {
142  $title = $this->lng->txt('repository');
143  }
144  }
145  else
146  {
147  $tpl->touchBlock('locator_separator_prefix');
148  }
149 
150  $tpl->setCurrentBlock('locator_item');
151  $tpl->setVariable('ITEM',$title);
152  $tpl->parseCurrentBlock();
153  $first = false;
154  }
155  return $tpl->get();
156  }
157  else
158  {
159  // With images and links
160  include_once './Services/Link/classes/class.ilLink.php';
161 
162  $tpl = new ilTemplate('tpl.locator.html',true,true,'Services/Locator');
163 
164  $first = true;
165  foreach($this->getPathIds() as $ref_id)
166  {
167  $obj_id = ilObject::_lookupObjId($ref_id);
168  $title = ilObject::_lookupTitle($obj_id);
169  $type = ilObject::_lookupType($obj_id);
170 
171  if($first)
172  {
173  if($ref_id == ROOT_FOLDER_ID)
174  {
175  $title = $this->lng->txt('repository');
176  }
177  }
178  else
179  {
180  $tpl->touchBlock('locator_separator_prefix');
181  }
182  if($this->getUseImages())
183  {
184  $tpl->setCurrentBlock('locator_img');
185  $tpl->setVariable('IMG_SRC',ilUtil::getTypeIconPath($type,$obj_id));
186  $tpl->setVariable('IMG_ALT',$this->lng->txt('obj_'.$type));
187  $tpl->parseCurrentBlock();
188  }
189  $tpl->setCurrentBlock('locator_item');
190  $tpl->setVariable('LINK_ITEM',ilLink::_getLink($ref_id,$type));
191  $tpl->setVariable('ITEM',$title);
192  $tpl->parseCurrentBlock();
193  $first = false;
194  }
195  return $tpl->get();
196  }
197  }
getUseImages()
get use images
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...
static _lookupObjId($a_id)
special template class to simplify handling of ITX/PEAR
if(isset($_FILES['img_file']['size']) && $_FILES['img_file']['size'] > 0) $tpl
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 63 of file class.ilPathGUI.php.

References getHTML().

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

◆ getPathIds()

ilPathGUI::getPathIds ( )
protected
Parameters

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

References $path, and hideLeaf().

Referenced by getHTML().

205  {
206  $path = $this->tree->getPathId($this->endnode,$this->startnode);
207  if($this->hideLeaf())
208  {
209  unset($path[count($path) - 1]);
210  }
211  return $path ? $path : array();
212  }
$path
Definition: index.php:22
+ 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.

References $useImages.

Referenced by getHTML().

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

◆ hideLeaf()

ilPathGUI::hideLeaf ( )

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

References $hide_leaf.

Referenced by getPathIds().

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

References $textOnly.

Referenced by enableTextOnly(), and getHTML().

86  {
87  return $this->textOnly;
88  }
+ Here is the caller graph for this function:

Field Documentation

◆ $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 42 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 43 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: