/** * Import record * * @param * @return */ function importRecord($a_entity, $a_types, $a_rec, $a_mapping, $a_schema_version) { //echo $a_entity; //var_dump($a_rec); switch ($a_entity) { case "tax": include_once "./Services/Taxonomy/classes/class.ilObjTaxonomy.php"; // if($new_id = $a_mapping->getMapping('Services/Container','objs',$a_rec['Id'])) // { // $newObj = ilObjectFactory::getInstanceByObjId($new_id,false); // } // else // { $newObj = new ilObjTaxonomy(); $newObj->create(); // } $newObj->setTitle($a_rec["Title"]); $newObj->setDescription($a_rec["Description"]); $newObj->setSortingMode($a_rec["SortingMode"]); $newObj->update(); $this->current_obj = $newObj; $a_mapping->addMapping("Services/Taxonomy", "tax", $a_rec["Id"], $newObj->getId()); break; case "tax_tree": switch ($a_rec["Type"]) { case "taxn": $parent = (int) $a_mapping->getMapping("Services/Taxonomy", "tax_tree", $a_rec["Parent"]); $tax_id = $a_mapping->getMapping("Services/Taxonomy", "tax", $a_rec["TaxId"]); if ($parent == 0) { $parent = $this->current_obj->getTree()->readRootId(); } $node = new ilTaxonomyNode(); $node->setTitle($a_rec["Title"]); $node->setOrderNr($a_rec["OrderNr"]); $node->setTaxonomyId($tax_id); $node->create(); ilTaxonomyNode::putInTree($tax_id, $node, (int) $parent, "", $a_rec["OrderNr"]); $a_mapping->addMapping("Services/Taxonomy", "tax_tree", $a_rec["Child"], $node->getId()); break; } case "tax_node_assignment": $new_item_id = (int) $a_mapping->getMapping("Services/Taxonomy", "tax_item", $a_rec["Component"] . ":" . $a_rec["ItemType"] . ":" . $a_rec["ItemId"]); $new_node_id = (int) $a_mapping->getMapping("Services/Taxonomy", "tax_tree", $a_rec["NodeId"]); if ($new_item_id > 0 && $new_node_id > 0) { include_once "./Services/Taxonomy/classes/class.ilTaxNodeAssignment.php"; $node_ass = new ilTaxNodeAssignment($a_rec["Component"], $a_rec["ItemType"], $this->current_obj->getId()); $node_ass->addAssignment($new_node_id, $new_item_id); } break; case "tax_usage": $usage = $a_mapping->getMapping("Services/Taxonomy", "tax_usage_of_obj", $a_rec["ObjId"]); if ($usage != "") { $usage .= ":"; } $a_mapping->addMapping("Services/Taxonomy", "tax_usage_of_obj", $a_rec["ObjId"], $this->current_obj->getId()); break; } }