Exemplo n.º 1
0
 /**
  * show preconditions of the page
  */
 function showPreconditionsOfPage()
 {
     $conds = ilObjContentObject::_getMissingPreconditionsOfPage($this->lm->getRefId(), $this->lm->getId(), $this->getCurrentPageId());
     $topchap = ilObjContentObject::_getMissingPreconditionsTopChapter($this->lm->getRefId(), $this->lm->getId(), $this->getCurrentPageId());
     $page_id = $this->getCurrentPageId();
     // content style
     $this->tpl->setCurrentBlock("ContentStyle");
     if (!$this->offlineMode()) {
         $this->tpl->setVariable("LOCATION_CONTENT_STYLESHEET", ilObjStyleSheet::getContentStylePath($this->lm->getStyleSheetId()));
     } else {
         $this->tpl->setVariable("LOCATION_CONTENT_STYLESHEET", "content_style/content.css");
     }
     $this->tpl->parseCurrentBlock();
     $this->tpl->addBlockFile("PAGE_CONTENT", "pg_content", "tpl.page_preconditions.html", true);
     // list all missing preconditions
     include_once "./Services/Repository/classes/class.ilRepositoryExplorer.php";
     foreach ($conds as $cond) {
         $obj_link = ilRepositoryExplorer::buildLinkTarget($cond["trigger_ref_id"], $cond["trigger_type"]);
         $obj_frame = ilRepositoryExplorer::buildFrameTarget($cond["trigger_type"], $cond["trigger_ref_id"], $cond["trigger_obj_id"]);
         $this->tpl->setCurrentBlock("condition");
         $this->tpl->setVariable("ROWCOL", $rc = $rc != "tblrow2" ? "tblrow2" : "tblrow1");
         $this->tpl->setVariable("VAL_ITEM", ilObject::_lookupTitle($cond["trigger_obj_id"]));
         $this->tpl->setVariable("LINK_ITEM", $obj_link);
         $this->tpl->setVariable("FRAME_ITEM", $obj_frame);
         if ($cond["operator"] == "passed") {
             $cond_str = $this->lng->txt("passed");
         } else {
             $cond_str = $cond["operator"];
         }
         $this->tpl->setVariable("VAL_CONDITION", $cond_str . " " . $cond["value"]);
         $this->tpl->parseCurrentBlock();
     }
     $this->tpl->setCurrentBlock("pg_content");
     $this->tpl->setVariable("TXT_MISSING_PRECONDITIONS", sprintf($this->lng->txt("cont_missing_preconditions"), ilLMObject::_lookupTitle($topchap)));
     $this->tpl->setVariable("TXT_ITEM", $this->lng->txt("item"));
     $this->tpl->setVariable("TXT_CONDITION", $this->lng->txt("condition"));
     // output skip chapter link
     $parent = $this->lm_tree->getParentId($topchap);
     $childs = $this->lm_tree->getChildsByType($parent, "st");
     $next = "";
     $j = -2;
     $i = 1;
     foreach ($childs as $child) {
         if ($child["child"] == $topchap) {
             $j = $i;
         }
         if ($i++ == $j + 1) {
             $succ_node = $this->lm_tree->fetchSuccessorNode($child["child"], "pg");
         }
     }
     if ($succ_node != "") {
         $framestr = !empty($_GET["frame"]) ? "frame=" . $_GET["frame"] . "&" : "";
         $showViewInFrameset = true;
         $link = "<br /><a href=\"" . $this->getLink($this->lm->getRefId(), "layout", $succ_node["obj_id"], $_GET["frame"]) . "\">" . $this->lng->txt("cont_skip_chapter") . "</a>";
         $this->tpl->setVariable("LINK_SKIP_CHAPTER", $link);
     }
     $this->tpl->parseCurrentBlock();
 }