/** * presentation title doesn't have to be page title, it may be * chapter title + page title or chapter title only, depending on settings * * @param string $a_mode IL_CHAPTER_TITLE | IL_PAGE_TITLE | IL_NO_HEADER */ function _getPresentationTitle($a_pg_id, $a_mode = IL_CHAPTER_TITLE, $a_include_numbers = false, $a_time_scheduled_activation = false, $a_force_content = false) { global $ilDB; // select $query = "SELECT * FROM lm_data WHERE obj_id = " . $ilDB->quote($a_pg_id, "integer"); $pg_set = $ilDB->query($query); $pg_rec = $ilDB->fetchAssoc($pg_set); if ($a_mode == IL_NO_HEADER && !$a_force_content) { return ""; } $tree = new ilTree($pg_rec["lm_id"]); $tree->setTableNames('lm_tree', 'lm_data'); $tree->setTreeTablePK("lm_id"); if ($a_mode == IL_PAGE_TITLE) { $nr = ""; return $nr . $pg_rec["title"]; } if ($tree->isInTree($pg_rec["obj_id"])) { $pred_node = $tree->fetchPredecessorNode($pg_rec["obj_id"], "st"); $childs = $tree->getChildsByType($pred_node["obj_id"], "pg"); $cnt_str = ""; if (count($childs) > 1) { $cnt = 0; foreach ($childs as $child) { include_once "./Services/COPage/classes/class.ilPageObject.php"; $active = ilPageObject::_lookupActive($child["obj_id"], ilObject::_lookupType($pg_rec["lm_id"]), $a_time_scheduled_activation); if (!$active) { $act_data = ilPageObject::_lookupActivationData((int) $child["obj_id"], ilObject::_lookupType($pg_rec["lm_id"])); if ($act_data["show_activation_info"] && ilUtil::now() < $act_data["activation_start"]) { $active = true; } } if ($child["type"] != "pg" || $active) { $cnt++; } if ($child["obj_id"] == $pg_rec["obj_id"]) { $cur_cnt = $cnt; } } if ($cnt > 1) { $cnt_str = " (" . $cur_cnt . "/" . $cnt . ")"; } } require_once "./Modules/LearningModule/classes/class.ilStructureObject.php"; //$struct_obj =& new ilStructureObject($pred_node["obj_id"]); //return $struct_obj->getTitle(); return ilStructureObject::_getPresentationTitle($pred_node["obj_id"], $a_include_numbers) . $cnt_str; //return $pred_node["title"].$cnt_str; } else { return $pg_rec["title"]; } }
/** * inserts sequential learning module navigation * at template variable LMNAVIGATION_CONTENT */ function ilLMNavigation() { global $ilBench, $ilUser; $ilBench->start("ContentPresentation", "ilLMNavigation"); include_once "./Services/COPage/classes/class.ilPageObject.php"; include_once "./Services/Accessibility/classes/class.ilAccessKeyGUI.php"; $page_id = $this->getCurrentPageId(); if (empty($page_id)) { return; } // process navigation for free page if (!$this->lm_tree->isInTree($page_id)) { if ($this->offlineMode() || $_GET["back_pg"] == "") { return; } $limpos = strpos($_GET["back_pg"], ":"); if ($limpos > 0) { $back_pg = substr($_GET["back_pg"], 0, $limpos); } else { $back_pg = $_GET["back_pg"]; } if (!$this->lm->cleanFrames()) { $back_href = $this->getLink($this->lm->getRefId(), "layout", $back_pg, $_GET["frame"], "", "reduce"); $back_target = ""; } else { $back_href = $this->getLink($this->lm->getRefId(), "layout", $back_pg, "", "", "reduce"); $back_target = 'target="' . ilFrameTargetInfo::_getFrame("MainContent") . '" '; } $back_img = ilUtil::getImagePath("nav_arr2_L.png", false, "output", $this->offlineMode()); $this->tpl->setCurrentBlock("ilLMNavigation_Prev"); $this->tpl->setVariable("IMG_PREV", $back_img); $this->tpl->setVariable("HREF_PREV", $back_href); $this->tpl->setVariable("FRAME_PREV", $back_target); $this->tpl->setVariable("TXT_PREV", $this->lng->txt("back")); $this->tpl->setVariable("ALT_PREV", $this->lng->txt("back")); $this->tpl->setVariable("PREV_ACC_KEY", ilAccessKeyGUI::getAttribute(ilAccessKey::PREVIOUS)); $this->tpl->setVariable("SPACER_PREV", $this->offlineMode() ? "images/spacer.png" : ilUtil::getImagePath("spacer.png")); $this->tpl->parseCurrentBlock(); $this->tpl->setCurrentBlock("ilLMNavigation_Prev2"); $this->tpl->setVariable("IMG_PREV2", $back_img); $this->tpl->setVariable("HREF_PREV2", $back_href); $this->tpl->setVariable("FRAME_PREV2", $back_target); $this->tpl->setVariable("TXT_PREV2", $this->lng->txt("back")); $this->tpl->setVariable("ALT_PREV2", $this->lng->txt("back")); $this->tpl->setVariable("SPACER_PREV2", $this->offlineMode() ? "images/spacer.png" : ilUtil::getImagePath("spacer.png")); $this->tpl->parseCurrentBlock(); return; } // determine successor page_id $ilBench->start("ContentPresentation", "ilLMNavigation_fetchSuccessor"); $found = false; // empty chapter if ($this->chapter_has_no_active_page && ilLMObject::_lookupType($_GET["obj_id"]) == "st") { $c_id = $_GET["obj_id"]; } else { if ($this->deactivated_page) { $c_id = $_GET["obj_id"]; } else { $c_id = $page_id; } } while (!$found) { $succ_node = $this->lm_tree->fetchSuccessorNode($c_id, "pg"); $c_id = $succ_node["obj_id"]; $active = ilPageObject::_lookupActive($c_id, $this->lm->getType(), $this->lm_set->get("time_scheduled_page_activation")); if ($succ_node["obj_id"] > 0 && ($ilUser->getId() == ANONYMOUS_USER_ID || $this->needs_to_be_purchased) && ($this->lm->getPublicAccessMode() == "selected" && !ilLMObject::_isPagePublic($succ_node["obj_id"]))) { $found = false; } else { if ($succ_node["obj_id"] > 0 && !$active) { // look, whether activation data should be shown $act_data = ilPageObject::_lookupActivationData((int) $succ_node["obj_id"], $this->lm->getType()); if ($act_data["show_activation_info"] && ilUtil::now() < $act_data["activation_start"]) { $found = true; } else { $found = false; } } else { $found = true; } } } $ilBench->stop("ContentPresentation", "ilLMNavigation_fetchSuccessor"); $succ_str = $succ_node !== false ? " -> " . $succ_node["obj_id"] . "_" . $succ_node["type"] : ""; // determine predecessor page id $ilBench->start("ContentPresentation", "ilLMNavigation_fetchPredecessor"); $found = false; if ($this->deactivated_page) { $c_id = $_GET["obj_id"]; } else { $c_id = $page_id; } while (!$found) { $pre_node = $this->lm_tree->fetchPredecessorNode($c_id, "pg"); $c_id = $pre_node["obj_id"]; $active = ilPageObject::_lookupActive($c_id, $this->lm->getType(), $this->lm_set->get("time_scheduled_page_activation")); if ($pre_node["obj_id"] > 0 && ($ilUser->getId() == ANONYMOUS_USER_ID || $this->needs_to_be_purchased) && ($this->lm->getPublicAccessMode() == "selected" && !ilLMObject::_isPagePublic($pre_node["obj_id"]))) { $found = false; } else { if ($pre_node["obj_id"] > 0 && !$active) { // look, whether activation data should be shown $act_data = ilPageObject::_lookupActivationData((int) $pre_node["obj_id"], $this->lm->getType()); if ($act_data["show_activation_info"] && ilUtil::now() < $act_data["activation_start"]) { $found = true; } else { $found = false; } } else { $found = true; } } } $ilBench->stop("ContentPresentation", "ilLMNavigation_fetchPredecessor"); $pre_str = $pre_node !== false ? $pre_node["obj_id"] . "_" . $pre_node["type"] . " -> " : ""; // determine target frame $framestr = !empty($_GET["frame"]) ? "frame=" . $_GET["frame"] . "&" : ""; // Determine whether the view of a learning resource should // be shown in the frameset of ilias, or in a separate window. //$showViewInFrameset = $this->ilias->ini->readVariable("layout","view_target") == "frame"; $showViewInFrameset = true; if ($pre_node != "") { $ilBench->start("ContentPresentation", "ilLMNavigation_outputPredecessor"); // get page object //$ilBench->start("ContentPresentation", "ilLMNavigation_getPageObject"); //$pre_page =& new ilLMPageObject($this->lm, $pre_node["obj_id"]); //$pre_page->setLMId($this->lm->getId()); //$ilBench->stop("ContentPresentation", "ilLMNavigation_getPageObject"); // get presentation title $ilBench->start("ContentPresentation", "ilLMNavigation_getPresentationTitle"); $prev_title = ilLMPageObject::_getPresentationTitle($pre_node["obj_id"], $this->lm->getPageHeader(), $this->lm->isActiveNumbering(), $this->lm_set->get("time_scheduled_page_activation")); $prev_title = ilUtil::shortenText($prev_title, 50, true); $prev_img = ilUtil::getImagePath("nav_arr_L.png", false, "output", $this->offlineMode()); if (!$this->lm->cleanFrames()) { $prev_href = $this->getLink($this->lm->getRefId(), "layout", $pre_node["obj_id"], $_GET["frame"]); $prev_target = ""; } else { if ($showViewInFrameset && !$this->offlineMode()) { $prev_href = $this->getLink($this->lm->getRefId(), "layout", $pre_node["obj_id"]); $prev_target = 'target="' . ilFrameTargetInfo::_getFrame("MainContent") . '" '; } else { $prev_href = $this->getLink($this->lm->getRefId(), "layout", $pre_node["obj_id"]); $prev_target = 'target="_top" '; } } if (($ilUser->getId() == ANONYMOUS_USER_ID || $this->needs_to_be_purchased) && ($this->lm->getPublicAccessMode() == 'selected' && !ilLMObject::_isPagePublic($pre_node["obj_id"]))) { $output = $this->lng->txt("msg_page_not_public"); } $ilBench->stop("ContentPresentation", "ilLMNavigation_getPresentationTitle"); $this->tpl->setCurrentBlock("ilLMNavigation_Prev"); $this->tpl->setVariable("IMG_PREV", $prev_img); $this->tpl->setVariable("HREF_PREV", $prev_href); $this->tpl->setVariable("FRAME_PREV", $prev_target); $this->tpl->setVariable("TXT_PREV", $prev_title); $this->tpl->setVariable("ALT_PREV", $this->lng->txt("previous")); $this->tpl->setVariable("SPACER_PREV", $this->offlineMode() ? "images/spacer.png" : ilUtil::getImagePath("spacer.png")); $this->tpl->setVariable("PREV_ACC_KEY", ilAccessKeyGUI::getAttribute(ilAccessKey::PREVIOUS)); $this->tpl->parseCurrentBlock(); $this->tpl->setCurrentBlock("ilLMNavigation_Prev2"); $this->tpl->setVariable("IMG_PREV2", $prev_img); $this->tpl->setVariable("HREF_PREV2", $prev_href); $this->tpl->setVariable("FRAME_PREV2", $prev_target); $this->tpl->setVariable("TXT_PREV2", $prev_title); $this->tpl->setVariable("ALT_PREV2", $this->lng->txt("previous")); $this->tpl->setVariable("SPACER_PREV2", $this->offlineMode() ? "images/spacer.png" : ilUtil::getImagePath("spacer.png")); $this->tpl->parseCurrentBlock(); $ilBench->stop("ContentPresentation", "ilLMNavigation_outputPredecessor"); } if ($succ_node != "") { $ilBench->start("ContentPresentation", "ilLMNavigation_outputSuccessor"); // get presentation title $ilBench->start("ContentPresentation", "ilLMNavigation_getPresentationTitle"); $succ_title = ilLMPageObject::_getPresentationTitle($succ_node["obj_id"], $this->lm->getPageHeader(), $this->lm->isActiveNumbering(), $this->lm_set->get("time_scheduled_page_activation")); $succ_title = ilUtil::shortenText($succ_title, 50, true); $succ_img = ilUtil::getImagePath("nav_arr_R.png", false, "output", $this->offlineMode()); if (!$this->lm->cleanFrames()) { $succ_href = $this->getLink($this->lm->getRefId(), "layout", $succ_node["obj_id"], $_GET["frame"]); $succ_target = ""; } else { if ($showViewInFrameset && !$this->offlineMode()) { $succ_href = $this->getLink($this->lm->getRefId(), "layout", $succ_node["obj_id"]); $succ_target = ' target="' . ilFrameTargetInfo::_getFrame("MainContent") . '" '; } else { $succ_href = $this->getLink($this->lm->getRefId(), "layout", $succ_node["obj_id"]); $succ_target = ' target="_top" '; } } if (($ilUser->getId() == ANONYMOUS_USER_ID || $this->needs_to_be_purchased) && ($this->lm->getPublicAccessMode() == 'selected' && !ilLMObject::_isPagePublic($pre_node["obj_id"]))) { $output = $this->lng->txt("msg_page_not_public"); } $ilBench->stop("ContentPresentation", "ilLMNavigation_getPresentationTitle"); $this->tpl->setCurrentBlock("ilLMNavigation_Next"); $this->tpl->setVariable("IMG_SUCC", $succ_img); $this->tpl->setVariable("HREF_SUCC", $succ_href); $this->tpl->setVariable("FRAME_SUCC", $succ_target); $this->tpl->setVariable("TXT_SUCC", $succ_title); $this->tpl->setVariable("ALT_SUCC", $this->lng->txt("next")); $this->tpl->setVariable("SPACER_SUCC", $this->offlineMode() ? "images/spacer.png" : ilUtil::getImagePath("spacer.png")); $this->tpl->setVariable("NEXT_ACC_KEY", ilAccessKeyGUI::getAttribute(ilAccessKey::NEXT)); $this->tpl->parseCurrentBlock(); $this->tpl->setCurrentBlock("ilLMNavigation_Next2"); $this->tpl->setVariable("IMG_SUCC2", $succ_img); $this->tpl->setVariable("HREF_SUCC2", $succ_href); $this->tpl->setVariable("FRAME_SUCC2", $succ_target); $this->tpl->setVariable("TXT_SUCC2", $succ_title); $this->tpl->setVariable("ALT_SUCC2", $this->lng->txt("next")); $this->tpl->setVariable("SPACER_SUCC2", $this->offlineMode() ? "images/spacer.png" : ilUtil::getImagePath("spacer.png")); $this->tpl->parseCurrentBlock(); $ilBench->stop("ContentPresentation", "ilLMNavigation_outputSuccessor"); } $ilBench->stop("ContentPresentation", "ilLMNavigation"); }
/** * Is node visible for the learner * * @param mixed $a_node node object/array * @return boolean node visible true/false */ static function _isNodeVisible($a_node) { include_once "./Services/COPage/classes/class.ilPageObject.php"; if ($a_node["type"] != "pg") { return true; } $lm_set = new ilSetting("lm"); $active = ilPageObject::_lookupActive($a_node["child"], "lm", $lm_set->get("time_scheduled_page_activation")); if (!$active) { $act_data = ilPageObject::_lookupActivationData((int) $a_node["child"], "lm"); if ($act_data["show_activation_info"] && ilUtil::now() < $act_data["activation_start"]) { return true; } else { return false; } } else { return true; } }
function isVisible($a_id, $a_type) { include_once "./Services/COPage/classes/class.ilPageObject.php"; $active = ilPageObject::_lookupActive($a_id, $this->lm_obj->getType(), $this->lm_set->get("time_scheduled_page_activation")); if (!$active && $a_type == "pg") { $act_data = ilPageObject::_lookupActivationData((int) $a_id, $this->lm_obj->getType()); if ($act_data["show_activation_info"] && ilUtil::now() < $act_data["activation_start"]) { return true; } else { return false; } } else { return true; } }