ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
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 (int $a_startnode, int $a_endnode)
 get path More...
 
 enableTextOnly (bool $a_status)
 render path as text only More...
 
 textOnly ()
 
 enableHideLeaf (bool $a_status)
 Hide leaf node in path. More...
 
 hideLeaf ()
 
 setUseImages (bool $a_status)
 
 getUseImages ()
 get use images More...
 
 enableDisplayCut (bool $a_status)
 Display a cut with "...". More...
 
 displayCut ()
 Display a cut with "...". More...
 

Protected Member Functions

 getHTML ()
 get html More...
 
 buildTitle (int $a_obj_id)
 
 buildLink (int $ref_id, string $type)
 
 getPathIds ()
 

Protected Attributes

ilLanguage $lng
 
ilTree $tree
 
ilCtrlInterface $ctrl
 
ilObjectDefinition $objectDefinition
 

Private Attributes

int $startnode
 
int $endnode
 
bool $textOnly = true
 
bool $useImages = false
 
bool $hide_leaf = true
 
bool $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 27 of file class.ilPathGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilPathGUI::__construct ( )

Constructor.

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

References $DIC, ILIAS\Repository\ctrl(), ILIAS\Repository\int(), ILIAS\Repository\lng(), ILIAS\Repository\objectDefinition(), and ROOT_FOLDER_ID.

46  {
47  global $DIC;
48 
49  $this->startnode = (int) ROOT_FOLDER_ID;
50  $this->endnode = (int) ROOT_FOLDER_ID;
51  $this->tree = $DIC->repositoryTree();
52  $this->lng = $DIC->language();
53  $this->ctrl = $DIC['ilCtrl'];
54  $this->objectDefinition = $DIC['objDefinition'];
55  }
const ROOT_FOLDER_ID
Definition: constants.php:32
global $DIC
Definition: feed.php:28
+ Here is the call graph for this function:

Member Function Documentation

◆ buildLink()

ilPathGUI::buildLink ( int  $ref_id,
string  $type 
)
protected

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

References ILIAS\Repository\ctrl(), and ILIAS\Repository\objectDefinition().

Referenced by getHTML().

228  : string
229  {
230  if ($this->objectDefinition->isAdministrationObject($type)) {
231  $current_parameters = $this->ctrl->getParameterArrayByClass(ilAdministrationGUI::class);
232  $this->ctrl->setParameterByClass(ilAdministrationGUI::class, 'ref_id', $ref_id);
233  $link = $this->ctrl->getLinkTargetByClass(ilAdministrationGUI::class, 'jump');
234  $this->ctrl->clearParameterByClass(ilAdministrationGUI::class, 'ref_id');
235  if (isset($current_parameters['ref_id'])) {
236  $this->ctrl->setParameterByClass(ilAdministrationGUI::class, 'ref_id', $current_parameters['ref_id']);
237  }
238  return $link;
239  }
240  return ilLink::_getLink($ref_id, $type);
241  }
$ref_id
Definition: ltiauth.php:67
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ buildTitle()

ilPathGUI::buildTitle ( int  $a_obj_id)
protected

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

References ilObject\_lookupTitle(), ilObject\_lookupType(), ILIAS\Repository\lng(), and ILIAS\Repository\objectDefinition().

Referenced by getHTML().

219  : string
220  {
221  $type = ilObject::_lookupType($a_obj_id);
222  if ($this->objectDefinition->isAdministrationObject($type)) {
223  return $this->lng->txt('obj_' . $type);
224  }
225  return ilObject::_lookupTitle($a_obj_id);
226  }
static _lookupTitle(int $obj_id)
static _lookupType(int $id, bool $reference=false)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ displayCut()

ilPathGUI::displayCut ( )

Display a cut with "...".

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

References $display_cut.

Referenced by getHTML().

124  : bool
125  {
126  return $this->display_cut;
127  }
+ Here is the caller graph for this function:

◆ enableDisplayCut()

ilPathGUI::enableDisplayCut ( bool  $a_status)

Display a cut with "...".

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

116  : void
117  {
118  $this->display_cut = $a_status;
119  }

◆ enableHideLeaf()

ilPathGUI::enableHideLeaf ( bool  $a_status)

Hide leaf node in path.

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

Referenced by ilSessionClassificationPathGUI\getPathIds().

89  : void
90  {
91  $this->hide_leaf = $a_status;
92  }
+ Here is the caller graph for this function:

◆ enableTextOnly()

ilPathGUI::enableTextOnly ( bool  $a_status)

render path as text only

Parameters
bool$a_text_onlypath as text only true/false
Returns
void

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

References textOnly().

Referenced by ilObjectCopyCourseGroupSelectionTableGUI\customizePath().

76  : void
77  {
78  $this->textOnly = $a_status;
79  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getHTML()

ilPathGUI::getHTML ( )
protected

get html

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

References $ref_id, ilObject\_getIcon(), ilObject\_lookupObjId(), ilObject\_lookupType(), buildLink(), buildTitle(), displayCut(), getPathIds(), getUseImages(), ILIAS\Repository\lng(), ROOT_FOLDER_ID, and textOnly().

Referenced by getPath().

132  : string
133  {
134  if ($this->textOnly()) {
135  $tpl = new ilTemplate('tpl.locator_text_only.html', true, true, "Services/Locator");
136 
137  $first = true;
138 
139  // Display cut
140  if ($this->displayCut() && $this->startnode != ROOT_FOLDER_ID) {
141  $tpl->setCurrentBlock('locator_item');
142  $tpl->setVariable('ITEM', "...");
143  $tpl->parseCurrentBlock();
144 
145  $first = false;
146  }
147 
148  foreach ($this->getPathIds() as $ref_id) {
149  $obj_id = ilObject::_lookupObjId($ref_id);
150  $title = $this->buildTitle($obj_id);
151 
152  if ($first) {
153  if ($ref_id == ROOT_FOLDER_ID) {
154  $title = $this->lng->txt('repository');
155  }
156  } else {
157  $tpl->touchBlock('locator_separator_prefix');
158  }
159 
160  $tpl->setCurrentBlock('locator_item');
161  $tpl->setVariable('ITEM', $title);
162  $tpl->parseCurrentBlock();
163  $first = false;
164  }
165  return $tpl->get();
166  } else {
167  // With images and links
168 
169  $tpl = new ilTemplate('tpl.locator.html', true, true, 'Services/Locator');
170 
171  $first = true;
172 
173  // Display cut
174  if ($this->displayCut() && $this->startnode != ROOT_FOLDER_ID) {
175  $tpl->setCurrentBlock('locator_item');
176  $tpl->setVariable('ITEM', "...");
177  $tpl->parseCurrentBlock();
178 
179  $first = false;
180  }
181 
182  foreach ($this->getPathIds() as $ref_id) {
183  $obj_id = ilObject::_lookupObjId($ref_id);
184  $title = $this->buildTitle($obj_id);
185  $type = ilObject::_lookupType($obj_id);
186 
187  if ($first) {
188  if ($ref_id == ROOT_FOLDER_ID) {
189  $title = $this->lng->txt('repository');
190  }
191  } else {
192  $tpl->touchBlock('locator_separator_prefix');
193  }
194  if ($this->getUseImages()) {
195  $tpl->setCurrentBlock('locator_img');
196  $tpl->setVariable('IMG_SRC', ilObject::_getIcon($obj_id, "small", $type));
197  $tpl->setVariable('IMG_ALT', $this->lng->txt('obj_' . $type));
198  $tpl->parseCurrentBlock();
199  }
200 
201  if (!$this->tree->isDeleted($ref_id)) {
202  $tpl->setCurrentBlock('locator_item');
203  $tpl->setVariable('LINK_ITEM', $this->buildLink($ref_id, $type));
204  $tpl->setVariable('ITEM', $title);
205  $tpl->parseCurrentBlock();
206  } else {
207  $tpl->setCurrentBlock('locator_item');
208  $tpl->setVariable('ITEM_READ_ONLY', $title);
209  $tpl->parseCurrentBlock();
210  }
211 
212  $first = false;
213  }
214  $tpl->setVariable("TXT_BREADCRUMBS", $this->lng->txt("breadcrumb_navigation"));
215  return $tpl->get();
216  }
217  }
getUseImages()
get use images
static _getIcon(int $obj_id=0, string $size="big", string $type="", bool $offline=false)
Get icon for repository item.
const ROOT_FOLDER_ID
Definition: constants.php:32
displayCut()
Display a cut with "...".
static _lookupObjId(int $ref_id)
$ref_id
Definition: ltiauth.php:67
buildLink(int $ref_id, string $type)
buildTitle(int $a_obj_id)
static _lookupType(int $id, bool $reference=false)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getPath()

ilPathGUI::getPath ( int  $a_startnode,
int  $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().

Referenced by ilObjectGUI\buildInputsForAdditionalDeletionReferences().

63  : string
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:
+ Here is the caller graph for this function:

◆ getPathIds()

ilPathGUI::getPathIds ( )
protected
Returns
int[]

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

References $path, and hideLeaf().

Referenced by getHTML().

246  : array
247  {
248  $path = $this->tree->getPathId($this->endnode, $this->startnode);
249  if ($this->hideLeaf() && count($path)) {
250  unset($path[count($path) - 1]);
251  }
252  return $path;
253  }
$path
Definition: ltiservices.php:32
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getUseImages()

ilPathGUI::getUseImages ( )

get use images

Returns
bool

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

References $useImages.

Referenced by getHTML().

108  : bool
109  {
110  return $this->useImages;
111  }
+ Here is the caller graph for this function:

◆ hideLeaf()

ilPathGUI::hideLeaf ( )

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

References $hide_leaf.

Referenced by getPathIds().

94  : bool
95  {
96  return $this->hide_leaf;
97  }
+ Here is the caller graph for this function:

◆ setUseImages()

ilPathGUI::setUseImages ( bool  $a_status)

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

Referenced by ilObjectCopyCourseGroupSelectionTableGUI\customizePath().

99  : void
100  {
101  $this->useImages = $a_status;
102  }
+ Here is the caller graph for this function:

◆ textOnly()

ilPathGUI::textOnly ( )

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

References $textOnly.

Referenced by enableTextOnly(), and getHTML().

81  : bool
82  {
83  return $this->textOnly;
84  }
+ Here is the caller graph for this function:

Field Documentation

◆ $ctrl

ilCtrlInterface ilPathGUI::$ctrl
protected

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

◆ $display_cut

bool ilPathGUI::$display_cut = false
private

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

Referenced by displayCut().

◆ $endnode

int ilPathGUI::$endnode
private

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

◆ $hide_leaf

bool ilPathGUI::$hide_leaf = true
private

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

Referenced by hideLeaf().

◆ $lng

ilLanguage ilPathGUI::$lng
protected

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

◆ $objectDefinition

ilObjectDefinition ilPathGUI::$objectDefinition
protected

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

◆ $startnode

int ilPathGUI::$startnode
private

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

◆ $textOnly

bool ilPathGUI::$textOnly = true
private

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

Referenced by textOnly().

◆ $tree

ilTree ilPathGUI::$tree
protected

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

◆ $useImages

bool ilPathGUI::$useImages = false
private

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

Referenced by getUseImages().


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