ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilLMContentRendererGUI Class Reference
+ Collaboration diagram for ilLMContentRendererGUI:

Public Member Functions

 __construct (ilLMPresentationService $service, ilLMPresentationGUI $parent_gui, ilLanguage $lng, Translations $translation, ilCtrl $ctrl, ilAccessHandler $access, ilObjUser $user, ilHelpGUI $help, int $requested_obj_id)
 
 render (int $a_head_foot_page_id=0)
 
 getLMPageGUI (int $a_id)
 
 handleCodeParagraph (int $page_id, int $paragraph_id, string $title, string $text)
 
 renderPreconditionsOfPage ()
 Render preconditions of the page. More...
 

Data Fields

const STATUS_ACCESS = 0
 
const STATUS_NO_ACCESS = 1
 
const STATUS_NO_PUBLIC_ACCESS = 2
 
const STATUS_FAILED_PRECONDITIONS = 3
 
const STATUS_CORRECT_ANSWER_MISSING = 4
 
const STATUS_NO_PAGE_IN_CHAPTER = 5
 
const STATUS_DEACTIVATED_PAGE = 6
 
const STATUS_NO_PAGE_FOUND = 7
 

Protected Member Functions

 initHelp ()
 
 determineStatus ()
 
 initSearchHighlighting ()
 
 renderFocusMessage ()
 
 renderNoPageAccess ()
 Render info message, if page is not accessible in public area. More...
 
 renderMessageScreen (string $a_content)
 Render message screen. More...
 
 renderNoPublicAccess ()
 Render info message, if page is not accessible in public area. More...
 
 renderNavRestrictionDueToQuestions ()
 Render message if navigation to page is not allowed due to unanswered questions. More...
 
 renderNoPageInChapterMessage ()
 Render no page in chapter message. More...
 
 renderNoPageFoundMessage ()
 Render no page found message. More...
 
 renderDeactivatedPageMessage ()
 

Protected Attributes

ilLMNavigationStatus $navigation_status
 
int $requested_focus_return
 
int $requested_obj_id = 0
 
string $search_string
 
int $focus_id
 
bool $deactivated_page
 
bool $chapter_has_no_active_page
 
ilAccessHandler $access
 
ilObjUser $user
 
ilHelpGUI $help
 
int $current_page = null
 
ilObjLearningModule $lm
 
ilLanguage $lng
 
bool $offline
 
ilLMTracker $tracker
 
ilCtrl $ctrl
 
ilLMTree $lm_tree
 
ilLMPresentationGUI $parent_gui
 
ilSetting $lm_set
 
string $lang
 
ilLMPresentationLinker $linker
 
string $requested_frame
 
Translations $ot
 
string $concrete_lang = ""
 

Detailed Description

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

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

Constructor & Destructor Documentation

◆ __construct()

ilLMContentRendererGUI::__construct ( ilLMPresentationService  $service,
ilLMPresentationGUI  $parent_gui,
ilLanguage  $lng,
Translations  $translation,
ilCtrl  $ctrl,
ilAccessHandler  $access,
ilObjUser  $user,
ilHelpGUI  $help,
int  $requested_obj_id 
)

Definition at line 60 of file class.ilLMContentRendererGUI.php.

70 {
71 $this->access = $access;
72 $this->user = $user;
73 $this->help = $help;
74 $this->ctrl = $ctrl;
75 $this->lm_tree = $service->getLMTree();
76 $this->lang = $service->getPresentationStatus()->getLang();
77 $this->ot = $translation;
78 $this->current_page = $service->getNavigationStatus()->getCurrentPage();
79 $this->lm = $service->getLearningModule();
80 $this->lm_set = $service->getSettings();
81 $this->lng = $lng;
82 $this->offline = $service->getPresentationStatus()->offline;
83 $this->tracker = $service->getTracker();
84 $this->linker = $service->getLinker();
85 $this->parent_gui = $parent_gui;
86 $this->chapter_has_no_active_page = $service->getNavigationStatus()->isChapterWithoutActivePage();
87 $this->deactivated_page = $service->getNavigationStatus()->isDeactivatedPage();
88 $this->focus_id = $service->getPresentationStatus()->getFocusId();
89 $this->concrete_lang = $service->getPresentationStatus()->getConcreteLang();
90 $this->search_string = $service->getPresentationStatus()->getSearchString();
91 $this->requested_obj_id = $requested_obj_id;
92 $this->requested_focus_return = $service->getPresentationStatus()->getFocusReturn();
93 $this->requested_frame = $service->getRequest()->getFrame();
94 $this->navigation_status = $service->getNavigationStatus();
95 }
$service
Definition: ltiresult.php:36

References $access, $ctrl, $help, $lng, $parent_gui, $requested_obj_id, $service, $user, ILIAS\Repository\access(), ILIAS\Repository\ctrl(), ILIAS\Repository\help(), ILIAS\Repository\lng(), and ILIAS\Repository\user().

+ Here is the call graph for this function:

Member Function Documentation

◆ determineStatus()

ilLMContentRendererGUI::determineStatus ( )
protected

Definition at line 105 of file class.ilLMContentRendererGUI.php.

105 : int
106 {
108
109 $status = self::STATUS_ACCESS;
110 // check page id
111 $requested_page_lm = ilLMPage::lookupParentId($this->current_page, "lm");
112 if ($requested_page_lm != $this->lm->getId()) {
113 $status = self::STATUS_NO_ACCESS;
114 }
115
116 // preconditions
117 if (!ilObjContentObject::_checkPreconditionsOfPage($this->lm->getRefId(), $this->lm->getId(), $this->current_page) && !
118 $this->access->checkAccess("write", "", $this->lm->getRefId())) {
120 }
121
122 // if navigation is restricted based on correct answered questions
123 // check if we have preceeding pages including unsanswered/incorrect answered questions
124 if (!$this->offline) {
125 if ($this->lm->getRestrictForwardNavigation()) {
126 if ($this->tracker->hasPredIncorrectAnswers($this->current_page)) {
128 }
129 }
130 }
131
132 // no active page found in chapter
133 if ($this->chapter_has_no_active_page &&
134 ilLMObject::_lookupType($this->requested_obj_id) == "st") {
136 }
137
138 if ($this->deactivated_page) {
140 }
141
142 if ($this->current_page == 0) {
144 }
145 return $status;
146 }
static _lookupType(int $a_obj_id, int $a_lm_id=0)
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 lookupParentId(int $a_id, string $a_type)

References $user, ilObjContentObject\_checkPreconditionsOfPage(), ilLMObject\_lookupType(), ilPageObject\lookupParentId(), STATUS_ACCESS, STATUS_CORRECT_ANSWER_MISSING, STATUS_DEACTIVATED_PAGE, STATUS_FAILED_PRECONDITIONS, STATUS_NO_ACCESS, STATUS_NO_PAGE_FOUND, and STATUS_NO_PAGE_IN_CHAPTER.

+ Here is the call graph for this function:

◆ getLMPageGUI()

ilLMContentRendererGUI::getLMPageGUI ( int  $a_id)

Definition at line 292 of file class.ilLMContentRendererGUI.php.

293 {
294 if ($this->lang != "-" && ilPageObject::_exists("lm", $a_id, $this->lang)) {
295 $page_gui = new ilLMPageGUI($a_id, 0, false, $this->lang, $this->concrete_lang);
296 } else {
297 if ($this->lang != "-" && ilPageObject::_exists("lm", $a_id, $this->ot->getDefaultLanguage())) {
298 $page_gui = new ilLMPageGUI($a_id, 0, false, $this->ot->getDefaultLanguage(), $this->concrete_lang);
299 } else {
300 $page_gui = new ilLMPageGUI($a_id, 0, false, "", $this->concrete_lang);
301 }
302 }
303 if ($this->offline) {
304 $page_gui->setOutputMode(ilPageObjectGUI::OFFLINE);
305 }
306 return $page_gui;
307 }
Extension of ilPageObjectGUI for learning modules.
static _exists(string $a_parent_type, int $a_id, string $a_lang="", bool $a_no_cache=false)
Checks whether page exists.

References ilPageObject\_exists(), and ilPageObjectGUI\OFFLINE.

+ Here is the call graph for this function:

◆ handleCodeParagraph()

ilLMContentRendererGUI::handleCodeParagraph ( int  $page_id,
int  $paragraph_id,
string  $title,
string  $text 
)

Definition at line 309 of file class.ilLMContentRendererGUI.php.

314 : void {
315 $directory = $this->parent_gui->getOfflineDirectory() . "/codefiles/" . $page_id . "/" . $paragraph_id;
316 ilFileUtils::makeDirParents($directory);
317 $file = $directory . "/" . $title;
318 if (!($fp = fopen($file, "w+"))) {
319 die("<strong>Error</strong>: Could not open \"" . $file . "\" for writing" .
320 " in <strong>" . __FILE__ . "</strong> on line <strong>" . __LINE__ . "</strong><br />");
321 }
322 chmod($file, 0770);
323 fwrite($fp, $text);
324 fclose($fp);
325 }
static makeDirParents(string $a_dir)
Create a new directory and all parent directories.

◆ initHelp()

ilLMContentRendererGUI::initHelp ( )
protected

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

97 : void
98 {
99 $ilHelp = $this->help;
100 $ilHelp->setScreenIdComponent("lm");
101 $ilHelp->setScreenId("content");
102 $ilHelp->setSubScreenId("content");
103 }
setScreenIdComponent(string $a_comp)

References $help, and ilHelpGUI\setScreenIdComponent().

+ Here is the call graph for this function:

◆ initSearchHighlighting()

ilLMContentRendererGUI::initSearchHighlighting ( )
protected

Definition at line 148 of file class.ilLMContentRendererGUI.php.

148 : void
149 {
151
152 if ($this->search_string != "" && !$this->offline) {
154 $cache->switchSearchType(ilUserSearchCache::LAST_QUERY);
155 $search_string = $cache->getQuery();
156
157 // advanced search?
158 if (is_array($search_string)) {
159 $search_string = $search_string["lom_content"];
160 }
161
163 $p->parse();
164
165 $words = $p->getQuotedWords();
166 if (is_array($words)) {
167 foreach ($words as $w) {
168 ilTextHighlighterGUI::highlight("ilLMPageContent", $w);
169 }
170 }
171 }
172 }
static _getInstance(int $a_usr_id)

References $search_string, $user, ilUserSearchCache\_getInstance(), ilObject\getId(), and ilUserSearchCache\LAST_QUERY.

+ Here is the call graph for this function:

◆ render()

ilLMContentRendererGUI::render ( int  $a_head_foot_page_id = 0)

Definition at line 174 of file class.ilLMContentRendererGUI.php.

176 : string {
177 $ilUser = $this->user;
178
179 $head = $foot = "";
180
181 $this->initHelp();
182
183 switch ($this->determineStatus()) {
185 return $this->renderNoPageAccess();
186
188 return $this->renderNoPublicAccess();
189
191 return $this->renderPreconditionsOfPage();
192
195
197 return $this->renderNoPageInChapterMessage();
198
200 return $this->renderDeactivatedPageMessage();
201
203 return $this->renderNoPageFoundMessage();
204 }
205
206 // page id is e.g. > 0 when footer or header page is processed
207 if ($a_head_foot_page_id == 0) {
208 $page_id = $this->current_page;
209 $this->initSearchHighlighting();
210 } else {
211 $page_id = $a_head_foot_page_id;
212 }
213
214 // check if page is out of focus
215 $focus_mess = $this->renderFocusMessage();
216 $page_object_gui = $this->getLMPageGUI($page_id);
217
218 // @todo 6.0 (factor this out (maybe to ilLMPageGUI)
219 $this->parent_gui->basicPageGuiInit($page_object_gui);
220
221 $page_object = $page_object_gui->getPageObject();
222 $page_object->buildDom();
223 $page_object->registerOfflineHandler($this);
224
225 $page_object_gui->setTemplateOutput(false);
226
227 // Update course items
228 ilCourseLMHistory::_updateLastAccess($ilUser->getId(), $this->lm->getRefId(), $page_id);
229
230 // read link targets
231 $page_object_gui->setPageLinker($this->linker);
232
233 // get lm page object
234 $lm_pg_obj = new ilLMPageObject($this->lm, $page_id);
235 $lm_pg_obj->setLMId($this->lm->getId());
236
237 // determine target frames for internal links
238 $page_object_gui->setLinkFrame($this->requested_frame);
239
240 // page title and tracking (not for header or footer page)
241 if ($page_id == 0 || ($page_id != $this->lm->getHeaderPage() &&
242 $page_id != $this->lm->getFooterPage())) {
243 $page_object_gui->setPresentationTitle(
245 $lm_pg_obj->getId(),
246 $this->lm->getPageHeader(),
247 $this->lm->isActiveNumbering(),
248 (bool) $this->lm_set->get("time_scheduled_page_activation"),
249 false,
250 0,
251 $this->lang
252 )
253 );
254
255 // track access
256 if ($page_id != 0 && !$this->offline) {
257 $this->tracker->trackAccess($page_id, $ilUser->getId());
258 }
259 } else {
260 $page_object_gui->setEnabledPageFocus(false);
261 $page_object_gui->getPageConfig()->setEnableSelfAssessment(false);
262 }
263
264 // ADDED FOR CITATION
265 $page_object_gui->setLinkParams("ref_id=" . $this->lm->getRefId());
266 $page_object_gui->setTemplateTargetVar("PAGE_CONTENT");
267 // @todo 6.0
268 // $page_object_gui->setSourcecodeDownloadScript($this->getSourcecodeDownloadLink());
269
270 $ret = $page_object_gui->presentation($page_object_gui->getOutputMode());
271
272 // process header
273 if ($this->lm->getHeaderPage() > 0 &&
274 $page_id != $this->lm->getHeaderPage() &&
275 ($page_id == 0 || $page_id != $this->lm->getFooterPage())) {
276 if (ilLMObject::_exists($this->lm->getHeaderPage())) {
277 $head = $this->render($this->lm->getHeaderPage());
278 }
279 }
280
281 // process footer
282 if ($this->lm->getFooterPage() > 0 &&
283 $page_id != $this->lm->getFooterPage() &&
284 ($page_id == 0 || $page_id != $this->lm->getHeaderPage())) {
285 if (ilLMObject::_exists($this->lm->getFooterPage())) {
286 $foot = $this->render($this->lm->getFooterPage());
287 }
288 }
289 return $head . $focus_mess . $ret . $foot;
290 }
static _updateLastAccess(int $a_user_id, int $a_lm_ref_id, int $a_page_id)
renderNavRestrictionDueToQuestions()
Render message if navigation to page is not allowed due to unanswered questions.
renderNoPageFoundMessage()
Render no page found message.
renderNoPageInChapterMessage()
Render no page in chapter message.
renderPreconditionsOfPage()
Render preconditions of the page.
renderNoPublicAccess()
Render info message, if page is not accessible in public area.
render(int $a_head_foot_page_id=0)
renderNoPageAccess()
Render info message, if page is not accessible in public area.
static _exists(int $a_id)
checks wether a lm content object with specified id exists or not
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...

◆ renderDeactivatedPageMessage()

ilLMContentRendererGUI::renderDeactivatedPageMessage ( )
protected

Definition at line 461 of file class.ilLMContentRendererGUI.php.

461 : string
462 {
463 $mtpl = new ilTemplate(
464 "tpl.no_content_message.html",
465 true,
466 true,
467 "components/ILIAS/LearningModule"
468 );
469 $m = $this->lng->txt("cont_page_currently_deactivated");
470 $act_data = ilLMPage::_lookupActivationData($this->current_page, $this->lm->getType());
471 if ($act_data["show_activation_info"] &&
472 (ilUtil::now() < $act_data["activation_start"])) {
473 $m .= "<p>" . sprintf(
474 $this->lng->txt("cont_page_activation_on"),
476 new ilDateTime($act_data["activation_start"], IL_CAL_DATETIME)
477 )
478 ) .
479 "</p>";
480 }
481 $mtpl->setVariable("MESSAGE", $m);
482 $mtpl->setVariable(
483 "ITEM_TITLE",
484 ilLMObject::_lookupTitle($this->current_page)
485 );
486 return $mtpl->get();
487 }
const IL_CAL_DATETIME
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false, ?ilObjUser $user=null,)
@classDescription Date and time handling
static _lookupTitle(int $a_obj_id)
static _lookupActivationData(int $a_id, string $a_parent_type, string $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.

References ilPageObject\_lookupActivationData(), ilLMObject\_lookupTitle(), ilDatePresentation\formatDate(), IL_CAL_DATETIME, ILIAS\Repository\lng(), and ilUtil\now().

+ Here is the call graph for this function:

◆ renderFocusMessage()

ilLMContentRendererGUI::renderFocusMessage ( )
protected

Definition at line 327 of file class.ilLMContentRendererGUI.php.

327 : string
328 {
329 $focus_mess = "";
330 if ($this->focus_id > 0) {
331 $path = $this->lm_tree->getPathId($this->current_page);
332
333 // out of focus
334 if (!in_array($this->focus_id, $path)) {
335 $mtpl = new ilTemplate(
336 "tpl.out_of_focus_message.html",
337 true,
338 true,
339 "components/ILIAS/LearningModule"
340 );
341 $mtpl->setVariable("MESSAGE", $this->lng->txt("cont_out_of_focus_message"));
342 $mtpl->setVariable("TXT_SHOW_CONTENT", $this->lng->txt("cont_show_content_after_focus"));
343
344 if ($this->requested_focus_return == 0 || ilObject::_lookupType((int) $this->requested_focus_return, true) != "crs") {
345 $mtpl->setVariable("TXT_BACK_BEGINNING", $this->lng->txt("cont_to_focus_beginning"));
346 $this->ctrl->setParameter($this->parent_gui, "obj_id", $this->focus_id);
347 $mtpl->setVariable("LINK_BACK_TO_BEGINNING", $this->ctrl->getLinkTarget($this->parent_gui, "layout"));
348 $this->ctrl->setParameter($this->parent_gui, "obj_id", $this->requested_obj_id);
349 } else {
350 $mtpl->setVariable("TXT_BACK_BEGINNING", $this->lng->txt("cont_to_focus_return_crs"));
351 $mtpl->setVariable("LINK_BACK_TO_BEGINNING", ilLink::_getLink($this->requested_focus_return));
352 }
353
354 $this->ctrl->setParameter($this->parent_gui, "focus_id", null);
355 $mtpl->setVariable("LINK_SHOW_CONTENT", $this->ctrl->getLinkTarget($this->parent_gui, "layout"));
356 $this->ctrl->setParameter($this->parent_gui, "focus_id", $this->requested_obj_id);
357
358 $focus_mess = $mtpl->get();
359 } else {
360 $succ_page_id = $this->navigation_status->getSuccessorPageId();
361 $path2 = array();
362 if ($succ_page_id > 0) {
363 $path2 = $this->lm_tree->getPathId($succ_page_id);
364 }
365 if ($succ_page_id == 0 || !in_array($this->focus_id, $path2)) {
366 $mtpl = new ilTemplate(
367 "tpl.out_of_focus_message.html",
368 true,
369 true,
370 "components/ILIAS/LearningModule"
371 );
372 $mtpl->setVariable("MESSAGE", $this->lng->txt("cont_out_of_focus_message_last_page"));
373 $mtpl->setVariable("TXT_SHOW_CONTENT", $this->lng->txt("cont_show_content_after_focus"));
374
375 if ($this->requested_focus_return == 0 || ilObject::_lookupType($this->requested_focus_return, true) != "crs") {
376 $mtpl->setVariable("TXT_BACK_BEGINNING", $this->lng->txt("cont_to_focus_beginning"));
377 $this->ctrl->setParameter($this->parent_gui, "obj_id", $this->focus_id);
378 $mtpl->setVariable("LINK_BACK_TO_BEGINNING", $this->ctrl->getLinkTarget($this->parent_gui, "layout"));
379 $this->ctrl->setParameter($this->parent_gui, "obj_id", $this->requested_obj_id);
380 } else {
381 $mtpl->setVariable("TXT_BACK_BEGINNING", $this->lng->txt("cont_to_focus_return_crs"));
382 $mtpl->setVariable("LINK_BACK_TO_BEGINNING", ilLink::_getLink($this->requested_focus_return));
383 }
384
385 $this->ctrl->setParameter($this->parent_gui, "focus_id", null);
386 $mtpl->setVariable("LINK_SHOW_CONTENT", $this->ctrl->getLinkTarget($this->parent_gui, "layout"));
387 $this->ctrl->setParameter($this->parent_gui, "focus_id", $this->requested_obj_id);
388
389 $focus_mess = $mtpl->get();
390 }
391 }
392 }
393 return $focus_mess;
394 }
static _lookupType(int $id, bool $reference=false)
$path
Definition: ltiservices.php:30

References $path, ilObject\_lookupType(), ILIAS\Repository\ctrl(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ renderMessageScreen()

ilLMContentRendererGUI::renderMessageScreen ( string  $a_content)
protected

Render message screen.

Definition at line 408 of file class.ilLMContentRendererGUI.php.

408 : string
409 {
410 // content style
411 $tpl = new ilTemplate("tpl.page_message_screen.html", true, true, "components/ILIAS/LearningModule");
412 $tpl->setVariable("TXT_PAGE_NO_PUBLIC_ACCESS", $a_content);
413
414 return $tpl->get();
415 }

◆ renderNavRestrictionDueToQuestions()

ilLMContentRendererGUI::renderNavRestrictionDueToQuestions ( )
protected

Render message if navigation to page is not allowed due to unanswered questions.

Definition at line 429 of file class.ilLMContentRendererGUI.php.

429 : string
430 {
431 return $this->renderMessageScreen($this->lng->txt("cont_no_page_access_unansw_q"));
432 }
renderMessageScreen(string $a_content)
Render message screen.

References ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ renderNoPageAccess()

ilLMContentRendererGUI::renderNoPageAccess ( )
protected

Render info message, if page is not accessible in public area.

Definition at line 400 of file class.ilLMContentRendererGUI.php.

400 : string
401 {
402 return $this->renderMessageScreen($this->lng->txt("msg_no_page_access"));
403 }

References ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ renderNoPageFoundMessage()

ilLMContentRendererGUI::renderNoPageFoundMessage ( )
protected

Render no page found message.

Definition at line 456 of file class.ilLMContentRendererGUI.php.

456 : string
457 {
458 return $this->renderMessageScreen($this->lng->txt("cont_no_page"));
459 }

References ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ renderNoPageInChapterMessage()

ilLMContentRendererGUI::renderNoPageInChapterMessage ( )
protected

Render no page in chapter message.

Definition at line 437 of file class.ilLMContentRendererGUI.php.

437 : string
438 {
439 $mtpl = new ilTemplate(
440 "tpl.no_content_message.html",
441 true,
442 true,
443 "components/ILIAS/LearningModule"
444 );
445 $mtpl->setVariable("MESSAGE", $this->lng->txt("cont_no_page_in_chapter"));
446 $mtpl->setVariable(
447 "ITEM_TITLE",
448 ilLMObject::_lookupTitle($this->requested_obj_id)
449 );
450 return $mtpl->get();
451 }

References ilLMObject\_lookupTitle(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ renderNoPublicAccess()

ilLMContentRendererGUI::renderNoPublicAccess ( )
protected

Render info message, if page is not accessible in public area.

Definition at line 420 of file class.ilLMContentRendererGUI.php.

420 : string
421 {
422 return $this->renderMessageScreen($this->lng->txt("msg_page_no_public_access"));
423 }

References ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ renderPreconditionsOfPage()

ilLMContentRendererGUI::renderPreconditionsOfPage ( )

Render preconditions of the page.

Definition at line 493 of file class.ilLMContentRendererGUI.php.

493 : string
494 {
495 $succ_node = "";
496 $conds = ilObjContentObject::_getMissingPreconditionsOfPage($this->lm->getRefId(), $this->lm->getId(), $this->current_page);
497 $topchap = ilObjContentObject::_getMissingPreconditionsTopChapter($this->lm->getRefId(), $this->lm->getId(), $this->current_page);
498
499 $ptpl = new ilTemplate("tpl.page_preconditions.html", true, true, "components/ILIAS/LearningModule");
500
501 // list all missing preconditions
502 foreach ($conds as $cond) {
503 $obj_link = ilLink::_getLink($cond["trigger_ref_id"]);
504 $ptpl->setCurrentBlock("condition");
505 $ptpl->setVariable("VAL_ITEM", ilObject::_lookupTitle($cond["trigger_obj_id"]));
506 $ptpl->setVariable("LINK_ITEM", $obj_link);
507 if ($cond["operator"] == "passed") {
508 $cond_str = $this->lng->txt("passed");
509 } else {
510 $cond_str = $this->lng->txt("condition_" . $cond["operator"]);
511 }
512 $ptpl->setVariable("VAL_CONDITION", $cond_str . " " . $cond["value"]);
513 $ptpl->parseCurrentBlock();
514 }
515
516 $ptpl->setVariable(
517 "TXT_MISSING_PRECONDITIONS",
518 sprintf(
519 $this->lng->txt("cont_missing_preconditions"),
521 )
522 );
523 $ptpl->setVariable("TXT_ITEM", $this->lng->txt("object"));
524 $ptpl->setVariable("TXT_CONDITION", $this->lng->txt("condition"));
525
526 // output skip chapter link
527 $parent = $this->lm_tree->getParentId($topchap);
528 $childs = $this->lm_tree->getChildsByType($parent, "st");
529 $j = -2;
530 $i = 1;
531 foreach ($childs as $child) {
532 if ($child["child"] == $topchap) {
533 $j = $i;
534 }
535 if ($i++ == ($j + 1)) {
536 $succ_node = $this->lm_tree->fetchSuccessorNode($child["child"], "pg");
537 }
538 }
539 if ($succ_node != "") {
540 $link = "<br /><a href=\"" .
541 $this->linker->getLink("layout", $succ_node["obj_id"], $this->requested_frame) .
542 "\">" . $this->lng->txt("cont_skip_chapter") . "</a>";
543 $ptpl->setVariable("LINK_SKIP_CHAPTER", $link);
544 }
545
546 return $ptpl->get();
547 }
static _getMissingPreconditionsTopChapter(int $cont_obj_ref_id, int $cont_obj_id, int $page_id)
get top chapter of page for that any precondition is missing
static _getMissingPreconditionsOfPage(int $cont_ref_id, int $cont_obj_id, int $page_id)
gets all missing preconditions of page
static _lookupTitle(int $obj_id)

References ilObjContentObject\_getMissingPreconditionsOfPage(), ilObjContentObject\_getMissingPreconditionsTopChapter(), ilLMObject\_lookupTitle(), ilObject\_lookupTitle(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

Field Documentation

◆ $access

ilAccessHandler ilLMContentRendererGUI::$access
protected

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

Referenced by __construct().

◆ $chapter_has_no_active_page

bool ilLMContentRendererGUI::$chapter_has_no_active_page
protected

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

◆ $concrete_lang

string ilLMContentRendererGUI::$concrete_lang = ""
protected

Definition at line 58 of file class.ilLMContentRendererGUI.php.

◆ $ctrl

ilCtrl ilLMContentRendererGUI::$ctrl
protected

Definition at line 50 of file class.ilLMContentRendererGUI.php.

Referenced by __construct().

◆ $current_page

int ilLMContentRendererGUI::$current_page = null
protected

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

◆ $deactivated_page

bool ilLMContentRendererGUI::$deactivated_page
protected

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

◆ $focus_id

int ilLMContentRendererGUI::$focus_id
protected

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

◆ $help

ilHelpGUI ilLMContentRendererGUI::$help
protected

Definition at line 44 of file class.ilLMContentRendererGUI.php.

Referenced by __construct(), and initHelp().

◆ $lang

string ilLMContentRendererGUI::$lang
protected

Definition at line 54 of file class.ilLMContentRendererGUI.php.

◆ $linker

ilLMPresentationLinker ilLMContentRendererGUI::$linker
protected

Definition at line 55 of file class.ilLMContentRendererGUI.php.

◆ $lm

ilObjLearningModule ilLMContentRendererGUI::$lm
protected

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

◆ $lm_set

ilSetting ilLMContentRendererGUI::$lm_set
protected

Definition at line 53 of file class.ilLMContentRendererGUI.php.

◆ $lm_tree

ilLMTree ilLMContentRendererGUI::$lm_tree
protected

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

◆ $lng

ilLanguage ilLMContentRendererGUI::$lng
protected

Definition at line 47 of file class.ilLMContentRendererGUI.php.

Referenced by __construct().

◆ $navigation_status

ilLMNavigationStatus ilLMContentRendererGUI::$navigation_status
protected

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

◆ $offline

bool ilLMContentRendererGUI::$offline
protected

Definition at line 48 of file class.ilLMContentRendererGUI.php.

◆ $ot

Translations ilLMContentRendererGUI::$ot
protected

Definition at line 57 of file class.ilLMContentRendererGUI.php.

◆ $parent_gui

ilLMPresentationGUI ilLMContentRendererGUI::$parent_gui
protected

Definition at line 52 of file class.ilLMContentRendererGUI.php.

Referenced by __construct().

◆ $requested_focus_return

int ilLMContentRendererGUI::$requested_focus_return
protected

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

◆ $requested_frame

string ilLMContentRendererGUI::$requested_frame
protected

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

◆ $requested_obj_id

int ilLMContentRendererGUI::$requested_obj_id = 0
protected

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

Referenced by __construct().

◆ $search_string

string ilLMContentRendererGUI::$search_string
protected

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

Referenced by initSearchHighlighting().

◆ $tracker

ilLMTracker ilLMContentRendererGUI::$tracker
protected

Definition at line 49 of file class.ilLMContentRendererGUI.php.

◆ $user

ilObjUser ilLMContentRendererGUI::$user
protected

◆ STATUS_ACCESS

const ilLMContentRendererGUI::STATUS_ACCESS = 0

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

Referenced by determineStatus().

◆ STATUS_CORRECT_ANSWER_MISSING

const ilLMContentRendererGUI::STATUS_CORRECT_ANSWER_MISSING = 4

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

Referenced by determineStatus().

◆ STATUS_DEACTIVATED_PAGE

const ilLMContentRendererGUI::STATUS_DEACTIVATED_PAGE = 6

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

Referenced by determineStatus().

◆ STATUS_FAILED_PRECONDITIONS

const ilLMContentRendererGUI::STATUS_FAILED_PRECONDITIONS = 3

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

Referenced by determineStatus().

◆ STATUS_NO_ACCESS

const ilLMContentRendererGUI::STATUS_NO_ACCESS = 1

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

Referenced by determineStatus().

◆ STATUS_NO_PAGE_FOUND

const ilLMContentRendererGUI::STATUS_NO_PAGE_FOUND = 7

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

Referenced by determineStatus().

◆ STATUS_NO_PAGE_IN_CHAPTER

const ilLMContentRendererGUI::STATUS_NO_PAGE_IN_CHAPTER = 5

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

Referenced by determineStatus().

◆ STATUS_NO_PUBLIC_ACCESS

const ilLMContentRendererGUI::STATUS_NO_PUBLIC_ACCESS = 2

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


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