/**
  * Show Sequencing
  */
 function showSequencing()
 {
     global $tpl, $lng, $ilTabs, $ilToolbar, $ilCtrl;
     $ilTabs->setTabActive("sahs_sequencing");
     include_once "./Modules/Scorm2004/classes/seq_editor/class.ilSCORM2004Item.php";
     if (!$this->object->getSequencingExpertMode()) {
         $ilToolbar->addButton($lng->txt("sahs_activate_expert_mode"), $ilCtrl->getLinkTarget($this, "confirmExpertMode"));
     } else {
         include_once "./Services/UIComponent/NestedList/classes/class.ilNestedList.php";
         $list = new ilNestedList();
         $t = $this->object->getTree();
         $root_node = $t->getNodeData($t->getRootId());
         $nodes = $this->object->getTree()->getSubtree($root_node);
         foreach ($nodes as $node) {
             if (in_array($node["type"], array("", "chap", "sco"))) {
                 $ntpl = new ilTemplate("tpl.seq_node.html", true, true, "Modules/Scorm2004");
                 $ntpl->setVariable("NODE_ID", $node["child"]);
                 if ($node["type"] == "") {
                     $ntpl->setVariable("TITLE", $this->object->getTitle());
                     $item = new ilSCORM2004Item($this->object->getId(), true);
                 } else {
                     $ntpl->setVariable("TITLE", $node["title"]);
                     $item = new ilSCORM2004Item($node["child"]);
                 }
                 $ntpl->setVariable("SEQ_INFO", ilUtil::prepareFormOutput($item->exportAsXML(false)));
                 $list->addListNode($ntpl->get(), $node["child"], $node["parent"]);
             }
         }
         $tb = new ilToolbarGUI();
         $tb->addFormButton($lng->txt("save"), "saveSequencing");
         $ftpl = new ilTemplate("tpl.sequencing.html", true, true, "Modules/Scorm2004");
         $ftpl->setVariable("CONTENT", $list->getHTML());
         $ftpl->setVariable("FORM_ACTION", $ilCtrl->getFormAction($this));
         $ftpl->setVariable("TB", $tb->getHTML());
         $tpl->setContent($ftpl->get());
     }
 }
 /**
  * Fill data section
  */
 function fillDataSection()
 {
     global $ilCtrl, $lng, $ilAccess;
     $tpl = new ilTemplate("tpl.wiki_imp_pages_block.html", true, true, "Modules/Wiki");
     $cpar[0] = $cpar[1] = 0;
     include_once "./Services/UIComponent/NestedList/classes/class.ilNestedList.php";
     $list = new ilNestedList();
     $list->setItemClass("ilWikiBlockItem");
     $list->setListClass("ilWikiBlockList");
     $list->setListClass("ilWikiBlockListNoIndent", 1);
     $cnt = 1;
     if (!$this->export) {
         $list->addListNode("<p class='small'><a href='" . $ilCtrl->getLinkTargetByClass("ilobjwikigui", "gotoStartPage") . "'>" . $lng->txt("wiki_start_page") . "</a></p>", 1, 0);
     } else {
         $list->addListNode("<p class='small'><a href='" . "index.html" . "'>" . $lng->txt("wiki_start_page") . "</a></p>", 1, 0);
     }
     $cpar[0] = 1;
     $ipages = ilObjWiki::_lookupImportantPagesList(ilObject::_lookupObjId($_GET["ref_id"]));
     foreach ($ipages as $p) {
         $cnt++;
         $title = ilWikiPage::lookupTitle($p["page_id"]);
         if (!$this->export) {
             $list->addListNode("<p class='small'><a href='" . ilObjWikiGUI::getGotoLink($_GET["ref_id"], $title) . "'>" . $title . "</a></p>", $cnt, (int) $cpar[$p["indent"] - 1]);
         } else {
             $list->addListNode("<p class='small'><a href='" . "wpg_" . $p["page_id"] . ".html" . "'>" . $title . "</a></p>", $cnt, (int) $cpar[$p["indent"] - 1]);
         }
         $cpar[$p["indent"]] = $cnt;
     }
     $this->setDataSection($list->getHTML());
     return;
     // old style
     // the start page
     $tpl->setCurrentBlock("item");
     $title = ilWikiPage::lookupTitle($p["page_id"]);
     $tpl->setVariable("ITEM_TITLE", $lng->txt("wiki_start_page"));
     $tpl->setVariable("PAD", (int) 5 + 0 * 20);
     $tpl->setVariable("ITEM_HREF", $ilCtrl->getLinkTargetByClass("ilobjwikigui", "gotoStartPage"));
     $tpl->parseCurrentBlock();
     $ipages = ilObjWiki::_lookupImportantPagesList(ilObject::_lookupObjId($_GET["ref_id"]));
     foreach ($ipages as $p) {
         $tpl->setCurrentBlock("item");
         $title = ilWikiPage::lookupTitle($p["page_id"]);
         $tpl->setVariable("ITEM_TITLE", $title);
         $tpl->setVariable("PAD", (int) 5 + $p["indent"] * 20);
         $tpl->setVariable("ITEM_HREF", ilObjWikiGUI::getGotoLink($_GET["ref_id"], $title));
         $tpl->parseCurrentBlock();
     }
     $this->setDataSection($tpl->get());
 }
Esempio n. 3
0
 /**
  * Insert page toc
  *
  * @param string output
  * @return string output
  */
 function insertPageToc($a_output)
 {
     global $lng;
     include_once "./Services/Utilities/classes/class.ilStr.php";
     // extract all headings
     $offsets = ilStr::strPosAll($a_output, "ilPageTocH");
     $page_heads = array();
     foreach ($offsets as $os) {
         $level = (int) substr($a_output, $os + 10, 1);
         if (in_array($level, array(1, 2, 3))) {
             $anchor = str_replace("TocH", "TocA", substr($a_output, $os, strpos($a_output, "<", $os) - $os - 3));
             // get heading
             $tag_start = stripos($a_output, "<h" . $level . " ", $os);
             $tag_end = stripos($a_output, "</h" . $level . ">", $tag_start);
             $head = substr($a_output, $tag_start, $tag_end - $tag_start);
             // get headings text
             $text_start = stripos($head, ">") + 1;
             $text_end = strripos($head, "<!--", $text_start);
             $text = substr($head, $text_start, $text_end - $text_start);
             $page_heads[] = array("level" => $level, "text" => $text, "anchor" => $anchor);
         }
     }
     if (count($page_heads) > 1) {
         include_once "./Services/UIComponent/NestedList/classes/class.ilNestedList.php";
         $list = new ilNestedList();
         $list->setAutoNumbering(true);
         $list->setListClass("ilc_page_toc_PageTOCList");
         $list->setItemClass("ilc_page_toc_PageTOCItem");
         $i = 0;
         $c_depth = 1;
         $c_par[1] = 0;
         $c_par[2] = 0;
         $nr[1] = 1;
         $nr[2] = 1;
         $nr[3] = 1;
         foreach ($page_heads as $ind => $h) {
             $i++;
             $par = 0;
             // check if we have a parent for one level up
             $par = 0;
             if ($h["level"] == 2 && $c_par[1] > 0) {
                 $par = $c_par[1];
             }
             if ($h["level"] == 3 && $c_par[2] > 0) {
                 $par = $c_par[2];
             }
             $h["text"] = str_replace("<!--PageTocPH-->", "", $h["text"]);
             // add the list node
             $list->addListNode("<a href='#" . $h["anchor"] . "' class='ilc_page_toc_PageTOCLink'>" . $h["text"] . "</a>", $i, $par);
             // set the node as current parent of the level
             if ($h["level"] == 1) {
                 $c_par[1] = $i;
                 $c_par[2] = 0;
             }
             if ($h["level"] == 2) {
                 $c_par[2] = $i;
             }
         }
         $tpl = new ilTemplate("tpl.page_toc.html", true, true, "Services/COPage");
         $tpl->setVariable("PAGE_TOC", $list->getHTML());
         $tpl->setVariable("TXT_PAGE_TOC", $lng->txt("cont_page_toc"));
         $tpl->setVariable("TXT_HIDE", $lng->txt("hide"));
         $tpl->setVariable("TXT_SHOW", $lng->txt("show"));
         $a_output = str_replace("{{{{{PageTOC}}}}}", $tpl->get(), $a_output);
         $numbers = $list->getNumbers();
         if (count($numbers) > 0) {
             include_once "./Services/Utilities/classes/class.ilStr.php";
             foreach ($numbers as $n) {
                 $a_output = ilStr::replaceFirsOccurence("<!--PageTocPH-->", $n . " ", $a_output);
             }
         }
     } else {
         $a_output = str_replace("{{{{{PageTOC}}}}}", "", $a_output);
     }
     return $a_output;
 }
 /**
  * List items
  */
 function listItems()
 {
     global $tpl;
     $this->setTabs("content");
     include_once "./Services/Skill/classes/class.ilSkillTreeNode.php";
     $bs = ilSkillTreeNode::getSkillTreeNodes((int) $_GET["obj_id"], false);
     include_once "./Services/UIComponent/NestedList/classes/class.ilNestedList.php";
     $ns = new ilNestedList();
     $ns->setListClass("il_Explorer");
     foreach ($bs as $b) {
         $par = $b["id"] == (int) $_GET["obj_id"] ? 0 : $b["parent"];
         $ns->addListNode(ilSkillTreeNode::_lookupTitle($b["id"]), $b["id"], $par);
     }
     $tpl->setContent($ns->getHTML());
 }