111 $this->lm_tree =
$service->getLMTree();
112 $this->lang =
$service->getPresentationStatus()->getLang();
113 $this->current_page =
$service->getNavigationStatus()->getCurrentPage();
114 $this->lm =
$service->getLearningModule();
115 $this->lm_set =
$service->getSettings();
117 $this->offline =
$service->getPresentationStatus()->offline;
118 $this->tracker =
$service->getTracker();
119 $this->linker =
$service->getLinker();
121 $this->chapter_has_no_active_page =
$service->getNavigationStatus()->isChapterWithoutActivePage();
122 $this->deactivated_page =
$service->getNavigationStatus()->isDeactivatedPage();
123 $this->focus_id =
$service->getPresentationStatus()->getFocusId();
125 $this->search_string =
$service->getPresentationStatus()->getSearchString();
126 $this->requested_obj_id = $requested_obj_id;
127 $this->requested_focus_return =
$service->getPresentationStatus()->getFocusReturn();
136 $ilHelp->setScreenIdComponent(
"lm");
137 $ilHelp->setScreenId(
"content");
138 $ilHelp->setSubScreenId(
"content");
155 if ($requested_page_lm != $this->lm->getId()) {
161 if (
$user->getId() == ANONYMOUS_USER_ID &&
162 $this->lm->getPublicAccessMode() ==
'selected') {
175 if (!$this->offline) {
176 if ($this->lm->getRestrictForwardNavigation()) {
177 if ($this->tracker->hasPredIncorrectAnswers($this->current_page)) {
184 if ($this->chapter_has_no_active_page &&
189 if ($this->deactivated_page) {
193 if ($this->current_page == 0) {
208 if ($this->search_string !=
"" && !$this->offline) {
211 $search_string = $cache->getQuery();
214 if (is_array($search_string)) {
215 $search_string = $search_string[
"lom_content"];
221 $words = $p->getQuotedWords();
222 if (is_array($words)) {
223 foreach ($words as $w) {
237 public function render($a_head_foot_page_id = 0)
268 if ($a_head_foot_page_id == 0) {
272 $page_id = $a_head_foot_page_id;
280 $this->parent_gui->basicPageGuiInit($page_object_gui);
281 $page_object = $page_object_gui->getPageObject();
282 $page_object->buildDom();
283 $page_object->registerOfflineHandler($this);
285 $page_object_gui->setTemplateOutput(
false);
291 $page_object_gui->setPageLinker($this->linker);
295 $lm_pg_obj->setLMId($this->lm->getId());
298 $page_object_gui->setLinkFrame(
$_GET[
"frame"]);
301 if ($page_id == 0 || ($page_id != $this->lm->getHeaderPage() &&
302 $page_id != $this->lm->getFooterPage())) {
303 $page_object_gui->setPresentationTitle(
306 $this->lm->getPageHeader(),
307 $this->lm->isActiveNumbering(),
308 $this->lm_set->get(
"time_scheduled_page_activation"),
316 if ($page_id != 0 && !$this->offline) {
317 $this->tracker->trackAccess($page_id,
$ilUser->getId());
320 $page_object_gui->setEnabledPageFocus(
false);
321 $page_object_gui->getPageConfig()->setEnableSelfAssessment(
false);
325 $page_object_gui->setLinkParams(
"ref_id=" . $this->lm->getRefId());
326 $page_object_gui->setTemplateTargetVar(
"PAGE_CONTENT");
330 $ret = $page_object_gui->presentation($page_object_gui->getOutputMode());
333 if ($this->lm->getHeaderPage() > 0 &&
334 $page_id != $this->lm->getHeaderPage() &&
335 ($page_id == 0 || $page_id != $this->lm->getFooterPage())) {
337 $head = $this->
render($this->lm->getHeaderPage());
342 if ($this->lm->getFooterPage() > 0 &&
343 $page_id != $this->lm->getFooterPage() &&
344 ($page_id == 0 || $page_id != $this->lm->getHeaderPage())) {
346 $foot = $this->
render($this->lm->getFooterPage());
350 return $head . $focus_mess .
$ret . $foot;
362 $page_gui =
new ilLMPageGUI($a_id, 0,
false, $this->lang);
366 if ($this->offline) {
383 if ($this->focus_id > 0) {
384 $path = $this->lm_tree->getPathId($this->current_page);
387 if (!in_array($this->focus_id, $path)) {
389 "tpl.out_of_focus_message.html",
392 "Modules/LearningModule"
394 $mtpl->setVariable(
"MESSAGE", $this->lng->txt(
"cont_out_of_focus_message"));
395 $mtpl->setVariable(
"TXT_SHOW_CONTENT", $this->lng->txt(
"cont_show_content_after_focus"));
397 if ($this->requested_focus_return == 0 ||
ilObject::_lookupType((
int) $this->requested_focus_return,
true) !=
"crs") {
398 $mtpl->setVariable(
"TXT_BACK_BEGINNING", $this->lng->txt(
"cont_to_focus_beginning"));
399 $this->ctrl->setParameter($this->parent_gui,
"obj_id", $this->focus_id);
400 $mtpl->setVariable(
"LINK_BACK_TO_BEGINNING", $this->ctrl->getLinkTarget($this->parent_gui,
"layout"));
401 $this->ctrl->setParameter($this->parent_gui,
"obj_id", $this->requested_obj_id);
403 $mtpl->setVariable(
"TXT_BACK_BEGINNING", $this->lng->txt(
"cont_to_focus_return_crs"));
404 $mtpl->setVariable(
"LINK_BACK_TO_BEGINNING",
ilLink::_getLink($this->requested_focus_return));
407 $this->ctrl->setParameter($this->parent_gui,
"focus_id",
"");
408 $mtpl->setVariable(
"LINK_SHOW_CONTENT", $this->ctrl->getLinkTarget($this->parent_gui,
"layout"));
409 $this->ctrl->setParameter($this->parent_gui,
"focus_id", $this->requested_obj_id);
411 $focus_mess = $mtpl->get();
418 if ($sp == 0 || !in_array($this->focus_id, $path2)) {
420 "tpl.out_of_focus_message.html",
423 "Modules/LearningModule"
425 $mtpl->setVariable(
"MESSAGE", $this->lng->txt(
"cont_out_of_focus_message_last_page"));
426 $mtpl->setVariable(
"TXT_SHOW_CONTENT", $this->lng->txt(
"cont_show_content_after_focus"));
428 if ($this->requested_focus_return == 0 ||
ilObject::_lookupType($this->requested_focus_return,
true) !=
"crs") {
429 $mtpl->setVariable(
"TXT_BACK_BEGINNING", $this->lng->txt(
"cont_to_focus_beginning"));
430 $this->ctrl->setParameter($this->parent_gui,
"obj_id", $this->focus_id);
431 $mtpl->setVariable(
"LINK_BACK_TO_BEGINNING", $this->ctrl->getLinkTarget($this->parent_gui,
"layout"));
432 $this->ctrl->setParameter($this->parent_gui,
"obj_id", $this->requested_obj_id);
434 $mtpl->setVariable(
"TXT_BACK_BEGINNING", $this->lng->txt(
"cont_to_focus_return_crs"));
435 $mtpl->setVariable(
"LINK_BACK_TO_BEGINNING",
ilLink::_getLink($this->requested_focus_return));
438 $this->ctrl->setParameter($this->parent_gui,
"focus_id",
"");
439 $mtpl->setVariable(
"LINK_SHOW_CONTENT", $this->ctrl->getLinkTarget($this->parent_gui,
"layout"));
440 $this->ctrl->setParameter($this->parent_gui,
"focus_id", $this->requested_obj_id);
442 $focus_mess = $mtpl->get();
468 $tpl =
new ilTemplate(
"tpl.page_message_screen.html",
true,
true,
"Modules/LearningModule");
500 "tpl.no_content_message.html",
503 "Modules/LearningModule"
505 $mtpl->setVariable(
"MESSAGE", $this->lng->txt(
"cont_no_page_in_chapter"));
531 "tpl.no_content_message.html",
534 "Modules/LearningModule"
536 $m = $this->lng->txt(
"cont_page_currently_deactivated");
538 if ($act_data[
"show_activation_info"] &&
540 $m .=
"<p>" . sprintf(
541 $this->lng->txt(
"cont_page_activation_on"),
548 $mtpl->setVariable(
"MESSAGE", $m);
565 $ptpl =
new ilTemplate(
"tpl.page_preconditions.html",
true,
true,
"Modules/LearningModule");
568 foreach ($conds as $cond) {
570 $ptpl->setCurrentBlock(
"condition");
572 $ptpl->setVariable(
"LINK_ITEM", $obj_link);
573 if ($cond[
"operator"] ==
"passed") {
574 $cond_str = $this->lng->txt(
"passed");
576 $cond_str = $this->lng->txt(
"condition_" . $cond[
"operator"]);
578 $ptpl->setVariable(
"VAL_CONDITION", $cond_str .
" " . $cond[
"value"]);
579 $ptpl->parseCurrentBlock();
583 "TXT_MISSING_PRECONDITIONS",
585 $this->lng->txt(
"cont_missing_preconditions"),
589 $ptpl->setVariable(
"TXT_ITEM", $this->lng->txt(
"object"));
590 $ptpl->setVariable(
"TXT_CONDITION", $this->lng->txt(
"condition"));
593 $parent = $this->lm_tree->getParentId($topchap);
594 $childs = $this->lm_tree->getChildsByType($parent,
"st");
597 foreach ($childs as $child) {
598 if ($child[
"child"] == $topchap) {
601 if (
$i++ == ($j + 1)) {
602 $succ_node = $this->lm_tree->fetchSuccessorNode($child[
"child"],
"pg");
605 if ($succ_node !=
"") {
606 $link =
"<br /><a href=\"" .
607 $this->linker->getLink(
"layout", $succ_node[
"obj_id"],
$_GET[
"frame"]) .
608 "\">" . $this->lng->txt(
"cont_skip_chapter") .
"</a>";
609 $ptpl->setVariable(
"LINK_SKIP_CHAPTER", $link);
628 if (empty($page_id)) {
636 if ($this->chapter_has_no_active_page &&
638 $c_id = $this->requested_obj_id;
640 if ($this->deactivated_page) {
641 $c_id = $this->requested_obj_id;
647 $succ_node = $this->lm_tree->fetchSuccessorNode($c_id,
"pg");
648 $c_id = $succ_node[
"obj_id"];
652 $this->lm->getType(),
653 $this->lm_set->get(
"time_scheduled_page_activation")
656 if ($succ_node[
"obj_id"] > 0 &&
657 $ilUser->getId() == ANONYMOUS_USER_ID &&
658 ($this->lm->getPublicAccessMode() ==
"selected" &&
661 } elseif ($succ_node[
"obj_id"] > 0 && !$active) {
664 if ($act_data[
"show_activation_info"] &&
676 return $succ_node[
"obj_id"];
An exception for terminatinating execution or to throw for unit testing.
static _updateLastAccess($a_user_id, $a_lm_ref_id, $a_page_id)
This class provides processing control methods.
static formatDate(ilDateTime $date, $a_skip_day=false, $a_include_wd=false, $include_seconds=false)
Format a date @access public.
@classDescription Date and time handling
determineStatus()
Determine Status (should be factored out later to something like LMPageAccessStatus)
getLMPageGUI($a_id)
Get lm page gui object.
render($a_head_foot_page_id=0)
Render lm content.
__construct(ilLMPresentationService $service, ilLMPresentationGUI $parent_gui, ilLanguage $lng, ilCtrl $ctrl, ilAccessHandler $access, ilObjUser $user, ilHelpGUI $help, $requested_obj_id)
Constructor.
renderNavRestrictionDueToQuestions()
Show message if navigation to page is not allowed due to unanswered questions.
renderNoPageFoundMessage()
Render no page found message.
const STATUS_FAILED_PRECONDITIONS
const STATUS_DEACTIVATED_PAGE
const STATUS_NO_PUBLIC_ACCESS
renderNoPageInChapterMessage()
Render no page in chapter message.
getSuccessorPage()
Get successor page.
initSearchHighlighting()
Init search highlighting.
const STATUS_NO_PAGE_IN_CHAPTER
const STATUS_CORRECT_ANSWER_MISSING
const STATUS_NO_PAGE_FOUND
renderPreconditionsOfPage()
show preconditions of the page
renderNoPublicAccess()
Show info message, if page is not accessible in public area.
renderNoPageAccess()
Show info message, if page is not accessible in public area.
renderFocusMessage()
Render focus message.
renderDeactivatedPageMessage()
Render deactivated page message.
renderMessageScreen($a_content)
Show message screen.
static _lookupType($a_obj_id, $a_lm_id=0)
Lookup type.
static _isPagePublic($a_node_id, $a_check_public_mode=false)
static _lookupTitle($a_obj_id)
Lookup title.
static _exists($a_id)
checks wether a lm content object with specified id exists or not
Extension of ilPageObjectGUI for learning modules.
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...
Class ilLMPresentationGUI.
Main service init and factory.
static _getLink($a_ref_id, $a_type='', $a_params=array(), $append="")
static _getMissingPreconditionsTopChapter($cont_obj_ref_id, $cont_obj_id, $page_id)
get top chapter of page for that any precondition is missing
static _checkPreconditionsOfPage($cont_ref_id, $cont_obj_id, $page_id)
checks wether the preconditions of a page are fulfilled or not
static _getMissingPreconditionsOfPage($cont_ref_id, $cont_obj_id, $page_id)
gets all missing preconditions of page
static _lookupTitle($a_id)
lookup object title
static _lookupType($a_id, $a_reference=false)
lookup object type
static _lookupActive($a_id, $a_parent_type, $a_check_scheduled_activation=false, $a_lang="-")
lookup activation status
static lookupParentId($a_id, $a_type)
Lookup parent id.
static _lookupActivationData($a_id, $a_parent_type, $a_lang="-")
Lookup activation data.
static _exists($a_parent_type, $a_id, $a_lang="", $a_no_cache=false)
Checks whether page exists.
special template class to simplify handling of ITX/PEAR
static highlight($a_dom_node_id, $a_text, $a_tpl=null)
Searches for all occurences of a text (case-insensitive) and highlights it.
static _getInstance($a_usr_id)
Get singleton instance.
static now()
Return current timestamp in Y-m-d H:i:s format.
Interface ilAccessHandler.
if(isset($_FILES['img_file']['size']) && $_FILES['img_file']['size'] > 0) $tpl