ILIAS  trunk Revision v12.0_alpha-1227-g7ff6d300864
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
 
ilAccessHandler $access
 

Detailed Description

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

Constructor & Destructor Documentation

◆ __construct()

ilPathGUI::__construct ( )

Constructor.

Reimplemented in ilSessionClassificationPathGUI.

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

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

References $DIC, ILIAS\Repository\access(), 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 228 of file class.ilPathGUI.php.

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 $this->refinery->encode()->htmlAttributeValue()->transform(
241 ilLink::_getLink($ref_id, $type)
242 );
243 }
$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 219 of file class.ilPathGUI.php.

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

122 : bool
123 {
124 return $this->display_cut;
125 }

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

114 : void
115 {
116 $this->display_cut = $a_status;
117 }

◆ enableHideLeaf()

ilPathGUI::enableHideLeaf ( bool  $a_status)

Hide leaf node in path.

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

87 : void
88 {
89 $this->hide_leaf = $a_status;
90 }

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

74 : void
75 {
76 $this->textOnly = $a_status;
77 }

References textOnly().

+ Here is the call graph for this function:

◆ getHTML()

ilPathGUI::getHTML ( )
protected

get html

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

130 : string
131 {
132 if ($this->textOnly()) {
133 $tpl = new ilTemplate('tpl.locator_text_only.html', true, true, "components/ILIAS/Locator");
134
135 $first = true;
136
137 // Display cut
138 if ($this->displayCut() && $this->startnode != ROOT_FOLDER_ID) {
139 $tpl->setCurrentBlock('locator_item');
140 $tpl->setVariable('ITEM', "...");
141 $tpl->parseCurrentBlock();
142
143 $first = false;
144 }
145
146 foreach ($this->getPathIds() as $ref_id) {
148 $title = $this->buildTitle($obj_id);
149
150 if ($first) {
151 if ($ref_id == ROOT_FOLDER_ID) {
152 $title = $this->lng->txt('repository');
153 }
154 } else {
155 $tpl->touchBlock('locator_separator_prefix');
156 }
157
158 $tpl->setCurrentBlock('locator_item');
159 $tpl->setVariable('ITEM', $title);
160 $tpl->parseCurrentBlock();
161 $first = false;
162 }
163 return $tpl->get();
164 } else {
165 // With images and links
166
167 $tpl = new ilTemplate('tpl.locator.html', true, true, 'components/ILIAS/Locator');
168
169 $first = true;
170
171 // Display cut
172 if ($this->displayCut() && $this->startnode != ROOT_FOLDER_ID) {
173 $tpl->setCurrentBlock('locator_item');
174 $tpl->setVariable('ITEM', "...");
175 $tpl->parseCurrentBlock();
176
177 $first = false;
178 }
179
180 foreach ($this->getPathIds() as $ref_id) {
182 $title = $this->buildTitle($obj_id);
183 $type = ilObject::_lookupType($obj_id);
184
185 if ($first) {
186 if ($ref_id == ROOT_FOLDER_ID) {
187 $title = $this->lng->txt('repository');
188 }
189 } else {
190 $tpl->touchBlock('locator_separator_prefix');
191 }
192 if ($this->getUseImages()) {
193 $tpl->setCurrentBlock('locator_img');
194 $tpl->setVariable('IMG_SRC', ilObject::_getIcon($obj_id, "small", $type));
195 $tpl->setVariable('IMG_ALT', $this->lng->txt('obj_' . $type));
196 $tpl->parseCurrentBlock();
197 }
198
199 if (!$this->tree->isDeleted($ref_id) &&
200 ($this->access->checkAccess('visible', '', (int) $ref_id)
201 || $this->access->checkAccess('read', '', (int) $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 }
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 61 of file class.ilPathGUI.php.

61 : string
62 {
63 $this->startnode = $a_startnode;
64 $this->endnode = $a_endnode;
65
66 return $this->getHTML();
67 }
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 248 of file class.ilPathGUI.php.

248 : array
249 {
250 $path = $this->tree->getPathId($this->endnode, $this->startnode);
251 if ($this->hideLeaf() && count($path)) {
252 unset($path[count($path) - 1]);
253 }
254 return $path;
255 }
$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 106 of file class.ilPathGUI.php.

106 : bool
107 {
108 return $this->useImages;
109 }

References $useImages.

Referenced by getHTML().

+ Here is the caller graph for this function:

◆ hideLeaf()

ilPathGUI::hideLeaf ( )

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

92 : bool
93 {
94 return $this->hide_leaf;
95 }

References $hide_leaf.

Referenced by getPathIds().

+ Here is the caller graph for this function:

◆ setUseImages()

ilPathGUI::setUseImages ( bool  $a_status)

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

97 : void
98 {
99 $this->useImages = $a_status;
100 }

◆ textOnly()

ilPathGUI::textOnly ( )

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

79 : bool
80 {
81 return $this->textOnly;
82 }

References $textOnly.

Referenced by enableTextOnly(), and getHTML().

+ Here is the caller graph for this function:

Field Documentation

◆ $access

ilAccessHandler ilPathGUI::$access
private

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

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