82 $this->chapter_has_no_active_page = $service->
getNavigationStatus()->isChapterWithoutActivePage();
89 $this->requested_frame = $service->
getRequest()->getFrame();
98 $ilHelp->setScreenId(
"content");
99 $ilHelp->setSubScreenId(
"content");
106 $status = self::STATUS_ACCESS;
109 if ($requested_page_lm != $this->lm->getId()) {
110 $status = self::STATUS_NO_ACCESS;
115 $status = self::STATUS_FAILED_PRECONDITIONS;
120 if (!$this->offline) {
121 if ($this->lm->getRestrictForwardNavigation()) {
122 if ($this->tracker->hasPredIncorrectAnswers($this->current_page)) {
123 $status = self::STATUS_CORRECT_ANSWER_MISSING;
129 if ($this->chapter_has_no_active_page &&
131 $status = self::STATUS_NO_PAGE_IN_CHAPTER;
134 if ($this->deactivated_page) {
135 $status = self::STATUS_DEACTIVATED_PAGE;
138 if ($this->current_page == 0) {
139 $status = self::STATUS_NO_PAGE_FOUND;
148 if ($this->search_string !=
"" && !$this->offline) {
151 $search_string = $cache->getQuery();
154 if (is_array($search_string)) {
155 $search_string = $search_string[
"lom_content"];
161 $words = $p->getQuotedWords();
162 if (is_array($words)) {
163 foreach ($words as $w) {
164 ilTextHighlighterGUI::highlight(
"ilLMPageContent", $w);
171 int $a_head_foot_page_id = 0
180 case self::STATUS_NO_ACCESS:
183 case self::STATUS_NO_PUBLIC_ACCESS:
186 case self::STATUS_FAILED_PRECONDITIONS:
189 case self::STATUS_CORRECT_ANSWER_MISSING:
192 case self::STATUS_NO_PAGE_IN_CHAPTER:
195 case self::STATUS_DEACTIVATED_PAGE:
198 case self::STATUS_NO_PAGE_FOUND:
203 if ($a_head_foot_page_id == 0) {
207 $page_id = $a_head_foot_page_id;
215 $this->parent_gui->basicPageGuiInit($page_object_gui);
217 $page_object = $page_object_gui->getPageObject();
218 $page_object->buildDom();
219 $page_object->registerOfflineHandler($this);
221 $page_object_gui->setTemplateOutput(
false);
227 $page_object_gui->setPageLinker($this->linker);
231 $lm_pg_obj->setLMId($this->lm->getId());
234 $page_object_gui->setLinkFrame($this->requested_frame);
237 if ($page_id == 0 || ($page_id != $this->lm->getHeaderPage() &&
238 $page_id != $this->lm->getFooterPage())) {
239 $page_object_gui->setPresentationTitle(
242 $this->lm->getPageHeader(),
243 $this->lm->isActiveNumbering(),
244 (bool) $this->lm_set->get(
"time_scheduled_page_activation"),
252 if ($page_id != 0 && !$this->offline) {
253 $this->tracker->trackAccess($page_id, $ilUser->getId());
256 $page_object_gui->setEnabledPageFocus(
false);
257 $page_object_gui->getPageConfig()->setEnableSelfAssessment(
false);
261 $page_object_gui->setLinkParams(
"ref_id=" . $this->lm->getRefId());
262 $page_object_gui->setTemplateTargetVar(
"PAGE_CONTENT");
266 $ret = $page_object_gui->presentation($page_object_gui->getOutputMode());
269 if ($this->lm->getHeaderPage() > 0 &&
270 $page_id != $this->lm->getHeaderPage() &&
271 ($page_id == 0 || $page_id != $this->lm->getFooterPage())) {
273 $head = $this->
render($this->lm->getHeaderPage());
278 if ($this->lm->getFooterPage() > 0 &&
279 $page_id != $this->lm->getFooterPage() &&
280 ($page_id == 0 || $page_id != $this->lm->getHeaderPage())) {
282 $foot = $this->
render($this->lm->getFooterPage());
285 return $head . $focus_mess . $ret . $foot;
291 $page_gui =
new ilLMPageGUI($a_id, 0,
false, $this->lang, $this->concrete_lang);
296 $page_gui =
new ilLMPageGUI($a_id, 0,
false,
"", $this->concrete_lang);
299 if ($this->offline) {
311 $directory = $this->parent_gui->getOfflineDirectory() .
"/codefiles/" . $page_id .
"/" . $paragraph_id;
313 $file = $directory .
"/" . $title;
314 if (!($fp = fopen($file,
"w+"))) {
315 die(
"<strong>Error</strong>: Could not open \"" . $file .
"\" for writing" .
316 " in <strong>" . __FILE__ .
"</strong> on line <strong>" . __LINE__ .
"</strong><br />");
326 if ($this->focus_id > 0) {
327 $path = $this->lm_tree->getPathId($this->current_page);
330 if (!in_array($this->focus_id,
$path)) {
332 "tpl.out_of_focus_message.html",
335 "components/ILIAS/LearningModule" 337 $mtpl->setVariable(
"MESSAGE", $this->
lng->txt(
"cont_out_of_focus_message"));
338 $mtpl->setVariable(
"TXT_SHOW_CONTENT", $this->
lng->txt(
"cont_show_content_after_focus"));
340 if ($this->requested_focus_return == 0 ||
ilObject::_lookupType((
int) $this->requested_focus_return,
true) !=
"crs") {
341 $mtpl->setVariable(
"TXT_BACK_BEGINNING", $this->
lng->txt(
"cont_to_focus_beginning"));
342 $this->
ctrl->setParameter($this->parent_gui,
"obj_id", $this->focus_id);
343 $mtpl->setVariable(
"LINK_BACK_TO_BEGINNING", $this->
ctrl->getLinkTarget($this->parent_gui,
"layout"));
344 $this->
ctrl->setParameter($this->parent_gui,
"obj_id", $this->requested_obj_id);
346 $mtpl->setVariable(
"TXT_BACK_BEGINNING", $this->
lng->txt(
"cont_to_focus_return_crs"));
347 $mtpl->setVariable(
"LINK_BACK_TO_BEGINNING", ilLink::_getLink($this->requested_focus_return));
350 $this->
ctrl->setParameter($this->parent_gui,
"focus_id",
null);
351 $mtpl->setVariable(
"LINK_SHOW_CONTENT", $this->
ctrl->getLinkTarget($this->parent_gui,
"layout"));
352 $this->
ctrl->setParameter($this->parent_gui,
"focus_id", $this->requested_obj_id);
354 $focus_mess = $mtpl->get();
356 $succ_page_id = $this->navigation_status->getSuccessorPageId();
358 if ($succ_page_id > 0) {
359 $path2 = $this->lm_tree->getPathId($succ_page_id);
361 if ($succ_page_id == 0 || !in_array($this->focus_id, $path2)) {
363 "tpl.out_of_focus_message.html",
366 "components/ILIAS/LearningModule" 368 $mtpl->setVariable(
"MESSAGE", $this->
lng->txt(
"cont_out_of_focus_message_last_page"));
369 $mtpl->setVariable(
"TXT_SHOW_CONTENT", $this->
lng->txt(
"cont_show_content_after_focus"));
371 if ($this->requested_focus_return == 0 ||
ilObject::_lookupType($this->requested_focus_return,
true) !=
"crs") {
372 $mtpl->setVariable(
"TXT_BACK_BEGINNING", $this->
lng->txt(
"cont_to_focus_beginning"));
373 $this->
ctrl->setParameter($this->parent_gui,
"obj_id", $this->focus_id);
374 $mtpl->setVariable(
"LINK_BACK_TO_BEGINNING", $this->
ctrl->getLinkTarget($this->parent_gui,
"layout"));
375 $this->
ctrl->setParameter($this->parent_gui,
"obj_id", $this->requested_obj_id);
377 $mtpl->setVariable(
"TXT_BACK_BEGINNING", $this->
lng->txt(
"cont_to_focus_return_crs"));
378 $mtpl->setVariable(
"LINK_BACK_TO_BEGINNING", ilLink::_getLink($this->requested_focus_return));
381 $this->
ctrl->setParameter($this->parent_gui,
"focus_id",
null);
382 $mtpl->setVariable(
"LINK_SHOW_CONTENT", $this->
ctrl->getLinkTarget($this->parent_gui,
"layout"));
383 $this->
ctrl->setParameter($this->parent_gui,
"focus_id", $this->requested_obj_id);
385 $focus_mess = $mtpl->get();
407 $tpl =
new ilTemplate(
"tpl.page_message_screen.html",
true,
true,
"components/ILIAS/LearningModule");
408 $tpl->setVariable(
"TXT_PAGE_NO_PUBLIC_ACCESS", $a_content);
436 "tpl.no_content_message.html",
439 "components/ILIAS/LearningModule" 441 $mtpl->setVariable(
"MESSAGE", $this->
lng->txt(
"cont_no_page_in_chapter"));
460 "tpl.no_content_message.html",
463 "components/ILIAS/LearningModule" 465 $m = $this->
lng->txt(
"cont_page_currently_deactivated");
467 if ($act_data[
"show_activation_info"] &&
469 $m .=
"<p>" . sprintf(
470 $this->
lng->txt(
"cont_page_activation_on"),
477 $mtpl->setVariable(
"MESSAGE", $m);
495 $ptpl =
new ilTemplate(
"tpl.page_preconditions.html",
true,
true,
"components/ILIAS/LearningModule");
498 foreach ($conds as $cond) {
499 $obj_link = ilLink::_getLink($cond[
"trigger_ref_id"]);
500 $ptpl->setCurrentBlock(
"condition");
502 $ptpl->setVariable(
"LINK_ITEM", $obj_link);
503 if ($cond[
"operator"] ==
"passed") {
504 $cond_str = $this->
lng->txt(
"passed");
506 $cond_str = $this->
lng->txt(
"condition_" . $cond[
"operator"]);
508 $ptpl->setVariable(
"VAL_CONDITION", $cond_str .
" " . $cond[
"value"]);
509 $ptpl->parseCurrentBlock();
513 "TXT_MISSING_PRECONDITIONS",
515 $this->
lng->txt(
"cont_missing_preconditions"),
519 $ptpl->setVariable(
"TXT_ITEM", $this->
lng->txt(
"object"));
520 $ptpl->setVariable(
"TXT_CONDITION", $this->
lng->txt(
"condition"));
523 $parent = $this->lm_tree->getParentId($topchap);
524 $childs = $this->lm_tree->getChildsByType($parent,
"st");
527 foreach ($childs as $child) {
528 if ($child[
"child"] == $topchap) {
531 if ($i++ == ($j + 1)) {
532 $succ_node = $this->lm_tree->fetchSuccessorNode($child[
"child"],
"pg");
535 if ($succ_node !=
"") {
536 $link =
"<br /><a href=\"" .
537 $this->linker->getLink(
"layout", $succ_node[
"obj_id"], $this->requested_frame) .
538 "\">" . $this->
lng->txt(
"cont_skip_chapter") .
"</a>";
539 $ptpl->setVariable(
"LINK_SKIP_CHAPTER", $link);
static _getMissingPreconditionsOfPage(int $cont_ref_id, int $cont_obj_id, int $page_id)
gets all missing preconditions of page
const STATUS_NO_PAGE_IN_CHAPTER
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
renderNoPageAccess()
Render info message, if page is not accessible in public area.
renderNoPageInChapterMessage()
Render no page in chapter message.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
ilLMPresentationLinker $linker
static _getInstance(int $a_usr_id)
renderMessageScreen(string $a_content)
Render message screen.
renderNavRestrictionDueToQuestions()
Render message if navigation to page is not allowed due to unanswered questions.
int $requested_focus_return
static _lookupActivationData(int $a_id, string $a_parent_type, string $a_lang="-")
Lookup activation data.
const STATUS_CORRECT_ANSWER_MISSING
render(int $a_head_foot_page_id=0)
static _updateLastAccess(int $a_user_id, int $a_lm_ref_id, int $a_page_id)
static makeDirParents(string $a_dir)
Create a new directory and all parent directories.
const STATUS_FAILED_PRECONDITIONS
static now()
Return current timestamp in Y-m-d H:i:s format.
static _lookupTitle(int $a_obj_id)
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
ilLMNavigationStatus $navigation_status
bool $chapter_has_no_active_page
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _lookupTitle(int $obj_id)
renderPreconditionsOfPage()
Render preconditions of the page.
static _checkPreconditionsOfPage(int $cont_ref_id, int $cont_obj_id, int $page_id)
checks whether the preconditions of a page are fulfilled or not
const STATUS_DEACTIVATED_PAGE
static _exists(string $a_parent_type, int $a_id, string $a_lang="", bool $a_no_cache=false)
Checks whether page exists.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setScreenIdComponent(string $a_comp)
Extension of ilPageObjectGUI for learning modules.
ilLMPresentationGUI $parent_gui
handleCodeParagraph(int $page_id, int $paragraph_id, string $title, string $text)
static getInstance(int $obj_id)
renderDeactivatedPageMessage()
static lookupParentId(int $a_id, string $a_type)
getSettings()
Get learning module settings.
renderNoPageFoundMessage()
Render no page found message.
__construct(ilLMPresentationService $service, ilLMPresentationGUI $parent_gui, ilLanguage $lng, ilCtrl $ctrl, ilAccessHandler $access, ilObjUser $user, ilHelpGUI $help, int $requested_obj_id)
static _exists(int $a_id)
checks wether a lm content object with specified id exists or not
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...
static _lookupType(int $a_obj_id, int $a_lm_id=0)
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false, ?ilObjUser $user=null,)
const STATUS_NO_PUBLIC_ACCESS
renderNoPublicAccess()
Render info message, if page is not accessible in public area.
static _lookupType(int $id, bool $reference=false)
const STATUS_NO_PAGE_FOUND
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
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Main service init and factory.