ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilLMNavigationRendererGUI Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

+ Collaboration diagram for ilLMNavigationRendererGUI:

Public Member Functions

 __construct (ilLMPresentationService $service, ilLMPresentationGUI $parent_gui, ilLanguage $lng, ilObjUser $user, ilGlobalTemplateInterface $main_tpl, int $requested_obj_id, string $requested_back_pg, string $requested_frame, ilToolbarGUI $toolbar, \ILIAS\DI\UIServices $ui)
 
 renderTop ()
 
 renderBottom ()
 

Protected Member Functions

 render (bool $top=true)
 
 addDropdown ()
 

Protected Attributes

ilToolbarGUI $toolbar
 
ILIAS DI UIServices $ui
 
string $requested_frame
 
int $requested_back_pg
 
int $requested_obj_id
 
ilLMPresentationLinker $linker
 
bool $deactivated_page
 
bool $chapter_has_no_active_page
 
ilObjUser $user
 
int $current_page
 
ilObjLearningModule $lm
 
ilLanguage $lng
 
bool $offline
 
ilLMTracker $tracker
 
ilLMTree $lm_tree
 
ilLMPresentationGUI $parent_gui
 
ilSetting $lm_set
 
ilGlobalTemplateInterface $main_tpl
 
string $lang
 
ilLMNavigationStatus $navigation_status
 

Detailed Description

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning

Author
Alexander Killing killi.nosp@m.ng@l.nosp@m.eifos.nosp@m..de

Definition at line 22 of file class.ilLMNavigationRendererGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilLMNavigationRendererGUI::__construct ( ilLMPresentationService  $service,
ilLMPresentationGUI  $parent_gui,
ilLanguage  $lng,
ilObjUser  $user,
ilGlobalTemplateInterface  $main_tpl,
int  $requested_obj_id,
string  $requested_back_pg,
string  $requested_frame,
ilToolbarGUI  $toolbar,
\ILIAS\DI\UIServices  $ui 
)

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

56 {
57 $this->user = $user;
58 $this->toolbar = $toolbar;
59 $this->ui = $ui;
60 $this->lm_tree = $service->getLMTree();
61 $this->current_page = $service->getNavigationStatus()->getCurrentPage();
62 $this->lm = $service->getLearningModule();
63 $this->lm_set = $service->getSettings();
64 $this->lng = $lng;
65 $this->offline = $service->getPresentationStatus()->offline();
66 $this->tracker = $service->getTracker();
67 $this->parent_gui = $parent_gui;
68 $this->chapter_has_no_active_page = $service->getNavigationStatus()->isChapterWithoutActivePage();
69 $this->deactivated_page = $service->getNavigationStatus()->isDeactivatedPage();
70 $this->linker = $service->getLinker();
71 $this->navigation_status = $service->getNavigationStatus();
72 $this->requested_obj_id = $requested_obj_id;
73 $back_pg = explode(":", $requested_back_pg);
74 $this->requested_back_pg = (int) $back_pg[0];
75 $this->requested_frame = $requested_frame;
76 $this->main_tpl = $main_tpl;
77 $this->lang = $service->getPresentationStatus()->getLang();
78 }
$service
Definition: ltiresult.php:36

References $lng, $main_tpl, $parent_gui, $requested_back_pg, $requested_frame, $requested_obj_id, $service, $toolbar, $ui, $user, ILIAS\Repository\int(), ILIAS\Repository\lng(), ILIAS\Repository\toolbar(), ILIAS\Repository\ui(), and ILIAS\Repository\user().

+ Here is the call graph for this function:

Member Function Documentation

◆ addDropdown()

ilLMNavigationRendererGUI::addDropdown ( )
protected

Definition at line 267 of file class.ilLMNavigationRendererGUI.php.

268 {
269 $nodes = $this->lm_tree->getSubTree($this->lm_tree->getNodeData($this->lm_tree->getRootId()));
270 //$nodes = $this->filterNonAccessibleNode($nodes);
271
272 foreach ($nodes as $node) {
273 $disabled = false;
274
275 // check page activation
276 $active = ilLMPage::_lookupActive(
277 $node["obj_id"],
278 $this->lm->getType(),
279 (bool) $this->lm_set->get("time_scheduled_page_activation")
280 );
281
282 if ($node["type"] === "pg" &&
283 !$active) {
284 continue;
285 }
286
287 $text = "";
288 $checked = false;
289
290 switch ($node["type"]) {
291 // page
292 case "pg":
293 if ($this->lm->getTOCMode() !== "pages") {
294 continue 2;
295 }
296 $text =
298 $node["obj_id"],
299 $this->lm->getPageHeader(),
300 $this->lm->isActiveNumbering(),
301 (bool) $this->lm_set->get("time_scheduled_page_activation"),
302 false,
303 $this->lm->getId(),
304 $this->lang,
305 true
306 );
307
308 break;
309
310 // learning module
311 case "du":
312 $text = "";
313 break;
314
315 // chapter
316 case "st":
317 $text =
319 $node["obj_id"],
321 $this->lm->isActiveNumbering(),
322 (bool) $this->lm_set->get("time_scheduled_page_activation"),
323 false,
324 $this->lm->getId(),
325 $this->lang,
326 true
327 );
328 break;
329 }
330
332 $this->lm->getRefId(),
333 $this->lm->getId(),
334 $node["obj_id"]
335 )) {
336 $disabled = true;
337 $text .= " (" . $this->lng->txt("cont_no_access") . ")";
338 }
339
340 $href = $this->linker->getLink("layout", $node["obj_id"]);
341
342 if ($text !== "") {
343 if ($this->lm->getTOCMode() === "pages" && $this->current_page == $node["obj_id"]) {
344 $text = "» " . $text;
345 }
346 if ($this->lm->getTOCMode() !== "pages") {
347 if ($this->lm_tree->getParentId($this->current_page) == $node["obj_id"]) {
348 $text = "» " . $text;
349 }
350 }
351 $text = str_pad("", ($node["depth"] - 1) * 12, " ") . $text;
352 $actions[] = $this->ui->factory()->button()->shy(
353 $text,
354 $href
355 );
356 }
357 }
358
359 if ($this->lm->getTOCMode() === "pages") {
361 $this->current_page,
362 $this->lm->getPageHeader(),
363 $this->lm->isActiveNumbering(),
364 (bool) $this->lm_set->get("time_scheduled_page_activation"),
365 false,
366 $this->lm->getId(),
367 $this->lang,
368 true
369 );
370 } else {
371 $st_id = $this->lm_tree->getParentId($this->current_page);
372 if ($st_id > 0) {
374 $st_id,
376 $this->lm->isActiveNumbering(),
377 (bool) $this->lm_set->get("time_scheduled_page_activation"),
378 false,
379 $this->lm->getId(),
380 $this->lang,
381 true
382 );
383 }
384 }
385
386 $title = "<span style='vertical-align: bottom; max-width:60px; display: inline-block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis;'>" . $title . "</span>";
387
388
389 $this->toolbar->addStickyItem(
390 $this->ui->factory()->dropdown()->standard($actions)->withLabel($title)
391 );
392 }
static _getPresentationTitle(int $a_pg_id, string $a_mode=self::CHAPTER_TITLE, bool $a_include_numbers=false, bool $a_time_scheduled_activation=false, bool $a_force_content=false, int $a_lm_id=0, string $a_lang="-", bool $a_include_short=false)
presentation title doesn't have to be page title, it may be chapter title + page title or chapter tit...
static _checkPreconditionsOfPage(int $cont_ref_id, int $cont_obj_id, int $page_id)
checks whether the preconditions of a page are fulfilled or not
static _lookupActive(int $a_id, string $a_parent_type, bool $a_check_scheduled_activation=false, string $a_lang="-")
lookup activation status
static _getPresentationTitle(int $a_st_id, string $a_mode=self::CHAPTER_TITLE, bool $a_include_numbers=false, bool $a_time_scheduled_activation=false, bool $a_force_content=false, int $a_lm_id=0, string $a_lang="-", bool $a_include_short=false)

References ilObjContentObject\_checkPreconditionsOfPage(), ilLMPageObject\_getPresentationTitle(), ilStructureObject\_getPresentationTitle(), ilPageObject\_lookupActive(), ilLMObject\CHAPTER_TITLE, ILIAS\Repository\lng(), ILIAS\Repository\toolbar(), and ILIAS\Repository\ui().

Referenced by render().

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

◆ render()

ilLMNavigationRendererGUI::render ( bool  $top = true)
protected

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

90 : string
91 {
92 $page_id = $this->current_page;
93
94 $tpl = new ilTemplate("tpl.lm_navigation.html", true, true, "components/ILIAS/LearningModule/Presentation");
95
96 if (empty($page_id)) {
97 return "";
98 }
99
100 // process navigation for free page
101 $back_pg = $this->navigation_status->getBackPageId();
102 if ($back_pg > 0) {
103 $back_href =
104 $this->linker->getLink(
105 "layout",
106 $back_pg,
107 "",
108 "",
109 "reduce"
110 );
111 $back_img =
112 ilUtil::getImagePath("nav/nav_arr2_L.png", false, "output", $this->offline);
113 $tpl->setCurrentBlock("ilLMNavigation_Prev");
114 $tpl->setVariable("IMG_PREV", $back_img);
115 $tpl->setVariable("HREF_PREV", $back_href);
116 $tpl->setVariable("TXT_PREV", $this->lng->txt("back"));
117 $tpl->setVariable("ALT_PREV", $this->lng->txt("back"));
118 $tpl->setVariable("SPACER_PREV", $this->offline
119 ? "images/media/spacer.png"
120 : ilUtil::getImagePath("media/spacer.png"));
121 $tpl->parseCurrentBlock();
122 if ($top) {
123 $b = $this->ui->factory()->button()->standard(
124 "<span class=\"glyphicon glyphicon-chevron-left \" aria-hidden=\"true\"></span>",
125 $back_href
126 );
127 $this->toolbar->addStickyItem($b);
128 }
129 } else {
130 $pre_id = $this->navigation_status->getPredecessorPageId();
131 if ($pre_id > 0) {
132 // get presentation title
134 $pre_id,
135 $this->lm->getPageHeader(),
136 $this->lm->isActiveNumbering(),
137 (bool) $this->lm_set->get("time_scheduled_page_activation"),
138 false,
139 0,
140 $this->lang,
141 true
142 );
143 $prev_title = ilStr::shortenTextExtended($prev_title, 50, true);
144 $prev_img =
145 ilUtil::getImagePath("nav/nav_arr_L.png", false, "output", $this->offline);
146
147 if (!$this->lm->cleanFrames()) {
148 $prev_href =
149 $this->linker->getLink(
150 "layout",
151 $pre_id,
152 $this->requested_frame
153 );
154 $prev_target = "";
155 } else {
156 if (!$this->offline) {
157 $prev_href =
158 $this->linker->getLink("layout", $pre_id);
159 } else {
160 $prev_href =
161 $this->linker->getLink("layout", $pre_id);
162 }
163 }
164
165 $tpl->setCurrentBlock("ilLMNavigation_Prev");
166 $tpl->setVariable("IMG_PREV", $prev_img);
167 $tpl->setVariable("HREF_PREV", $prev_href);
168 $tpl->setVariable("TXT_PREV", $prev_title);
169 $tpl->setVariable("ALT_PREV", $this->lng->txt("previous"));
170 $tpl->setVariable("SPACER_PREV", $this->offline
171 ? "images/media/spacer.png"
172 : ilUtil::getImagePath("media/spacer.png"));
173
174 if ($top) {
175 $b = $this->ui->factory()->button()->standard(
176 "<span class=\"glyphicon glyphicon-chevron-left \" aria-hidden=\"true\"></span>",
177 $prev_href
178 );
179 $this->toolbar->addStickyItem($b);
180 }
181 } else {
182 if ($top) {
183 $b = $this->ui->factory()->button()->standard(
184 "<span class=\"glyphicon glyphicon-chevron-left \" aria-hidden=\"true\"></span>",
185 "#"
186 )->withUnavailableAction();
187 $this->toolbar->addStickyItem($b);
188 }
189 }
190
191 $this->addDropdown();
192
193 $succ_id = $this->navigation_status->getSuccessorPageId();
194 if ($succ_id > 0) {
195 // get presentation title
197 $succ_id,
198 $this->lm->getPageHeader(),
199 $this->lm->isActiveNumbering(),
200 (bool) $this->lm_set->get("time_scheduled_page_activation"),
201 false,
202 0,
203 $this->lang,
204 true
205 );
206 $succ_title = ilStr::shortenTextExtended($succ_title, 50, true);
207 $succ_img =
208 ilUtil::getImagePath("nav/nav_arr_R.png", false, "output", $this->offline);
209 if (!$this->lm->cleanFrames()) {
210 $succ_href =
211 $this->linker->getLink(
212 "layout",
213 $succ_id,
214 $this->requested_frame
215 );
216 $succ_target = "";
217 } else {
218 if (!$this->offline) {
219 $succ_href =
220 $this->linker->getLink("layout", $succ_id);
221 } else {
222 $succ_href =
223 $this->linker->getLink("layout", $succ_id);
224 }
225 }
226
227 $tpl->setCurrentBlock("ilLMNavigation_Next");
228 $tpl->setVariable("IMG_SUCC", $succ_img);
229 $tpl->setVariable("HREF_SUCC", $succ_href);
230 $tpl->setVariable("TXT_SUCC", $succ_title);
231 $tpl->setVariable("ALT_SUCC", $this->lng->txt("next"));
232 $tpl->setVariable("SPACER_SUCC", $this->offline
233 ? "images/media/spacer.png"
234 : ilUtil::getImagePath("media/spacer.png"));
235 $tpl->parseCurrentBlock();
236
237 // check if successor page is not restricted
238 if (!$this->offline) {
239 if ($this->lm->getRestrictForwardNavigation()) {
240 if ($this->tracker->hasPredIncorrectAnswers($succ_id)) {
241 $this->main_tpl->addOnLoadCode("il.LearningModule.hideNextNavigation();");
242 }
243 }
244 }
245 if ($top) {
246 $b = $this->ui->factory()->button()->standard(
247 "<span class=\"glyphicon glyphicon-chevron-right \" aria-hidden=\"true\"></span>",
248 $succ_href
249 );
250 $this->toolbar->addStickyItem($b);
251 }
252 } else {
253 if ($top) {
254 $b = $this->ui->factory()->button()->standard(
255 "<span class=\"glyphicon glyphicon-chevron-right \" aria-hidden=\"true\"></span>",
256 "#"
257 )->withUnavailableAction();
258 $this->toolbar->addStickyItem($b);
259 }
260 }
261 }
262 $tpl->setVariable("CLASS", ($top) ? "tnav_Top" : "bnav_Bottom");
263
264 return $tpl->get();
265 }
static shortenTextExtended(string $a_str, int $a_len, bool $a_dots=false, bool $a_next_blank=false, bool $a_keep_extension=false)
special template class to simplify handling of ITX/PEAR
static getImagePath(string $image_name, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)

References Vendor\Package\$b, $current_page, ilLMPageObject\_getPresentationTitle(), addDropdown(), ilUtil\getImagePath(), ILIAS\Repository\lng(), ilStr\shortenTextExtended(), ILIAS\Repository\toolbar(), and ILIAS\Repository\ui().

Referenced by renderBottom(), and renderTop().

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

◆ renderBottom()

ilLMNavigationRendererGUI::renderBottom ( )

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

85 : string
86 {
87 return $this->render(false);
88 }

References render().

+ Here is the call graph for this function:

◆ renderTop()

ilLMNavigationRendererGUI::renderTop ( )

Definition at line 80 of file class.ilLMNavigationRendererGUI.php.

80 : string
81 {
82 return $this->render();
83 }

References render().

+ Here is the call graph for this function:

Field Documentation

◆ $chapter_has_no_active_page

bool ilLMNavigationRendererGUI::$chapter_has_no_active_page
protected

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

◆ $current_page

int ilLMNavigationRendererGUI::$current_page
protected

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

Referenced by render().

◆ $deactivated_page

bool ilLMNavigationRendererGUI::$deactivated_page
protected

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

◆ $lang

string ilLMNavigationRendererGUI::$lang
protected

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

◆ $linker

ilLMPresentationLinker ilLMNavigationRendererGUI::$linker
protected

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

◆ $lm

ilObjLearningModule ilLMNavigationRendererGUI::$lm
protected

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

◆ $lm_set

ilSetting ilLMNavigationRendererGUI::$lm_set
protected

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

◆ $lm_tree

ilLMTree ilLMNavigationRendererGUI::$lm_tree
protected

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

◆ $lng

ilLanguage ilLMNavigationRendererGUI::$lng
protected

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

Referenced by __construct().

◆ $main_tpl

ilGlobalTemplateInterface ilLMNavigationRendererGUI::$main_tpl
protected

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

Referenced by __construct().

◆ $navigation_status

ilLMNavigationStatus ilLMNavigationRendererGUI::$navigation_status
protected

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

◆ $offline

bool ilLMNavigationRendererGUI::$offline
protected

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

◆ $parent_gui

ilLMPresentationGUI ilLMNavigationRendererGUI::$parent_gui
protected

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

Referenced by __construct().

◆ $requested_back_pg

int ilLMNavigationRendererGUI::$requested_back_pg
protected

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

Referenced by __construct().

◆ $requested_frame

string ilLMNavigationRendererGUI::$requested_frame
protected

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

Referenced by __construct().

◆ $requested_obj_id

int ilLMNavigationRendererGUI::$requested_obj_id
protected

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

Referenced by __construct().

◆ $toolbar

ilToolbarGUI ilLMNavigationRendererGUI::$toolbar
protected

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

Referenced by __construct().

◆ $tracker

ilLMTracker ilLMNavigationRendererGUI::$tracker
protected

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

◆ $ui

ILIAS DI UIServices ilLMNavigationRendererGUI::$ui
protected

Definition at line 25 of file class.ilLMNavigationRendererGUI.php.

Referenced by __construct().

◆ $user

ilObjUser ilLMNavigationRendererGUI::$user
protected

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

Referenced by __construct().


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