/** * split page to next page at hierarchical id * * the main reason for this method being static is that a lm page * object is not available within ilPageContentGUI where this method * is called */ function _splitPageNext($a_page_id, $a_pg_parent_type, $a_hier_id) { // get content object (learning module / digilib book) $lm_id = ilLMObject::_lookupContObjID($a_page_id); $type = ilObject::_lookupType($lm_id, false); switch ($type) { case "lm": include_once "./Modules/LearningModule/classes/class.ilObjLearningModule.php"; $cont_obj = new ilObjLearningModule($lm_id, false); break; case "dbk": include_once "./Modules/LearningModule/classes/class.ilObjDlBook.php"; $cont_obj = new ilObjDlBook($lm_id, false); break; } $tree = new ilTree($cont_obj->getId()); $tree->setTableNames('lm_tree', 'lm_data'); $tree->setTreeTablePK("lm_id"); $source_lm_page =& new ilLMPageObject($cont_obj, $a_page_id); $source_page =& $source_lm_page->getPageObject(); // get next page $succ = $tree->fetchSuccessorNode($a_page_id, "pg"); if ($succ["child"] > 0) { $target_lm_page =& new ilLMPageObject($cont_obj, $succ["child"]); $target_page =& $target_lm_page->getPageObject(); $target_page->buildDom(); $target_page->addHierIds(); // move nodes to target page $source_page->buildDom(); $source_page->addHierIds(); ilLMPage::_moveContentAfterHierId($source_page, $target_page, $a_hier_id); //$source_page->deleteContentFromHierId($a_hier_id); return $succ["child"]; } }
/** * Show link help list */ function showLinkHelp() { global $ilUser, $ilCtrl; // filter link types if (!$this->filter_white_list) { foreach ($this->filter_link_types as $link_type) { unset($this->ltypes[$link_type]); } } else { $ltypes = array(); foreach ($this->ltypes as $k => $l) { if (in_array($k, $this->filter_link_types)) { $ltypes[$k] = $l; } } $this->ltypes = $ltypes; } // determine link type and target $this->determineLinkType(); $ltype = $this->link_target != "" ? $this->link_type . "_" . $this->link_target : $this->link_type; $def_type = ilObject::_lookupType($this->default_obj, true); // determine content object id switch ($this->link_type) { case "PageObject": case "StructureObject": if (empty($_SESSION["il_link_cont_obj"]) && ($def_type != "mep" && $def_type != "glo")) { $_SESSION["il_link_cont_obj"] = $this->default_obj; } break; case "GlossaryItem": if (empty($_SESSION["il_link_glossary"]) && $def_type == "glo") { $_SESSION["il_link_glossary"] = $this->default_obj; } break; case "Media": if (empty($_SESSION["il_link_mep"]) && $def_type == "mep") { $_SESSION["il_link_mep"] = $this->default_obj; } break; } /* $target_str = ($link_target == "") ? "" : " target=\"".$link_target."\" ";*/ $target_str = $this->link_target == "" ? "" : " target=\"" . $this->link_target . "\""; //echo "-".$this->link_type."-"; if ($this->link_type == "GlossaryItem" && (empty($_SESSION["il_link_glossary"]) || !in_array(ilObject::_lookupType($_SESSION["il_link_glossary"], true), array("glo")))) { $this->changeTargetObject("glo"); } if (($this->link_type == "PageObject" || $this->link_type == "StructureObject") && (empty($_SESSION["il_link_cont_obj"]) || !in_array(ilObject::_lookupType($_SESSION["il_link_cont_obj"], true), array("lm", "dbk")))) { $this->changeTargetObject("cont_obj"); } if ($ilCtrl->isAsynch()) { $tpl = new ilTemplate("tpl.link_help_asynch.html", true, true, "Modules/LearningModule"); } else { $tpl =& new ilTemplate("tpl.link_help.html", true, true, "Modules/LearningModule"); $tpl->setVariable("LOCATION_STYLESHEET", ilUtil::getStyleSheetLocation()); } switch ($this->link_type) { case "GlossaryItem": $this->ctrl->setParameter($this, "target_type", "glo"); break; case "PageObject": case "StructureObject": $this->ctrl->setParameter($this, "target_type", "cont_obj"); break; case "Media": $this->ctrl->setParameter($this, "target_type", "mep"); break; default: break; } //echo "<br><br>:".$this->ctrl->getFormAction($this).":"; //echo "<br>link_type:".$this->link_type; //echo "<br>cont_obj:".$_SESSION["il_link_cont_obj"]; //echo "<br>link_mep".$_SESSION["il_link_mep"]; //echo $this->ctrl->getFormAction($this, "", "", true); $tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this, "changeLinkType", "", true)); $tpl->setVariable("FORMACTION2", $this->ctrl->getFormAction($this)); $tpl->setVariable("TXT_HELP_HEADER", $this->lng->txt("cont_link_select")); $tpl->setVariable("TXT_TYPE", $this->lng->txt("cont_link_type")); //echo "<br><br>".$ltype; $select_ltype = ilUtil::formSelect($ltype, "ltype", $this->ltypes, false, true, "0", "", array("id" => "ilIntLinkTypeSelector")); $tpl->setVariable("SELECT_TYPE", $select_ltype); $tpl->setVariable("CMD_CHANGETYPE", "changeLinkType"); $tpl->setVariable("BTN_CHANGETYPE", $this->lng->txt("cont_change_type")); /* if ($this->isEnabledJavaScript()) { $tpl->setVariable("BTN_CLOSE_JS", $this->lng->txt("close")); } else {*/ $tpl->setVariable("CMD_CLOSE", "closeLinkHelp"); $tpl->setVariable("BTN_CLOSE", $this->lng->txt("close")); // } $chapterRowBlock = "chapter_row"; $anchor_row_block = "anchor_link"; if ($this->isEnabledJavaScript()) { $chapterRowBlock .= "_js"; $anchor_row_block .= "_js"; } $obj_id = ilObject::_lookupObjId($_SESSION["il_link_cont_obj"]); $type = ilObject::_lookupType($obj_id); // switch link type switch ($this->link_type) { // page link case "PageObject": if ($type == "lm") { require_once "./Modules/LearningModule/classes/class.ilObjLearningModule.php"; $cont_obj = new ilObjLearningModule($_SESSION["il_link_cont_obj"], true); } else { if ($type == "dbk") { require_once "./Modules/LearningModule/classes/class.ilObjDlBook.php"; $cont_obj = new ilObjDlBook($_SESSION["il_link_cont_obj"], true); } } // get all chapters $ctree = $cont_obj->getLMTree(); $nodes = $ctree->getSubtree($ctree->getNodeData($ctree->getRootId())); $tpl->setCurrentBlock("chapter_list"); $tpl->setVariable("TXT_CONTENT_OBJECT", $this->lng->txt("cont_content_obj")); $tpl->setVariable("TXT_CONT_TITLE", $cont_obj->getTitle()); $tpl->setCurrentBlock("change_cont_obj"); $tpl->setVariable("CMD_CHANGE_CONT_OBJ", "changeTargetObject"); $tpl->setVariable("BTN_CHANGE_CONT_OBJ", $this->lng->txt("change")); $tpl->parseCurrentBlock(); foreach ($nodes as $node) { if ($node["type"] == "st") { $tpl->setCurrentBlock("chapter_row"); $tpl->setVariable("TXT_CHAPTER", $node["title"]); $tpl->setVariable("ROWCLASS", "tblrow1"); //$tpl->setVariable("LINK_CHAPTER", // "[iln chap=\"".$node["obj_id"]."\"".$target_str."] [/iln]"); $tpl->parseCurrentBlock(); $tpl->setCurrentBlock("row"); $tpl->parseCurrentBlock(); } if ($node["type"] == "pg") { $this->renderLink($tpl, $node["title"], $node["obj_id"], "PageObject", "pg", "page", ilPageObject::_readAnchors($type, $node["obj_id"])); } } // get all free pages $pages = ilLMPageObject::getPageList($cont_obj->getId()); $free_pages = array(); foreach ($pages as $page) { if (!$ctree->isInTree($page["obj_id"])) { $free_pages[] = $page; } } if (count($free_pages) > 0) { $tpl->setCurrentBlock(str_replace("_js", "", $chapterRowBlock)); $tpl->setVariable("TXT_CHAPTER", $this->lng->txt("cont_free_pages")); $tpl->setVariable("ROWCLASS", "tblrow1"); $tpl->parseCurrentBlock(); foreach ($free_pages as $node) { $this->renderLink($tpl, $node["title"], $node["obj_id"], "PageObject", "pg", "page", ilPageObject::_readAnchors($type, $node["obj_id"])); } } $tpl->setCurrentBlock("chapter_list"); $tpl->parseCurrentBlock(); break; // chapter link // chapter link case "StructureObject": // check whether current object matchs to type if (!in_array(ilObject::_lookupType($_SESSION["il_link_cont_obj"], true), array("lm", "dbk"))) { $this->changeTargetObject("lm"); } if ($type == "lm") { require_once "./Modules/LearningModule/classes/class.ilObjLearningModule.php"; $cont_obj = new ilObjLearningModule($_SESSION["il_link_cont_obj"], true); } else { if ($type == "dbk") { require_once "./Modules/LearningModule/classes/class.ilObjDlBook.php"; $cont_obj = new ilObjDlBook($_SESSION["il_link_cont_obj"], true); } } // get all chapters $ctree =& $cont_obj->getLMTree(); $nodes = $ctree->getSubtree($ctree->getNodeData($ctree->getRootId())); $tpl->setCurrentBlock("chapter_list"); $tpl->setVariable("TXT_CONTENT_OBJECT", $this->lng->txt("cont_content_obj")); $tpl->setVariable("TXT_CONT_TITLE", $cont_obj->getTitle()); $tpl->setCurrentBlock("change_cont_obj"); $tpl->setVariable("CMD_CHANGE_CONT_OBJ", "changeTargetObject"); $tpl->setVariable("BTN_CHANGE_CONT_OBJ", $this->lng->txt("change")); $tpl->parseCurrentBlock(); foreach ($nodes as $node) { if ($node["type"] == "st") { $this->renderLink($tpl, $node["title"], $node["obj_id"], "StructureObject", "st", "chap"); } } $tpl->setCurrentBlock("chapter_list"); $tpl->parseCurrentBlock(); break; // glossary item link // glossary item link case "GlossaryItem": require_once "./Modules/Glossary/classes/class.ilObjGlossary.php"; $glossary =& new ilObjGlossary($_SESSION["il_link_glossary"], true); // get all glossary items $terms = $glossary->getTermList(); $tpl->setCurrentBlock("chapter_list"); $tpl->setVariable("TXT_CONTENT_OBJECT", $this->lng->txt("glossary")); $tpl->setVariable("TXT_CONT_TITLE", $glossary->getTitle()); $tpl->setCurrentBlock("change_cont_obj"); $tpl->setVariable("CMD_CHANGE_CONT_OBJ", "changeTargetObject"); $tpl->setVariable("BTN_CHANGE_CONT_OBJ", $this->lng->txt("change")); $tpl->parseCurrentBlock(); foreach ($terms as $term) { $this->renderLink($tpl, $term["term"], $term["id"], "GlossaryItem", "git", "term"); } $tpl->setCurrentBlock("chapter_list"); $tpl->parseCurrentBlock(); break; // media object // media object case "Media": include_once "./Modules/MediaPool/classes/class.ilMediaPoolItem.php"; //$tpl->setVariable("TARGET2", " target=\"content\" "); // content object id = 0 --> get clipboard objects if ($_SESSION["il_link_mep"] == 0) { $tpl->setCurrentBlock("change_cont_obj"); $tpl->setVariable("CMD_CHANGE_CONT_OBJ", "changeTargetObject"); $tpl->setVariable("BTN_CHANGE_CONT_OBJ", $this->lng->txt("change")); $tpl->parseCurrentBlock(); $mobjs = $this->ilias->account->getClipboardObjects("mob"); // sort by name $objs = array(); foreach ($mobjs as $obj) { $objs[$obj["title"] . ":" . $obj["id"]] = $obj; } ksort($objs); $tpl->setCurrentBlock("chapter_list"); $tpl->setVariable("TXT_CONTENT_OBJECT", $this->lng->txt("cont_media_source")); $tpl->setVariable("TXT_CONT_TITLE", $this->lng->txt("cont_personal_clipboard")); $tpl->setVariable("COLSPAN", "2"); foreach ($objs as $obj) { $this->renderLink($tpl, $obj["title"], $obj["id"], "MediaObject", "mob", "media"); } $tpl->setCurrentBlock("chapter_list"); $tpl->parseCurrentBlock(); } else { require_once "./Modules/MediaPool/classes/class.ilObjMediaPool.php"; $med_pool =& new ilObjMediaPool($_SESSION["il_link_mep"], true); // get current folders $fobjs = $med_pool->getChilds($_SESSION["il_link_mep_obj"], "fold"); $f2objs = array(); foreach ($fobjs as $obj) { $f2objs[$obj["title"] . ":" . $obj["child"]] = $obj; } ksort($f2objs); // get current media objects $mobjs = $med_pool->getChilds($_SESSION["il_link_mep_obj"], "mob"); $m2objs = array(); foreach ($mobjs as $obj) { $m2objs[$obj["title"] . ":" . $obj["child"]] = $obj; } ksort($m2objs); // merge everything together $objs = array_merge($f2objs, $m2objs); $tpl->setCurrentBlock("chapter_list"); $tpl->setVariable("TXT_CONTENT_OBJECT", $this->lng->txt("mep")); $tpl->setVariable("TXT_CONT_TITLE", $med_pool->getTitle()); $tpl->setCurrentBlock("change_cont_obj"); $tpl->setVariable("CMD_CHANGE_CONT_OBJ", "changeTargetObject"); $tpl->setVariable("BTN_CHANGE_CONT_OBJ", $this->lng->txt("change")); $tpl->setVariable("COLSPAN", "2"); $tpl->parseCurrentBlock(); if ($parent_id = $med_pool->getParentId($_SESSION["il_link_mep_obj"])) { $css_row = "tblrow1"; $tpl->setCurrentBlock("icon"); $tpl->setVariable("ICON_SRC", ilUtil::getImagePath("icon_fold.png")); $tpl->parseCurrentBlock(); $tpl->setCurrentBlock("link_row"); $tpl->setVariable("ROWCLASS", $css_row); $tpl->setVariable("TXT_CHAPTER", ".."); $this->ctrl->setParameter($this, "mep_fold", $parent_id); if ($ilCtrl->isAsynch()) { $tpl->setVariable("LINK", "#"); $tpl->setVariable("LR_ONCLICK", " onclick=\"return il.IntLink.setMepPoolFolder('" . $parent_id . "');\" "); } else { $tpl->setVariable("LINK", $this->ctrl->getLinkTarget($this, "setMedPoolFolder")); } $tpl->parseCurrentBlock(); $tpl->setCurrentBlock("row"); $tpl->parseCurrentBlock(); } foreach ($objs as $obj) { if ($obj["type"] == "fold") { $css_row = $css_row == "tblrow2" ? "tblrow1" : "tblrow2"; $tpl->setCurrentBlock("icon"); $tpl->setVariable("ICON_SRC", ilUtil::getImagePath("icon_fold.png")); $tpl->parseCurrentBlock(); $tpl->setCurrentBlock("link_row"); $tpl->setVariable("ROWCLASS", $css_row); $tpl->setVariable("TXT_CHAPTER", $obj["title"]); $this->ctrl->setParameter($this, "mep_fold", $obj["child"]); if ($ilCtrl->isAsynch()) { $tpl->setVariable("LINK", "#"); $tpl->setVariable("LR_ONCLICK", " onclick=\"return il.IntLink.setMepPoolFolder('" . $obj["child"] . "');\" "); } else { $tpl->setVariable("LINK", $this->ctrl->getLinkTarget($this, "setMedPoolFolder")); } $tpl->parseCurrentBlock(); } else { $fid = ilMediaPoolItem::lookupForeignId($obj["child"]); if (ilObject::_lookupType($fid) == "mob") { $this->renderLink($tpl, $obj["title"], $fid, "MediaObject", "mob", "media"); } } $tpl->setCurrentBlock("row"); $tpl->parseCurrentBlock(); } $tpl->setCurrentBlock("chapter_list"); $tpl->parseCurrentBlock(); } break; // repository item // repository item case "RepositoryItem": $tpl->setVariable("LINK_HELP_CONTENT", $this->selectRepositoryItem()); break; // file download link // file download link case "File": if (!is_object($this->uploaded_file)) { $tpl->setVariable("LINK_HELP_CONTENT", $this->getFileLinkHTML()); } else { echo $this->getFileLinkHTML(); exit; } break; } if ($ilCtrl->isAsynch()) { echo $tpl->get(); exit; } exit; }