function dbImportLM($node, $parent_id = "", $a_import_sequencing = false) { switch ($node->getName()) { case "manifest": $this->slm_tree =& new ilTree($this->slm->getId()); $this->slm_tree->setTreeTablePK("slm_id"); $this->slm_tree->setTableNames('sahs_sc13_tree', 'sahs_sc13_tree_node'); $this->slm_tree->addTree($this->slm->getId(), 1); //add seqinfo for rootNode include_once "./Modules/Scorm2004/classes/seq_editor/class.ilSCORM2004Sequencing.php"; $seq_info = new ilSCORM2004Sequencing($this->slm->getId(), true); // get original sequencing information $r = $this->mani_xpath->query("/d:manifest/d:organizations/d:organization/imsss:sequencing"); $this->imsmanifest->formatOutput = false; if ($r) { $this->setSequencingInfo($r->item(0), $seq_info, $a_import_sequencing); if ($a_import_sequencing) { $seq_info->initDom(); } } $seq_info->insert(); if (file_exists($this->packageFolder . '/' . 'index.xml')) { $doc = simplexml_load_file($this->packageFolder . '/' . 'index.xml'); $l = $doc->xpath("/ContentObject/MetaData"); if ($l[0]) { include_once 'Services/MetaData/classes/class.ilMDXMLCopier.php'; $mdxml =& new ilMDXMLCopier($l[0]->asXML(), $this->slm->getId(), $this->slm->getId(), $this->slm->getType()); $mdxml->startParsing(); $mdxml->getMDObject()->update(); } } break; case "organization": $this->slm->title = $node->title; break; case "item": $a = $node->attributes(); if (preg_match("/il_\\d+_chap_\\d+/", $a['identifier'])) { $chap =& new ilSCORM2004Chapter($this->slm); $chap->setTitle($node->title); $chap->setSLMId($this->slm->getId()); $chap->create(true); // save sequencing information $r = $this->mani_xpath->query("//d:item[@identifier='" . $a['identifier'] . "']/imsss:sequencing"); if ($r) { $seq_info = new ilSCORM2004Sequencing($chap->getId()); $this->setSequencingInfo($r->item(0), $seq_info, $a_import_sequencing); $seq_info->initDom(); $seq_info->insert(); } ilSCORM2004Node::putInTree($chap, $parent_id, ""); $parent_id = $chap->getId(); $doc = simplexml_load_file($this->packageFolder . '/' . 'index.xml'); $l = $doc->xpath("/ContentObject/StructureObject/MetaData[General/Identifier/@Entry='" . $a['identifier'] . "']"); if ($l[0]) { include_once 'Services/MetaData/classes/class.ilMDXMLCopier.php'; $mdxml =& new ilMDXMLCopier($l[0]->asXML(), $this->slm->getId(), $chap->getId(), $chap->getType()); $mdxml->startParsing(); $mdxml->getMDObject()->update(); } } if (preg_match("/il_\\d+_sco_(\\d+)/", $a['identifier'], $match)) { $sco = new ilSCORM2004Sco($this->slm); $sco->setTitle($node->title); $sco->setSLMId($this->slm->getId()); $sco->create(true); // save sequencing information $r = $this->mani_xpath->query("//d:item[@identifier='" . $a['identifier'] . "']/imsss:sequencing"); if ($r) { $seq_info = new ilSCORM2004Sequencing($sco->getId()); $this->setSequencingInfo($r->item(0), $seq_info, $a_import_sequencing, "local_obj_" . $sco->getID() . "_0"); $seq_info->initDom(); $seq_info->insert(); } ilSCORM2004Node::putInTree($sco, $parent_id, ""); $newPack = new ilSCORM13Package(); $newPack->il_importSco($this->slm->getId(), $sco->getId(), $this->packageFolder . "/" . $match[1]); $parent_id = $sco->getId(); } if (preg_match("/il_\\d+_ass_(\\d+)/", $a['identifier'], $match)) { $ass = new ilSCORM2004Asset($this->slm); $ass->setTitle($node->title); $ass->setSLMId($this->slm->getId()); $ass->create(true); // save sequencing information $r = $this->mani_xpath->query("//d:item[@identifier='" . $a['identifier'] . "']/imsss:sequencing"); if ($r) { $seq_info = new ilSCORM2004Sequencing($ass->getId()); $this->setSequencingInfo($r->item(0), $seq_info, $a_import_sequencing, "local_obj_" . $ass->getID() . "_0"); $seq_info->initDom(); $seq_info->insert(); } ilSCORM2004Node::putInTree($ass, $parent_id, ""); $newPack = new ilSCORM13Package(); $newPack->il_importAss($this->slm->getId(), $ass->getId(), $this->packageFolder . "/" . $match[1]); $parent_id = $ass->getId(); } break; } foreach ($node->children() as $child) { $this->dbImportLM($child, $parent_id, $a_import_sequencing); } }