/** * put chapter into tree */ function putInTree() { //echo "st:putInTree"; // chapters should be behind pages in the tree // so if target is first node, the target is substituted with // the last child of type pg if ($_GET["target"] == IL_FIRST_NODE) { $tree = new ilTree($this->content_object->getId()); $tree->setTableNames('lm_tree', 'lm_data'); $tree->setTreeTablePK("lm_id"); // determine parent node id $parent_id = !empty($_GET["obj_id"]) ? $_GET["obj_id"] : $tree->getRootId(); // determine last child of type pg $childs =& $tree->getChildsByType($parent_id, "pg"); if (count($childs) != 0) { $_GET["target"] = $childs[count($childs) - 1]["obj_id"]; } } if (empty($_GET["target"])) { $_GET["target"] = IL_LAST_NODE; } parent::putInTree(); }
/** * put this object into content object tree */ static function putInTree($a_obj, $a_parent_id = "", $a_target_node_id = "") { global $ilLog; $tree = new ilTree($a_obj->getContentObject()->getId()); $tree->setTableNames('lm_tree', 'lm_data'); $tree->setTreeTablePK("lm_id"); // determine parent $parent_id = $a_parent_id != "" ? $a_parent_id : $tree->getRootId(); // determine target if ($a_target_node_id != "") { $target = $a_target_node_id; } else { // determine last child that serves as predecessor if ($a_obj->getType() == "st") { $s_types = array("st", "pg"); $childs =& $tree->getChildsByTypeFilter($parent_id, $s_types); } else { $s_types = "pg"; $childs =& $tree->getChildsByType($parent_id, $s_types); } if (count($childs) == 0) { $target = IL_FIRST_NODE; } else { $target = $childs[count($childs) - 1]["obj_id"]; } } if ($tree->isInTree($parent_id) && !$tree->isInTree($a_obj->getId())) { $ilLog->write("LMObject::putInTree: insertNode, ID: " . $a_obj->getId() . "Parent ID: " . $parent_id . ", Target: " . $target); $tree->insertNode($a_obj->getId(), $parent_id, $target); } }
function exportHTMLScoObjects($a_inst, $a_target_dir, &$expLog, $a_one_file = "") { global $ilBench; $tree = new ilTree($this->getId()); $tree->setTableNames('sahs_sc13_tree', 'sahs_sc13_tree_node'); $tree->setTreeTablePK("slm_id"); // copy all necessary files now if ($a_one_file != "") { $this->prepareHTMLExporter($a_target_dir); // put header into file $sco_tpl = new ilTemplate("tpl.sco.html", true, true, "Modules/Scorm2004"); include_once "./Services/COPage/classes/class.ilCOPageHTMLExport.php"; $sco_tpl = ilCOPageHTMLExport::getPreparedMainTemplate($sco_tpl); $sco_tpl->setCurrentBlock("js_file"); $sco_tpl->setVariable("JS_FILE", "./js/pure.js"); $sco_tpl->parseCurrentBlock(); $sco_tpl->setCurrentBlock("js_file"); $sco_tpl->setVariable("JS_FILE", "./js/question_handling.js"); $sco_tpl->parseCurrentBlock(); $sco_tpl->setCurrentBlock("head"); $sco_tpl->parseCurrentBlock(); fputs($a_one_file, $sco_tpl->get("head")); // toc include_once "./Modules/Scorm2004/classes/class.ilContObjectManifestBuilder.php"; $manifestBuilder = new ilContObjectManifestBuilder($this); $manifestBuilder->buildManifest('12'); $xsl = file_get_contents("./Modules/Scorm2004/templates/xsl/module.xsl"); $xml = simplexml_load_string($manifestBuilder->writer->xmlDumpMem()); $args = array('/_xml' => $xml->organizations->organization->asXml(), '/_xsl' => $xsl); $xh = xslt_create(); $params = array("one_page" => "y"); $output = xslt_process($xh, "arg:/_xml", "arg:/_xsl", NULL, $args, $params); xslt_free($xh); fputs($a_one_file, $output); } foreach ($tree->getSubTree($tree->getNodeData($tree->getRootId()), true, 'sco') as $sco) { include_once "./Modules/Scorm2004/classes/class.ilSCORM2004Sco.php"; $sco_folder = $a_target_dir . "/" . $sco['obj_id']; ilUtil::makeDir($sco_folder); $node = new ilSCORM2004Sco($this, $sco['obj_id']); if ($a_one_file == "") { $node->exportHTML($a_inst, $sco_folder, $expLog, $a_one_file); } else { $node->exportHTMLPageObjects($a_inst, $a_target_dir, $expLog, 'full', "sco", $a_one_file, $sco_tpl); } if ($this->getAssignedGlossary() != 0) { include_once "./Modules/Glossary/classes/class.ilObjGlossary.php"; $glos = new ilObjGlossary($this->getAssignedGlossary(), false); //$glos->exportHTML($sco_folder."/glossary", $expLog); } } // copy all necessary files now if ($a_one_file != "") { // put tail into file fputs($a_one_file, $sco_tpl->get("tail")); } }
function getRootFolder() { $a_tree_id = $_SESSION["AccountId"]; $tree = new ilTree($a_tree_id); $tree->setTableNames('bookmark_tree', 'bookmark_data'); return $tree->getRootId(); }
function updateQuickEdit_scorm_propagate($request, $type) { $module_id = $this->md_obj->obj_id; if ($this->md_obj->obj_type == 'sco') { $module_id = $this->md_obj->rbac_id; } $tree = new ilTree($module_id); $tree->setTableNames('sahs_sc13_tree', 'sahs_sc13_tree_node'); $tree->setTreeTablePK("slm_id"); foreach ($tree->getSubTree($tree->getNodeData($tree->getRootId()), true, 'sco') as $sco) { $sco_md = new ilMD($module_id, $sco['obj_id'], 'sco'); if ($_POST[$request] != "") { $sco_md_section; if (!is_object($sco_md_section = $sco_md->getLifecycle())) { $sco_md_section = $sco_md->addLifecycle(); $sco_md_section->save(); } // determine all entered authors $auth_arr = explode(",", $_POST[$request]); for ($i = 0; $i < count($auth_arr); $i++) { $auth_arr[$i] = trim($auth_arr[$i]); } $md_con_author = ""; // update existing author entries (delete if not entered) foreach ($ids = $sco_md_section->getContributeIds() as $con_id) { $md_con = $sco_md_section->getContribute($con_id); if ($md_con->getRole() == $type) { foreach ($ent_ids = $md_con->getEntityIds() as $ent_id) { $md_ent = $md_con->getEntity($ent_id); // entered author already exists if (in_array($md_ent->getEntity(), $auth_arr)) { unset($auth_arr[array_search($md_ent->getEntity(), $auth_arr)]); } else { $md_ent->delete(); } } $md_con_author = $md_con; } } // insert enterd, but not existing authors if (count($auth_arr) > 0) { if (!is_object($md_con_author)) { $md_con_author = $sco_md_section->addContribute(); $md_con_author->setRole($type); $md_con_author->save(); } foreach ($auth_arr as $auth) { $md_ent = $md_con_author->addEntity(); $md_ent->setEntity(ilUtil::stripSlashes($auth)); $md_ent->save(); } } } else { if (is_object($sco_md_section = $sco_md->getLifecycle())) { foreach ($ids = $sco_md_section->getContributeIds() as $con_id) { $md_con = $sco_md_section->getContribute($con_id); if ($md_con->getRole() == $type) { $md_con->delete(); } } } } $sco_md->update(); } $this->updateQuickEdit_scorm(); }
/** * put this object into content object tree */ function putInTree() { $tree = new ilTree($this->content_object->getId()); $tree->setTableNames('lm_tree', 'lm_data'); $tree->setTreeTablePK("lm_id"); $parent_id = !empty($_GET["obj_id"]) ? $_GET["obj_id"] : $tree->getRootId(); if (!empty($_GET["target"])) { $target = $_GET["target"]; } else { // determine last child of current type $childs =& $tree->getChildsByType($parent_id, $this->obj->getType()); if (count($childs) == 0) { $target = IL_FIRST_NODE; } else { $target = $childs[count($childs) - 1]["obj_id"]; } } if (!$tree->isInTree($this->obj->getId())) { $tree->insertNode($this->obj->getId(), $parent_id, $target); } }
/** * get all subobject (structure and page objects) of a lm * * @access protected * @return */ protected function getAllSubObjects($a_ref_id) { $tree = new ilTree(ilObject::_lookupObjId($a_ref_id)); $tree->setTableNames('lm_tree', 'lm_data'); $tree->setTreeTablePK("lm_id"); foreach ($tree->getSubTree($tree->getNodeData($tree->getRootId())) as $node) { if ($node['type'] == 'st' or $node['type'] == 'pg') { $depth = $node['depth'] - 1; $child = $node['child']; $chapter[$child]['depth'] = $depth; $chapter[$child]['type'] = $node['type']; } } return $chapter ? $chapter : array(); }