ILIAS  release_8 Revision v8.24
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)
 
 getPathIds ()
 

Protected Attributes

ilLanguage $lng
 
ilTree $tree
 
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 32 of file class.ilPathGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilPathGUI::__construct ( )

Constructor.

Reimplemented in ilSessionClassificationPathGUI.

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

50 {
51 global $DIC;
52
53 $this->startnode = (int) ROOT_FOLDER_ID;
54 $this->endnode = (int) ROOT_FOLDER_ID;
55 $this->tree = $DIC->repositoryTree();
56 $this->lng = $DIC->language();
57 $this->objectDefinition = $DIC['objDefinition'];
58 }
const ROOT_FOLDER_ID
Definition: constants.php:32
global $DIC
Definition: feed.php:28

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

+ Here is the call graph for this function:

Member Function Documentation

◆ buildTitle()

ilPathGUI::buildTitle ( int  $a_obj_id)
protected

Reimplemented in ilSessionClassificationPathGUI.

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

222 : string
223 {
224 $type = ilObject::_lookupType($a_obj_id);
225 if ($this->objectDefinition->isAdministrationObject($type)) {
226 return $this->lng->txt('obj_' . $type);
227 }
228 return ilObject::_lookupTitle($a_obj_id);
229 }
static _lookupType(int $id, bool $reference=false)
static _lookupTitle(int $obj_id)
$type

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

Referenced by getHTML().

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

127 : bool
128 {
129 return $this->display_cut;
130 }

References $display_cut.

Referenced by getHTML().

+ Here is the caller graph for this function:

◆ enableDisplayCut()

ilPathGUI::enableDisplayCut ( bool  $a_status)

Display a cut with "...".

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

119 : void
120 {
121 $this->display_cut = $a_status;
122 }

◆ enableHideLeaf()

ilPathGUI::enableHideLeaf ( bool  $a_status)

Hide leaf node in path.

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

92 : void
93 {
94 $this->hide_leaf = $a_status;
95 }

Referenced by ilSessionClassificationPathGUI\getPathIds().

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

79 : void
80 {
81 $this->textOnly = $a_status;
82 }

References textOnly().

Referenced by ilObjectListGUI\insertPath().

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

135 : string
136 {
137 if ($this->textOnly()) {
138 $tpl = new ilTemplate('tpl.locator_text_only.html', true, true, "Services/Locator");
139
140 $first = true;
141
142 // Display cut
143 if ($this->displayCut() && $this->startnode != ROOT_FOLDER_ID) {
144 $tpl->setCurrentBlock('locator_item');
145 $tpl->setVariable('ITEM', "...");
146 $tpl->parseCurrentBlock();
147
148 $first = false;
149 }
150
151 foreach ($this->getPathIds() as $ref_id) {
153 $title = $this->buildTitle($obj_id);
154
155 if ($first) {
156 if ($ref_id == ROOT_FOLDER_ID) {
157 $title = $this->lng->txt('repository');
158 }
159 } else {
160 $tpl->touchBlock('locator_separator_prefix');
161 }
162
163 $tpl->setCurrentBlock('locator_item');
164 $tpl->setVariable('ITEM', $title);
165 $tpl->parseCurrentBlock();
166 $first = false;
167 }
168 return $tpl->get();
169 } else {
170 // With images and links
171
172 $tpl = new ilTemplate('tpl.locator.html', true, true, 'Services/Locator');
173
174 $first = true;
175
176 // Display cut
177 if ($this->displayCut() && $this->startnode != ROOT_FOLDER_ID) {
178 $tpl->setCurrentBlock('locator_item');
179 $tpl->setVariable('ITEM', "...");
180 $tpl->parseCurrentBlock();
181
182 $first = false;
183 }
184
185 foreach ($this->getPathIds() as $ref_id) {
187 $title = $this->buildTitle($obj_id);
188 $type = ilObject::_lookupType($obj_id);
189
190 if ($first) {
191 if ($ref_id == ROOT_FOLDER_ID) {
192 $title = $this->lng->txt('repository');
193 }
194 } else {
195 $tpl->touchBlock('locator_separator_prefix');
196 }
197 if ($this->getUseImages()) {
198 $tpl->setCurrentBlock('locator_img');
199 $tpl->setVariable('IMG_SRC', ilObject::_getIcon($obj_id, "small", $type));
200 $tpl->setVariable('IMG_ALT', $this->lng->txt('obj_' . $type));
201 $tpl->parseCurrentBlock();
202 }
203
204 if (!$this->tree->isDeleted($ref_id)) {
205 $tpl->setCurrentBlock('locator_item');
206 $tpl->setVariable('LINK_ITEM', ilLink::_getLink($ref_id, $type));
207 $tpl->setVariable('ITEM', $title);
208 $tpl->parseCurrentBlock();
209 } else {
210 $tpl->setCurrentBlock('locator_item');
211 $tpl->setVariable('ITEM_READ_ONLY', $title);
212 $tpl->parseCurrentBlock();
213 }
214
215 $first = false;
216 }
217 $tpl->setVariable("TXT_BREADCRUMBS", $this->lng->txt("breadcrumb_navigation"));
218 return $tpl->get();
219 }
220 }
static _getIcon(int $obj_id=0, string $size="big", string $type="", bool $offline=false)
Get icon for repository item.
static _lookupObjId(int $ref_id)
getUseImages()
get use images
displayCut()
Display a cut with "...".
buildTitle(int $a_obj_id)
special template class to simplify handling of ITX/PEAR
if($DIC->http() ->request() ->getMethod()=="GET" &&isset($DIC->http() ->request() ->getQueryParams()['tex'])) $tpl
Definition: latex.php:41
$ref_id
Definition: ltiauth.php:67

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

Referenced by getPath().

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

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

References getHTML().

Referenced by ilObjectListGUI\insertPath().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getPathIds()

ilPathGUI::getPathIds ( )
protected
Returns
int[]

Reimplemented in ilSessionClassificationPathGUI.

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

234 : array
235 {
236 $path = $this->tree->getPathId($this->endnode, $this->startnode);
237 if ($this->hideLeaf() && count($path)) {
238 unset($path[count($path) - 1]);
239 }
240 return $path;
241 }
$path
Definition: ltiservices.php:32

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
bool

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

111 : bool
112 {
113 return $this->useImages;
114 }

References $useImages.

Referenced by getHTML().

+ Here is the caller graph for this function:

◆ hideLeaf()

ilPathGUI::hideLeaf ( )

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

97 : bool
98 {
99 return $this->hide_leaf;
100 }

References $hide_leaf.

Referenced by getPathIds().

+ Here is the caller graph for this function:

◆ setUseImages()

ilPathGUI::setUseImages ( bool  $a_status)

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

102 : void
103 {
104 $this->useImages = $a_status;
105 }

Referenced by ilObjectListGUI\insertPath().

+ Here is the caller graph for this function:

◆ textOnly()

ilPathGUI::textOnly ( )

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

84 : bool
85 {
86 return $this->textOnly;
87 }

References $textOnly.

Referenced by enableTextOnly(), and getHTML().

+ Here is the caller graph for this function:

Field Documentation

◆ $display_cut

bool ilPathGUI::$display_cut = false
private

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

Referenced by displayCut().

◆ $endnode

int ilPathGUI::$endnode
private

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

◆ $hide_leaf

bool ilPathGUI::$hide_leaf = true
private

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

Referenced by hideLeaf().

◆ $lng

ilLanguage ilPathGUI::$lng
protected

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

◆ $objectDefinition

ilObjectDefinition ilPathGUI::$objectDefinition
protected

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

◆ $startnode

int ilPathGUI::$startnode
private

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

◆ $textOnly

bool ilPathGUI::$textOnly = true
private

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

Referenced by textOnly().

◆ $tree

ilTree ilPathGUI::$tree
protected

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

◆ $useImages

bool ilPathGUI::$useImages = false
private

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

Referenced by getUseImages().


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