/**
  * Show subhiearchy of pages and subchapters
  */
 function showHierarchy()
 {
     global $lng, $ilCtrl;
     $this->setTabs();
     $ilCtrl->setParameter($this, "backcmd", "showHierarchy");
     include_once "./Modules/LearningModule/classes/class.ilChapterHierarchyFormGUI.php";
     $form_gui = new ilChapterHierarchyFormGUI($this->content_object->getType());
     $form_gui->setFormAction($ilCtrl->getFormAction($this));
     $form_gui->setTitle($this->obj->getTitle());
     $form_gui->setIcon(ilUtil::getImagePath("icon_st.png"));
     $form_gui->setTree($this->tree);
     $form_gui->setCurrentTopNodeId($this->obj->getId());
     $form_gui->addMultiCommand($lng->txt("delete"), "delete");
     $form_gui->addMultiCommand($lng->txt("cut"), "cutItems");
     $form_gui->addMultiCommand($lng->txt("copy"), "copyItems");
     $form_gui->addMultiCommand($lng->txt("cont_de_activate"), "activatePages");
     if ($this->content_object->getLayoutPerPage()) {
         $form_gui->addMultiCommand($lng->txt("cont_set_layout"), "setPageLayout");
     }
     $form_gui->setDragIcon(ilUtil::getImagePath("icon_pg_s.png"));
     $form_gui->addCommand($lng->txt("cont_save_all_titles"), "saveAllTitles");
     $form_gui->addHelpItem($lng->txt("cont_chapters_after_pages"));
     $up_gui = $this->content_object->getType() == "dbk" ? "ilobjdlbookgui" : "ilobjlearningmodulegui";
     $ilCtrl->setParameterByClass($up_gui, "active_node", $this->obj->getId());
     $form_gui->setExplorerUpdater("tree", "tree_div", $ilCtrl->getLinkTargetByClass($up_gui, "explorer", "", true));
     $ilCtrl->setParameterByClass($up_gui, "active_node", "");
     $ctpl = new ilTemplate("tpl.chap_and_pages.html", true, true, "Modules/LearningModule");
     $ctpl->setVariable("HIERARCHY_FORM", $form_gui->getHTML());
     $ilCtrl->setParameter($this, "obj_id", $_GET["obj_id"]);
     $ctpl->setVariable("HREF_NO_JS_EDIT", $ilCtrl->getLinkTarget($this, "deactivateJSChapterEditing"));
     $ctpl->setVariable("TXT_NO_JS_EDIT", $lng->txt("cont_not_js_chap_editing"));
     $this->tpl->setContent($ctpl->get());
 }
 /**
  * show chapters
  */
 function chapters()
 {
     global $tree, $lng, $ilCtrl, $ilUser;
     $this->setTabs();
     $this->setContentSubTabs("chapters");
     $ilCtrl->setParameter($this, "backcmd", "chapters");
     include_once "./Modules/LearningModule/classes/class.ilChapterHierarchyFormGUI.php";
     $form_gui = new ilChapterHierarchyFormGUI($this->object->getType(), $_GET["transl"]);
     $form_gui->setFormAction($ilCtrl->getFormAction($this));
     $form_gui->setTitle($this->object->getTitle());
     $form_gui->setIcon(ilUtil::getImagePath("icon_lm.png"));
     $form_gui->setTree($this->lm_tree);
     $form_gui->setMaxDepth(0);
     $form_gui->setCurrentTopNodeId($this->tree->getRootId());
     $form_gui->addMultiCommand($lng->txt("delete"), "delete");
     $form_gui->addMultiCommand($lng->txt("cut"), "cutItems");
     $form_gui->addMultiCommand($lng->txt("copy"), "copyItems");
     if ($this->object->getLayoutPerPage()) {
         $form_gui->addMultiCommand($lng->txt("cont_set_layout"), "setPageLayoutInHierarchy");
     }
     $form_gui->setDragIcon(ilUtil::getImagePath("icon_st_s.png"));
     $form_gui->addCommand($lng->txt("cont_save_all_titles"), "saveAllTitles");
     $up_gui = $this->object->getType() == "dbk" ? "ilobjdlbookgui" : "ilobjlearningmodulegui";
     $form_gui->setExplorerUpdater("tree", "tree_div", $ilCtrl->getLinkTargetByClass($up_gui, "explorer", "", true));
     $ctpl = new ilTemplate("tpl.chap_and_pages.html", true, true, "Modules/LearningModule");
     $ctpl->setVariable("HIERARCHY_FORM", $form_gui->getHTML());
     $ilCtrl->setParameter($this, "obj_id", "");
     $ml_head = self::getMultiLangHeader($this->object->getId(), $this);
     $this->tpl->setContent($ml_head . $ctpl->get());
 }
 /**
  * show chapters
  */
 function chapters()
 {
     global $tree, $lng, $ilCtrl, $ilUser;
     $this->setTabs();
     $this->setContentSubTabs("chapters");
     if ($ilUser->getPref("lm_js_chapter_editing") != "disable") {
         $ilCtrl->setParameter($this, "backcmd", "chapters");
         include_once "./Modules/LearningModule/classes/class.ilChapterHierarchyFormGUI.php";
         $form_gui = new ilChapterHierarchyFormGUI($this->object->getType());
         $form_gui->setFormAction($ilCtrl->getFormAction($this));
         $form_gui->setTitle($this->object->getTitle());
         $form_gui->setIcon(ilUtil::getImagePath("icon_lm.png"));
         $form_gui->setTree($this->lm_tree);
         $form_gui->setMaxDepth(0);
         $form_gui->setCurrentTopNodeId($this->tree->getRootId());
         $form_gui->addMultiCommand($lng->txt("delete"), "delete");
         $form_gui->addMultiCommand($lng->txt("cut"), "cutItems");
         $form_gui->addMultiCommand($lng->txt("copy"), "copyItems");
         if ($this->object->getLayoutPerPage()) {
             $form_gui->addMultiCommand($lng->txt("cont_set_layout"), "setPageLayoutInHierarchy");
         }
         $form_gui->setDragIcon(ilUtil::getImagePath("icon_st_s.png"));
         $form_gui->addCommand($lng->txt("cont_save_all_titles"), "saveAllTitles");
         $up_gui = $this->object->getType() == "dbk" ? "ilobjdlbookgui" : "ilobjlearningmodulegui";
         $form_gui->setExplorerUpdater("tree", "tree_div", $ilCtrl->getLinkTargetByClass($up_gui, "explorer", "", true));
         $ctpl = new ilTemplate("tpl.chap_and_pages.html", true, true, "Modules/LearningModule");
         $ctpl->setVariable("HIERARCHY_FORM", $form_gui->getHTML());
         $ilCtrl->setParameter($this, "obj_id", "");
         $ctpl->setVariable("HREF_NO_JS_EDIT", $ilCtrl->getLinkTarget($this, "deactivateJSChapterEditing"));
         $ctpl->setVariable("TXT_NO_JS_EDIT", $lng->txt("cont_not_js_chap_editing"));
         $this->tpl->setContent($ctpl->get());
     } else {
         $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.structure_edit.html", "Modules/LearningModule");
         $num = 0;
         $this->ctrl->setParameter($this, "backcmd", "chapters");
         $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this));
         $this->tpl->setVariable("HEADER_TEXT", $this->lng->txt("cont_chapters"));
         $this->tpl->setVariable("CHECKBOX_TOP", IL_FIRST_NODE);
         $cnt = 0;
         $childs = $this->lm_tree->getChilds($this->lm_tree->getRootId());
         foreach ($childs as $child) {
             if ($child["type"] != "st") {
                 continue;
             }
             $this->tpl->setCurrentBlock("table_row");
             // color changing
             $css_row = ilUtil::switchColor($cnt++, "tblrow1", "tblrow2");
             // checkbox
             $this->tpl->setVariable("CHECKBOX_ID", $child["obj_id"]);
             $this->tpl->setVariable("CSS_ROW", $css_row);
             $this->tpl->setVariable("IMG_OBJ", ilUtil::getImagePath("icon_st.png"));
             // link
             $this->ctrl->setParameter($this, "backcmd", "");
             $this->ctrl->setParameterByClass("ilStructureObjectGUI", "obj_id", $child["obj_id"]);
             $this->tpl->setVariable("LINK_TARGET", $this->ctrl->getLinkTargetByClass("ilStructureObjectGUI", "view"));
             // title
             $this->tpl->setVariable("TEXT_CONTENT", ilStructureObject::_getPresentationTitle($child["obj_id"], $this->object->isActiveNumbering()));
             $this->tpl->parseCurrentBlock();
         }
         $paste_active = false;
         if ($ilUser->clipboardHasObjectsOfType("st")) {
             $paste_active = true;
         }
         if ($cnt == 0 && !$paste_active) {
             $this->tpl->setCurrentBlock("notfound");
             $this->tpl->setVariable("NUM_COLS", 3);
             $this->tpl->setVariable("TXT_OBJECT_NOT_FOUND", $this->lng->txt("obj_not_found"));
             $this->tpl->parseCurrentBlock();
         } else {
             // SHOW VALID ACTIONS
             $this->tpl->setVariable("NUM_COLS", 3);
             if ($cnt > 0) {
                 $acts = array("delete" => "delete", "cutChapter" => "cut", "copyChapter" => "copyChapter");
             }
             if ($paste_active) {
                 $acts["pasteChapter"] = "pasteChapter";
             }
             $this->showActions($acts);
         }
         // SHOW POSSIBLE SUB OBJECTS
         $this->tpl->setVariable("NUM_COLS", 3);
         $subobj = array("st");
         $opts = ilUtil::formSelect(12, "new_type", $subobj);
         $this->tpl->setCurrentBlock("add_object");
         $this->tpl->setVariable("SELECT_OBJTYPE", $opts);
         $this->tpl->setVariable("BTN_NAME", "create");
         $this->tpl->setVariable("TXT_ADD", $this->lng->txt("insert"));
         $this->tpl->parseCurrentBlock();
         $this->tpl->setCurrentBlock("form");
         $this->tpl->parseCurrentBlock();
         $this->tpl->setVariable("HREF_JS_EDIT", $ilCtrl->getLinkTarget($this, "activateJSChapterEditing"));
         $this->tpl->setVariable("TXT_JS_EDIT", $lng->txt("cont_js_chap_editing"));
     }
 }