/** * Get multi lang header * * @param * @return */ static function getMultiLangHeader($a_lm_id, $a_gui_class) { global $lng, $ilCtrl; // multi language include_once "./Services/COPage/classes/class.ilPageMultiLang.php"; $ml = new ilPageMultiLang("lm", $a_lm_id); if ($ml->getActivated()) { $lng->loadLanguageModule("meta"); // info include_once "./Services/COPage/classes/class.ilPageMultiLangGUI.php"; $ml_gui = new ilPageMultiLangGUI("lm", $a_lm_id); include_once "./Services/COPage/classes/class.ilPageMultiLangGUI.php"; $ml_head = $ml_gui->getMultiLangInfo($_GET["transl"]); // language switch include_once "./Services/UIComponent/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php"; $list = new ilAdvancedSelectionListGUI(); $list->setListTitle($lng->txt("actions")); $list->setId("copage_act"); $entries = false; if (!in_array($_GET["transl"], array("", "-"))) { $l = $ml->getMasterLanguage(); $list->addItem($lng->txt("cont_edit_language_version") . ": " . $lng->txt("meta_l_" . $l), "", $ilCtrl->getLinkTarget($a_gui_class, "editMasterLanguage")); $entries = true; } foreach ($ml->getLanguages() as $al) { if ($_GET["transl"] != $al) { $ilCtrl->setParameter($a_gui_class, "totransl", $al); $list->addItem($lng->txt("cont_edit_language_version") . ": " . $lng->txt("meta_l_" . $al), "", $ilCtrl->getLinkTarget($a_gui_class, "switchToLanguage")); $ilCtrl->setParameter($a_gui_class, "totransl", $_GET["totransl"]); } $entries = true; } if ($entries) { $ml_head = '<div class="ilFloatLeft">' . $ml_head . '</div><div style="margin: 5px 0;" class="small ilRight">' . $list->getHTML() . "</div>"; } } return $ml_head; }
/** * get presentation title * */ function _getPresentationTitle($a_st_id, $a_include_numbers = false, $a_time_scheduled_activation = false, $a_lm_id = 0, $a_lang = "-") { global $ilDB; if ($a_lm_id == 0) { $a_lm_id = ilLMObject::_lookupContObjID($a_st_id); } // @todo: optimize include_once "./Services/COPage/classes/class.ilPageMultiLang.php"; $ml = new ilPageMultiLang("lm", $a_lm_id); // get chapter data $query = "SELECT * FROM lm_data WHERE obj_id = " . $ilDB->quote($a_st_id, "integer"); $st_set = $ilDB->query($query); $st_rec = $ilDB->fetchAssoc($st_set); if ($a_lang != "-" && $ml->getActivated() && in_array($a_lang, $ml->getLanguages())) { include_once "./Modules/LearningModule/classes/class.ilLMObjTranslation.php"; $lmobjtrans = new ilLMObjTranslation($a_st_id, $a_lang); if ($lmobjtrans->getTitle() != "") { $st_rec["title"] = $lmobjtrans->getTitle(); } } $tree = new ilTree($st_rec["lm_id"]); $tree->setTableNames('lm_tree', 'lm_data'); $tree->setTreeTablePK("lm_id"); if ($a_include_numbers) { if ($tree->isInTree($st_rec["obj_id"])) { // get chapter tree node $query = "SELECT * FROM lm_tree WHERE child = " . $ilDB->quote($a_st_id, "integer") . " AND lm_id = " . $ilDB->quote($st_rec["lm_id"], "integer"); $tree_set = $ilDB->query($query); $tree_node = $tree_set->fetchRow(DB_FETCHMODE_ASSOC); $depth = $tree_node["depth"]; $nr = $tree->getChildSequenceNumber($tree_node, "st") . " "; for ($i = $depth - 1; $i > 1; $i--) { // get next parent tree node $query = "SELECT * FROM lm_tree WHERE child = " . $ilDB->quote($tree_node["parent"], "integer") . " AND lm_id = " . $ilDB->quote($st_rec["lm_id"], "integer"); $tree_set = $ilDB->query($query); $tree_node = $tree_set->fetchRow(DB_FETCHMODE_ASSOC); $seq = $tree->getChildSequenceNumber($tree_node, "st"); $nr = $seq . "." . $nr; } } } return $nr . $st_rec["title"]; }
/** * 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, $a_lm_id = 0, $a_lang = "-") { global $ilDB, $ilUser; if ($a_lm_id == 0) { $a_lm_id = ilLMObject::_lookupContObjID($a_pg_id); } // @todo: optimize include_once "./Services/COPage/classes/class.ilPageMultiLang.php"; $ml = new ilPageMultiLang("lm", $a_lm_id); // 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_lang != "-" && $ml->getActivated() && in_array($a_lang, $ml->getLanguages())) { include_once "./Modules/LearningModule/classes/class.ilLMObjTranslation.php"; $lmobjtrans = new ilLMObjTranslation($a_pg_id, $a_lang); if ($lmobjtrans->getTitle() != "") { $pg_rec["title"] = $lmobjtrans->getTitle(); } } 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 "./Modules/LearningModule/classes/class.ilLMPage.php"; $active = ilLMPage::_lookupActive($child["obj_id"], ilObject::_lookupType($pg_rec["lm_id"]), $a_time_scheduled_activation); if (!$active) { $act_data = ilLMPage::_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"]; } }
/** * Add multi-language actions to menu * * @param * @return */ function addMultiLangActionsAndInfo($a_list, $a_tpl) { global $lng, $ilCtrl; $any_items = false; $cfg = $this->getPageConfig(); // general multi lang support and single page mode? if ($cfg->getMultiLangSupport()) { include_once "./Services/COPage/classes/class.ilPageMultiLang.php"; $ml = new ilPageMultiLang($this->getPageObject()->getParentType(), $this->getPageObject()->getParentId()); if (!$ml->getActivated()) { if ($cfg->getSinglePageMode()) { $a_list->addItem($lng->txt("cont_activate_multi_lang"), "", $ilCtrl->getLinkTargetByClass("ilpagemultilanggui", "activateMultilinguality")); $any_items = true; } } else { $lng->loadLanguageModule("meta"); if ($cfg->getSinglePageMode()) { $a_list->addItem($lng->txt("cont_deactivate_multi_lang"), "", $ilCtrl->getLinkTarget($this, "confirmDeactivateMultiLanguage")); } if ($this->getPageObject()->getLanguage() != "-") { $l = $ml->getMasterLanguage(); $a_list->addItem($lng->txt("cont_edit_language_version") . ": " . $lng->txt("meta_l_" . $l), "", $ilCtrl->getLinkTarget($this, "editMasterLanguage")); } foreach ($ml->getLanguages() as $al) { if ($this->getPageObject()->getLanguage() != $al) { $ilCtrl->setParameter($this, "totransl", $al); $a_list->addItem($lng->txt("cont_edit_language_version") . ": " . $lng->txt("meta_l_" . $al), "", $ilCtrl->getLinkTarget($this, "switchToLanguage")); $ilCtrl->setParameter($this, "totransl", $_GET["totransl"]); } } include_once "./Services/COPage/classes/class.ilPageMultiLangGUI.php"; $ml_gui = new ilPageMultiLangGUI($this->getPageObject()->getParentType(), $this->getPageObject()->getParentId()); $a_tpl->setVariable("MULTI_LANG_INFO", $ml_gui->getMultiLangInfo($this->getPageObject()->getLanguage())); $any_items = true; } } return $any_items; }
/** * Get container page HTML */ function getContainerPageHTML() { global $ilSetting, $ilUser; if (!$ilSetting->get("enable_cat_page_edit")) { return; } // old page editor content $xpage_id = ilContainer::_lookupContainerSetting($this->object->getId(), "xhtml_page"); if ($xpage_id > 0) { include_once "Services/XHTMLPage/classes/class.ilXHTMLPage.php"; $xpage = new ilXHTMLPage($xpage_id); return $xpage->getContent(); } // page object // if page does not exist, return nothing include_once "./Services/COPage/classes/class.ilPageUtil.php"; if (!ilPageUtil::_existsAndNotEmpty("cont", $this->object->getId())) { return ""; } include_once "./Services/Container/classes/class.ilContainerPage.php"; include_once "./Services/Container/classes/class.ilContainerPageGUI.php"; include_once "./Services/Style/classes/class.ilObjStyleSheet.php"; $this->tpl->setVariable("LOCATION_CONTENT_STYLESHEET", ilObjStyleSheet::getContentStylePath($this->object->getStyleSheetId())); $this->tpl->setCurrentBlock("SyntaxStyle"); $this->tpl->setVariable("LOCATION_SYNTAX_STYLESHEET", ilObjStyleSheet::getSyntaxStylePath()); $this->tpl->parseCurrentBlock(); // get page object include_once "./Services/COPage/classes/class.ilPageMultiLang.php"; $ml = new ilPageMultiLang("cont", $this->object->getId()); $lang = $ml->getEffectiveLang($ilUser->getLanguage()); $page_gui = new ilContainerPageGUI($this->object->getId(), 0, $lang); include_once "./Services/Style/classes/class.ilObjStyleSheet.php"; $page_gui->setStyleId(ilObjStyleSheet::getEffectiveContentStyleId($this->object->getStyleSheetId(), $this->object->getType())); $page_gui->setPresentationTitle(""); $page_gui->setTemplateOutput(false); $page_gui->setHeader(""); $ret = $page_gui->showPage(); //$ret =& $page_gui->executeCommand(); return $ret; }
/** * Copy multilinguality settings * * @param string $a_target_parent_type parent object type * @param int $a_target_parent_id parent object id * @return ilPageMultiLang target multilang object */ function copy($a_target_parent_type, $a_target_parent_id) { if ($this->getActivated()) { $target_ml = new ilPageMultiLang($a_target_parent_type, $a_target_parent_id); $target_ml->setMasterLanguage($this->getMasterLanguage()); $target_ml->setLanguages($this->getLanguages()); $target_ml->save(); return $target_ml; } return null; }