ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
ilLMNavigationRendererGUI Class Reference
+ Collaboration diagram for ilLMNavigationRendererGUI:

Public Member Functions

 __construct (ilLMPresentationService $service, ilLMPresentationGUI $parent_gui, ilLanguage $lng, ilObjUser $user, ilGlobalPageTemplate $main_tpl, int $requested_obj_id, string $requested_back_pg, string $requested_frame)
 Constructor. More...
 
 renderTop ()
 Render top. More...
 
 renderBottom ()
 Render bottom. More...
 

Protected Member Functions

 render ($top=true)
 Render. More...
 

Protected Attributes

 $user
 
 $current_page
 
 $lm
 
 $lng
 
 $offline
 
 $tracker
 
 $lm_tree
 
 $parent_gui
 
 $lm_set
 
 $main_tpl
 
 $lang
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilLMNavigationRendererGUI::__construct ( ilLMPresentationService  $service,
ilLMPresentationGUI  $parent_gui,
ilLanguage  $lng,
ilObjUser  $user,
ilGlobalPageTemplate  $main_tpl,
int  $requested_obj_id,
string  $requested_back_pg,
string  $requested_frame 
)

Constructor.

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

80 {
81 global $DIC;
82
83 $this->user = $user;
84 $this->lm_tree = $service->getLMTree();
85 $this->current_page = $service->getNavigationStatus()->getCurrentPage();
86 $this->lm = $service->getLearningModule();
87 $this->lm_set = $service->getSettings();
88 $this->lng = $lng;
89 $this->offline = $service->getPresentationStatus()->offline();
90 $this->tracker = $service->getTracker();
91 $this->parent_gui = $parent_gui;
92 $this->chapter_has_no_active_page = $service->getNavigationStatus()->isChapterWithoutActivePage();
93 $this->deactivated_page = $service->getNavigationStatus()->isDeactivatedPage();
94 $this->linker = $service->getLinker();
95
96 $this->requested_obj_id = $requested_obj_id;
97 $back_pg = explode(":", $requested_back_pg);
98 $this->requested_back_pg = (int) $back_pg[0];
99 $this->requested_frame = $requested_frame;
100 $this->main_tpl = $main_tpl;
101 $this->lang = $service->getPresentationStatus()->getLang();
102 }
user()
Definition: user.php:4
$service
Definition: result.php:17
$DIC
Definition: xapitoken.php:46

References $DIC, $lng, $main_tpl, $parent_gui, $service, $user, and user().

+ Here is the call graph for this function:

Member Function Documentation

◆ render()

ilLMNavigationRendererGUI::render (   $top = true)
protected

Render.

Returns
string

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

131 {
133
134 $page_id = $this->current_page;
135
136 $tpl = new ilTemplate("tpl.lm_navigation.html", true, true, "Modules/LearningModule/Presentation");
137
138 if (empty($page_id)) {
139 return "";
140 }
141
142 $back_pg = $this->requested_back_pg;
143 $frame = $this->requested_frame;
144
145 // process navigation for free page
146 if (!$this->lm_tree->isInTree($page_id)) {
147 if ($this->offline || $back_pg == 0) {
148 return "";
149 }
150
151 if (!$this->lm->cleanFrames()) {
152 // @todo 6.0 (move link stuff to separate class)
153 $back_href =
154 $this->linker->getLink(
155 "layout",
156 $back_pg,
157 $frame,
158 "",
159 "reduce"
160 );
161 $back_target = "";
162 } else {
163 $back_href =
164 $this->linker->getLink(
165 "layout",
166 $back_pg,
167 "",
168 "",
169 "reduce"
170 );
171 $back_target = 'target="' . ilFrameTargetInfo::_getFrame("MainContent") . '" ';
172 }
173 $back_img =
174 ilUtil::getImagePath("nav_arr2_L.png", false, "output", $this->offline);
175 $tpl->setCurrentBlock("ilLMNavigation_Prev");
176 $tpl->setVariable("IMG_PREV", $back_img);
177 $tpl->setVariable("HREF_PREV", $back_href);
178 $tpl->setVariable("FRAME_PREV", $back_target);
179 $tpl->setVariable("TXT_PREV", $this->lng->txt("back"));
180 $tpl->setVariable("ALT_PREV", $this->lng->txt("back"));
181 $tpl->setVariable(
182 "PREV_ACC_KEY",
184 );
185 $tpl->setVariable("SPACER_PREV", $this->offline
186 ? "images/spacer.png"
187 : ilUtil::getImagePath("spacer.png"));
188 $tpl->parseCurrentBlock();
189 } else {
190 // determine successor page_id
191 $found = false;
192
193 // empty chapter
194 if ($this->chapter_has_no_active_page &&
195 ilLMObject::_lookupType($this->requested_obj_id) == "st") {
196 $c_id = $this->requested_obj_id;
197 } else {
198 if ($this->deactivated_page) {
199 $c_id = $this->requested_obj_id;
200 } else {
201 $c_id = $page_id;
202 }
203 }
204 while (!$found) {
205 $succ_node = $this->lm_tree->fetchSuccessorNode($c_id, "pg");
206 $c_id = $succ_node["obj_id"];
207
208 $active = ilLMPage::_lookupActive(
209 $c_id,
210 $this->lm->getType(),
211 $this->lm_set->get("time_scheduled_page_activation")
212 );
213
214 if ($succ_node["obj_id"] > 0 &&
215 $ilUser->getId() == ANONYMOUS_USER_ID &&
216 ($this->lm->getPublicAccessMode() == "selected" &&
217 !ilLMObject::_isPagePublic($succ_node["obj_id"]))) {
218 $found = false;
219 } else {
220 if ($succ_node["obj_id"] > 0 && !$active) {
221 // look, whether activation data should be shown
222 $act_data = ilLMPage::_lookupActivationData((int) $succ_node["obj_id"], $this->lm->getType());
223 if ($act_data["show_activation_info"] &&
224 (ilUtil::now() < $act_data["activation_start"])) {
225 $found = true;
226 } else {
227 $found = false;
228 }
229 } else {
230 $found = true;
231 }
232 }
233 }
234
235 // determine predecessor page id
236 $found = false;
237 if ($this->deactivated_page) {
238 $c_id = $this->requested_obj_id;
239 } else {
240 $c_id = $page_id;
241 }
242 while (!$found) {
243 $pre_node = $this->lm_tree->fetchPredecessorNode($c_id, "pg");
244 $c_id = $pre_node["obj_id"];
245 $active = ilLMPage::_lookupActive(
246 $c_id,
247 $this->lm->getType(),
248 $this->lm_set->get("time_scheduled_page_activation")
249 );
250 if ($pre_node["obj_id"] > 0 &&
251 $ilUser->getId() == ANONYMOUS_USER_ID &&
252 ($this->lm->getPublicAccessMode() == "selected" &&
253 !ilLMObject::_isPagePublic($pre_node["obj_id"]))) {
254 $found = false;
255 } else {
256 if ($pre_node["obj_id"] > 0 && !$active) {
257 // look, whether activation data should be shown
258 $act_data = ilLMPage::_lookupActivationData((int) $pre_node["obj_id"], $this->lm->getType());
259 if ($act_data["show_activation_info"] &&
260 (ilUtil::now() < $act_data["activation_start"])) {
261 $found = true;
262 } else {
263 $found = false;
264 }
265 } else {
266 $found = true;
267 }
268 }
269 }
270
271
272 // Determine whether the view of a learning resource should
273 // be shown in the frameset of ilias, or in a separate window.
274 $showViewInFrameset = true;
275
276 if ($pre_node != "") {
277 // get presentation title
279 $pre_node["obj_id"],
280 $this->lm->getPageHeader(),
281 $this->lm->isActiveNumbering(),
282 $this->lm_set->get("time_scheduled_page_activation"),
283 false,
284 0,
285 $this->lang,
286 true
287 );
288 $prev_title = ilUtil::shortenText($prev_title, 50, true);
289 $prev_img =
290 ilUtil::getImagePath("nav_arr_L.png", false, "output", $this->offline);
291
292 if (!$this->lm->cleanFrames()) {
293 $prev_href =
294 $this->linker->getLink(
295 "layout",
296 $pre_node["obj_id"],
297 $this->requested_frame
298 );
299 $prev_target = "";
300 } else {
301 if ($showViewInFrameset && !$this->offline) {
302 $prev_href =
303 $this->linker->getLink("layout", $pre_node["obj_id"]);
304 $prev_target = 'target="' . ilFrameTargetInfo::_getFrame("MainContent") . '" ';
305 } else {
306 $prev_href =
307 $this->linker->getLink("layout", $pre_node["obj_id"]);
308 $prev_target = 'target="_top" ';
309 }
310 }
311
312 $tpl->setCurrentBlock("ilLMNavigation_Prev");
313 $tpl->setVariable("IMG_PREV", $prev_img);
314 $tpl->setVariable("HREF_PREV", $prev_href);
315 $tpl->setVariable("FRAME_PREV", $prev_target);
316 $tpl->setVariable("TXT_PREV", $prev_title);
317 $tpl->setVariable("ALT_PREV", $this->lng->txt("previous"));
318 $tpl->setVariable("SPACER_PREV", $this->offline
319 ? "images/spacer.png"
320 : ilUtil::getImagePath("spacer.png"));
321 $tpl->setVariable(
322 "PREV_ACC_KEY",
324 );
325 }
326 if ($succ_node != "") {
327 // get presentation title
329 $succ_node["obj_id"],
330 $this->lm->getPageHeader(),
331 $this->lm->isActiveNumbering(),
332 $this->lm_set->get("time_scheduled_page_activation"),
333 false,
334 0,
335 $this->lang,
336 true
337 );
338 $succ_title = ilUtil::shortenText($succ_title, 50, true);
339 $succ_img =
340 ilUtil::getImagePath("nav_arr_R.png", false, "output", $this->offline);
341 if (!$this->lm->cleanFrames()) {
342 $succ_href =
343 $this->linker->getLink(
344 "layout",
345 $succ_node["obj_id"],
346 $this->requested_frame
347 );
348 $succ_target = "";
349 } else {
350 if (!$this->offline) {
351 $succ_href =
352 $this->linker->getLink("layout", $succ_node["obj_id"]);
353 $succ_target = ' target="' . ilFrameTargetInfo::_getFrame("MainContent") . '" ';
354 } else {
355 $succ_href =
356 $this->linker->getLink("layout", $succ_node["obj_id"]);
357 $succ_target = ' target="_top" ';
358 }
359 }
360
361 $tpl->setCurrentBlock("ilLMNavigation_Next");
362 $tpl->setVariable("IMG_SUCC", $succ_img);
363 $tpl->setVariable("HREF_SUCC", $succ_href);
364 $tpl->setVariable("FRAME_SUCC", $succ_target);
365 $tpl->setVariable("TXT_SUCC", $succ_title);
366 $tpl->setVariable("ALT_SUCC", $this->lng->txt("next"));
367 $tpl->setVariable("SPACER_SUCC", $this->offline
368 ? "images/spacer.png"
369 : ilUtil::getImagePath("spacer.png"));
370 $tpl->setVariable(
371 "NEXT_ACC_KEY",
373 );
374 $tpl->parseCurrentBlock();
375
376 // check if successor page is not restricted
377 if (!$this->offline) {
378 if ($this->lm->getRestrictForwardNavigation()) {
379 if ($this->tracker->hasPredIncorrectAnswers($succ_node["obj_id"])) {
380 $this->main_tpl->addOnLoadCode("$('.ilc_page_rnav_RightNavigation').addClass('ilNoDisplay');");
381 }
382 }
383 }
384 }
385 }
386
387 $tpl->setVariable("CLASS", ($top) ? "tnav_Top": "bnav_Bottom");
388
389 return $tpl->get();
390 }
static getAttribute($a_func_id)
Get accesskey HTML attribute.
static _getFrame($a_class, $a_type='')
Get content frame name.
static _lookupType($a_obj_id, $a_lm_id=0)
Lookup type.
static _isPagePublic($a_node_id, $a_check_public_mode=false)
static _getPresentationTitle( $a_pg_id, $a_mode=self::CHAPTER_TITLE, $a_include_numbers=false, $a_time_scheduled_activation=false, $a_force_content=false, $a_lm_id=0, $a_lang="-", $a_include_short=false)
presentation title doesn't have to be page title, it may be chapter title + page title or chapter tit...
static _lookupActive($a_id, $a_parent_type, $a_check_scheduled_activation=false, $a_lang="-")
lookup activation status
static _lookupActivationData($a_id, $a_parent_type, $a_lang="-")
Lookup activation data.
special template class to simplify handling of ITX/PEAR
static now()
Return current timestamp in Y-m-d H:i:s format.
static shortenText( $a_str, $a_len, $a_dots=false, $a_next_blank=false, $a_keep_extension=false)
shorten a string to given length.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
if(isset($_FILES['img_file']['size']) && $_FILES['img_file']['size'] > 0) $tpl
$ilUser
Definition: imgupload.php:18

References $current_page, $ilUser, $tpl, $user, ilFrameTargetInfo\_getFrame(), ilLMPageObject\_getPresentationTitle(), ilLMObject\_isPagePublic(), ilPageObject\_lookupActivationData(), ilPageObject\_lookupActive(), ilLMObject\_lookupType(), ilAccessKeyGUI\getAttribute(), ilUtil\getImagePath(), ilAccessKey\NEXT, ilUtil\now(), ilAccessKey\PREVIOUS, and ilUtil\shortenText().

Referenced by renderBottom(), and renderTop().

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

◆ renderBottom()

ilLMNavigationRendererGUI::renderBottom ( )

Render bottom.

Returns
string

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

120 {
121 return $this->render(false);
122 }

References render().

+ Here is the call graph for this function:

◆ renderTop()

ilLMNavigationRendererGUI::renderTop ( )

Render top.

Returns
string

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

110 {
111 return $this->render();
112 }

References render().

+ Here is the call graph for this function:

Field Documentation

◆ $current_page

ilLMNavigationRendererGUI::$current_page
protected

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

Referenced by render().

◆ $lang

ilLMNavigationRendererGUI::$lang
protected

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

◆ $lm

ilLMNavigationRendererGUI::$lm
protected

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

◆ $lm_set

ilLMNavigationRendererGUI::$lm_set
protected

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

◆ $lm_tree

ilLMNavigationRendererGUI::$lm_tree
protected

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

◆ $lng

ilLMNavigationRendererGUI::$lng
protected

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

Referenced by __construct().

◆ $main_tpl

ilLMNavigationRendererGUI::$main_tpl
protected

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

Referenced by __construct().

◆ $offline

ilLMNavigationRendererGUI::$offline
protected

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

◆ $parent_gui

ilLMNavigationRendererGUI::$parent_gui
protected

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

Referenced by __construct().

◆ $tracker

ilLMNavigationRendererGUI::$tracker
protected

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

◆ $user

ilLMNavigationRendererGUI::$user
protected

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

Referenced by __construct(), and render().


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