ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilPathGUI Class Reference
+ 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
 
ILIAS Refinery Factory $refinery
 

Private Attributes

int $startnode
 
int $endnode
 
bool $textOnly = true
 
bool $useImages = false
 
bool $hide_leaf = true
 
bool $display_cut = false
 

Detailed Description

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

Constructor & Destructor Documentation

◆ __construct()

ilPathGUI::__construct ( )

Constructor.

Reimplemented in ilSessionClassificationPathGUI.

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

41 {
42 global $DIC;
43
44 $this->startnode = (int) ROOT_FOLDER_ID;
45 $this->endnode = (int) ROOT_FOLDER_ID;
46 $this->tree = $DIC->repositoryTree();
47 $this->lng = $DIC->language();
48 $this->ctrl = $DIC['ilCtrl'];
49 $this->objectDefinition = $DIC['objDefinition'];
50 $this->refinery = $DIC->refinery();
51 }
const ROOT_FOLDER_ID
Definition: constants.php:32
global $DIC
Definition: shib_login.php:26

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

+ Here is the call graph for this function:

Member Function Documentation

◆ buildLink()

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

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

224 : string
225 {
226 if ($this->objectDefinition->isAdministrationObject($type)) {
227 $current_parameters = $this->ctrl->getParameterArrayByClass(ilAdministrationGUI::class);
228 $this->ctrl->setParameterByClass(ilAdministrationGUI::class, 'ref_id', $ref_id);
229 $link = $this->ctrl->getLinkTargetByClass(ilAdministrationGUI::class, 'jump');
230 $this->ctrl->clearParameterByClass(ilAdministrationGUI::class, 'ref_id');
231 if (isset($current_parameters['ref_id'])) {
232 $this->ctrl->setParameterByClass(ilAdministrationGUI::class, 'ref_id', $current_parameters['ref_id']);
233 }
234 return $link;
235 }
236 return $this->refinery->encode()->htmlAttributeValue()->transform(
237 ilLink::_getLink($ref_id, $type)
238 );
239 }
$ref_id
Definition: ltiauth.php:66

References $ref_id, ILIAS\Repository\ctrl(), ILIAS\Repository\objectDefinition(), and ILIAS\Repository\refinery().

Referenced by getHTML().

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

◆ buildTitle()

ilPathGUI::buildTitle ( int  $a_obj_id)
protected

Reimplemented in ilSessionClassificationPathGUI.

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

215 : string
216 {
217 $type = ilObject::_lookupType($a_obj_id);
218 if ($this->objectDefinition->isAdministrationObject($type)) {
219 return $this->lng->txt('obj_' . $type);
220 }
221 return ilObject::_lookupTitle($a_obj_id);
222 }
static _lookupType(int $id, bool $reference=false)
static _lookupTitle(int $obj_id)

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

120 : bool
121 {
122 return $this->display_cut;
123 }

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

112 : void
113 {
114 $this->display_cut = $a_status;
115 }

◆ enableHideLeaf()

ilPathGUI::enableHideLeaf ( bool  $a_status)

Hide leaf node in path.

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

85 : void
86 {
87 $this->hide_leaf = $a_status;
88 }

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

72 : void
73 {
74 $this->textOnly = $a_status;
75 }

References textOnly().

+ Here is the call graph for this function:

◆ getHTML()

ilPathGUI::getHTML ( )
protected

get html

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

128 : string
129 {
130 if ($this->textOnly()) {
131 $tpl = new ilTemplate('tpl.locator_text_only.html', true, true, "components/ILIAS/Locator");
132
133 $first = true;
134
135 // Display cut
136 if ($this->displayCut() && $this->startnode != ROOT_FOLDER_ID) {
137 $tpl->setCurrentBlock('locator_item');
138 $tpl->setVariable('ITEM', "...");
139 $tpl->parseCurrentBlock();
140
141 $first = false;
142 }
143
144 foreach ($this->getPathIds() as $ref_id) {
146 $title = $this->buildTitle($obj_id);
147
148 if ($first) {
149 if ($ref_id == ROOT_FOLDER_ID) {
150 $title = $this->lng->txt('repository');
151 }
152 } else {
153 $tpl->touchBlock('locator_separator_prefix');
154 }
155
156 $tpl->setCurrentBlock('locator_item');
157 $tpl->setVariable('ITEM', $title);
158 $tpl->parseCurrentBlock();
159 $first = false;
160 }
161 return $tpl->get();
162 } else {
163 // With images and links
164
165 $tpl = new ilTemplate('tpl.locator.html', true, true, 'components/ILIAS/Locator');
166
167 $first = true;
168
169 // Display cut
170 if ($this->displayCut() && $this->startnode != ROOT_FOLDER_ID) {
171 $tpl->setCurrentBlock('locator_item');
172 $tpl->setVariable('ITEM', "...");
173 $tpl->parseCurrentBlock();
174
175 $first = false;
176 }
177
178 foreach ($this->getPathIds() as $ref_id) {
180 $title = $this->buildTitle($obj_id);
181 $type = ilObject::_lookupType($obj_id);
182
183 if ($first) {
184 if ($ref_id == ROOT_FOLDER_ID) {
185 $title = $this->lng->txt('repository');
186 }
187 } else {
188 $tpl->touchBlock('locator_separator_prefix');
189 }
190 if ($this->getUseImages()) {
191 $tpl->setCurrentBlock('locator_img');
192 $tpl->setVariable('IMG_SRC', ilObject::_getIcon($obj_id, "small", $type));
193 $tpl->setVariable('IMG_ALT', $this->lng->txt('obj_' . $type));
194 $tpl->parseCurrentBlock();
195 }
196
197 if (!$this->tree->isDeleted($ref_id)) {
198 $tpl->setCurrentBlock('locator_item');
199 $tpl->setVariable('LINK_ITEM', $this->buildLink($ref_id, $type));
200 $tpl->setVariable('ITEM', $title);
201 $tpl->parseCurrentBlock();
202 } else {
203 $tpl->setCurrentBlock('locator_item');
204 $tpl->setVariable('ITEM_READ_ONLY', $title);
205 $tpl->parseCurrentBlock();
206 }
207
208 $first = false;
209 }
210 $tpl->setVariable("TXT_BREADCRUMBS", $this->lng->txt("breadcrumb_navigation"));
211 return $tpl->get();
212 }
213 }
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 "...".
buildLink(int $ref_id, string $type)
buildTitle(int $a_obj_id)
special template class to simplify handling of ITX/PEAR

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().

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

59 : string
60 {
61 $this->startnode = $a_startnode;
62 $this->endnode = $a_endnode;
63
64 return $this->getHTML();
65 }
getHTML()
get html

References getHTML().

+ Here is the call graph for this function:

◆ getPathIds()

ilPathGUI::getPathIds ( )
protected
Returns
int[]

Reimplemented in ilSessionClassificationPathGUI.

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

244 : array
245 {
246 $path = $this->tree->getPathId($this->endnode, $this->startnode);
247 if ($this->hideLeaf() && count($path)) {
248 unset($path[count($path) - 1]);
249 }
250 return $path;
251 }
$path
Definition: ltiservices.php:30

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

104 : bool
105 {
106 return $this->useImages;
107 }

References $useImages.

Referenced by getHTML().

+ Here is the caller graph for this function:

◆ hideLeaf()

ilPathGUI::hideLeaf ( )

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

90 : bool
91 {
92 return $this->hide_leaf;
93 }

References $hide_leaf.

Referenced by getPathIds().

+ Here is the caller graph for this function:

◆ setUseImages()

ilPathGUI::setUseImages ( bool  $a_status)

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

95 : void
96 {
97 $this->useImages = $a_status;
98 }

◆ textOnly()

ilPathGUI::textOnly ( )

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

77 : bool
78 {
79 return $this->textOnly;
80 }

References $textOnly.

Referenced by enableTextOnly(), and getHTML().

+ Here is the caller graph for this function:

Field Documentation

◆ $ctrl

ilCtrlInterface ilPathGUI::$ctrl
protected

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

◆ $display_cut

bool ilPathGUI::$display_cut = false
private

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

Referenced by displayCut().

◆ $endnode

int ilPathGUI::$endnode
private

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

◆ $hide_leaf

bool ilPathGUI::$hide_leaf = true
private

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

Referenced by hideLeaf().

◆ $lng

ilLanguage ilPathGUI::$lng
protected

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

◆ $objectDefinition

ilObjectDefinition ilPathGUI::$objectDefinition
protected

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

◆ $refinery

ILIAS Refinery Factory ilPathGUI::$refinery
protected

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

◆ $startnode

int ilPathGUI::$startnode
private

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

◆ $textOnly

bool ilPathGUI::$textOnly = true
private

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

Referenced by textOnly().

◆ $tree

ilTree ilPathGUI::$tree
protected

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

◆ $useImages

bool ilPathGUI::$useImages = false
private

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

Referenced by getUseImages().


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