/** * 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"]; }
/** * get path ids (adjacenca and nested set) * @group IL_Init * @param * @return */ public function testAllOthers() { $tree = new ilTree(ROOT_FOLDER_ID); $d = $tree->getDepth(24); $this->assertEquals($d, 4); $node = $tree->getNodeData(24); $this->assertEquals($node['title'], 'Public chat'); $bool = $tree->isInTree(24); $this->assertEquals($bool, true); $bool = $tree->isInTree(24242424); $this->assertEquals($bool, false); /* ref_id 14 => obj_id 98 does not exist $node = $tree->getParentNodeData(24); $this->assertEquals($node['title'],'Chat-Server'); */ $bool = $tree->isGrandChild(9, 24); $this->assertEquals($bool, 1); /* see above $node = $tree->getNodeDataByType('chac'); $this->assertEquals($node[0]['title'],'Chat-Server'); */ $bool = $tree->isDeleted(24); $this->assertEquals($bool, false); $id = $tree->getParentId(24); $this->assertEquals($id, 14); $lft = $tree->getLeftValue(24); $this->assertEquals($lft, 14); $seq = $tree->getChildSequenceNumber($tree->getNodeData(24)); $this->assertEquals($seq, 1); $tree->getNodePath(9, 1); $max_depth = $tree->getMaximumDepth(); // Round trip $tree = new ilTree(ROOT_FOLDER_ID); $suc = $tree->fetchSuccessorNode(16); // cals $cals = $tree->fetchPredecessorNode($suc['child']); $this->assertEquals($cals['child'], 16); }
/** * get presentation title * */ function _getPresentationTitle($a_st_id, $a_include_numbers = false, $a_time_scheduled_activation = false) { global $ilDB; // 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); $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"]; }