ILIAS  release_8 Revision v8.24
class.ilLMNavigationRendererGUI.php
Go to the documentation of this file.
1<?php
2
23{
24 protected string $requested_frame;
25 protected int $requested_back_pg;
26 protected int $requested_obj_id;
28 protected bool $deactivated_page;
30 protected ilObjUser $user;
31 protected ?int $current_page;
33 protected ilLanguage $lng;
34 protected bool $offline;
36 protected ilLMTree $lm_tree;
38 protected ilSetting $lm_set;
40 protected string $lang;
42
43 public function __construct(
50 string $requested_back_pg,
51 string $requested_frame
52 ) {
53 $this->user = $user;
54 $this->lm_tree = $service->getLMTree();
55 $this->current_page = $service->getNavigationStatus()->getCurrentPage();
56 $this->lm = $service->getLearningModule();
57 $this->lm_set = $service->getSettings();
58 $this->lng = $lng;
59 $this->offline = $service->getPresentationStatus()->offline();
60 $this->tracker = $service->getTracker();
61 $this->parent_gui = $parent_gui;
62 $this->chapter_has_no_active_page = $service->getNavigationStatus()->isChapterWithoutActivePage();
63 $this->deactivated_page = $service->getNavigationStatus()->isDeactivatedPage();
64 $this->linker = $service->getLinker();
65 $this->navigation_status = $service->getNavigationStatus();
66 $this->requested_obj_id = $requested_obj_id;
67 $back_pg = explode(":", $requested_back_pg);
68 $this->requested_back_pg = (int) $back_pg[0];
69 $this->requested_frame = $requested_frame;
70 $this->main_tpl = $main_tpl;
71 $this->lang = $service->getPresentationStatus()->getLang();
72 }
73
74 public function renderTop(): string
75 {
76 return $this->render();
77 }
78
79 public function renderBottom(): string
80 {
81 return $this->render(false);
82 }
83
84 protected function render(bool $top = true): string
85 {
86 $page_id = $this->current_page;
87
88 $tpl = new ilTemplate("tpl.lm_navigation.html", true, true, "Modules/LearningModule/Presentation");
89
90 if (empty($page_id)) {
91 return "";
92 }
93
94 // process navigation for free page
95 $back_pg = $this->navigation_status->getBackPageId();
96 if ($back_pg > 0) {
97 $back_href =
98 $this->linker->getLink(
99 "layout",
100 $back_pg,
101 "",
102 "",
103 "reduce"
104 );
105 $back_img =
106 ilUtil::getImagePath("nav_arr2_L.png", false, "output", $this->offline);
107 $tpl->setCurrentBlock("ilLMNavigation_Prev");
108 $tpl->setVariable("IMG_PREV", $back_img);
109 $tpl->setVariable("HREF_PREV", $back_href);
110 $tpl->setVariable("TXT_PREV", $this->lng->txt("back"));
111 $tpl->setVariable("ALT_PREV", $this->lng->txt("back"));
112 $tpl->setVariable("SPACER_PREV", $this->offline
113 ? "images/spacer.png"
114 : ilUtil::getImagePath("spacer.png"));
115 $tpl->parseCurrentBlock();
116 } else {
117 $pre_id = $this->navigation_status->getPredecessorPageId();
118 if ($pre_id > 0) {
119 // get presentation title
121 $pre_id,
122 $this->lm->getPageHeader(),
123 $this->lm->isActiveNumbering(),
124 (bool) $this->lm_set->get("time_scheduled_page_activation"),
125 false,
126 0,
127 $this->lang,
128 true
129 );
130 $prev_title = ilStr::shortenTextExtended($prev_title, 50, true);
131 $prev_img =
132 ilUtil::getImagePath("nav_arr_L.png", false, "output", $this->offline);
133
134 if (!$this->lm->cleanFrames()) {
135 $prev_href =
136 $this->linker->getLink(
137 "layout",
138 $pre_id,
139 $this->requested_frame
140 );
141 $prev_target = "";
142 } else {
143 if (!$this->offline) {
144 $prev_href =
145 $this->linker->getLink("layout", $pre_id);
146 $prev_target = 'target="' . ilFrameTargetInfo::_getFrame("MainContent") . '" ';
147 } else {
148 $prev_href =
149 $this->linker->getLink("layout", $pre_id);
150 $prev_target = 'target="_top" ';
151 }
152 }
153
154 $tpl->setCurrentBlock("ilLMNavigation_Prev");
155 $tpl->setVariable("IMG_PREV", $prev_img);
156 $tpl->setVariable("HREF_PREV", $prev_href);
157 $tpl->setVariable("FRAME_PREV", $prev_target);
158 $tpl->setVariable("TXT_PREV", $prev_title);
159 $tpl->setVariable("ALT_PREV", $this->lng->txt("previous"));
160 $tpl->setVariable("SPACER_PREV", $this->offline
161 ? "images/spacer.png"
162 : ilUtil::getImagePath("spacer.png"));
163 }
164
165 $succ_id = $this->navigation_status->getSuccessorPageId();
166 if ($succ_id > 0) {
167 // get presentation title
169 $succ_id,
170 $this->lm->getPageHeader(),
171 $this->lm->isActiveNumbering(),
172 (bool) $this->lm_set->get("time_scheduled_page_activation"),
173 false,
174 0,
175 $this->lang,
176 true
177 );
178 $succ_title = ilStr::shortenTextExtended($succ_title, 50, true);
179 $succ_img =
180 ilUtil::getImagePath("nav_arr_R.png", false, "output", $this->offline);
181 if (!$this->lm->cleanFrames()) {
182 $succ_href =
183 $this->linker->getLink(
184 "layout",
185 $succ_id,
186 $this->requested_frame
187 );
188 $succ_target = "";
189 } else {
190 if (!$this->offline) {
191 $succ_href =
192 $this->linker->getLink("layout", $succ_id);
193 $succ_target = ' target="' . ilFrameTargetInfo::_getFrame("MainContent") . '" ';
194 } else {
195 $succ_href =
196 $this->linker->getLink("layout", $succ_id);
197 $succ_target = ' target="_top" ';
198 }
199 }
200
201 $tpl->setCurrentBlock("ilLMNavigation_Next");
202 $tpl->setVariable("IMG_SUCC", $succ_img);
203 $tpl->setVariable("HREF_SUCC", $succ_href);
204 $tpl->setVariable("FRAME_SUCC", $succ_target);
205 $tpl->setVariable("TXT_SUCC", $succ_title);
206 $tpl->setVariable("ALT_SUCC", $this->lng->txt("next"));
207 $tpl->setVariable("SPACER_SUCC", $this->offline
208 ? "images/spacer.png"
209 : ilUtil::getImagePath("spacer.png"));
210 $tpl->parseCurrentBlock();
211
212 // check if successor page is not restricted
213 if (!$this->offline) {
214 if ($this->lm->getRestrictForwardNavigation()) {
215 if ($this->tracker->hasPredIncorrectAnswers($succ_id)) {
216 $this->main_tpl->addOnLoadCode("$('.ilc_page_rnav_RightNavigation').addClass('ilNoDisplay');");
217 }
218 }
219 }
220 }
221 }
222
223 $tpl->setVariable("CLASS", ($top) ? "tnav_Top" : "bnav_Bottom");
224
225 return $tpl->get();
226 }
227}
static _getFrame(string $a_class)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
__construct(ilLMPresentationService $service, ilLMPresentationGUI $parent_gui, ilLanguage $lng, ilObjUser $user, ilGlobalTemplateInterface $main_tpl, int $requested_obj_id, string $requested_back_pg, string $requested_frame)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
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...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Main service init and factory.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
language handling
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
User class.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
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 $img, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
if($DIC->http() ->request() ->getMethod()=="GET" &&isset($DIC->http() ->request() ->getQueryParams()['tex'])) $tpl
Definition: latex.php:41
$service
Definition: ltiservices.php:43