4 include_once(
"./Services/DataSet/classes/class.ilDataSet.php");
29 return array(
"4.3.0");
40 return "http://www.ilias.de/xml/Services/Taxonomy/".$a_entity;
49 protected function getTypes($a_entity, $a_version)
52 if ($a_entity ==
"tax")
60 "Description" =>
"text",
61 "SortingMode" =>
"integer");
66 if ($a_entity ==
"tax_usage")
79 if ($a_entity ==
"tax_tree")
87 "Parent" =>
"integer",
91 "OrderNr" =>
"integer"
97 if ($a_entity ==
"tax_node_assignment")
103 "NodeId" =>
"integer",
104 "Component" =>
"text",
105 "ItemType" =>
"text",
106 "ItemId" =>
"integer"
119 function readData($a_entity, $a_version, $a_ids, $a_field =
"")
123 if (!is_array($a_ids))
125 $a_ids = array($a_ids);
129 if ($a_entity ==
"tax")
136 " FROM tax_data JOIN object_data ON (tax_data.id = object_data.obj_id) ".
138 $ilDB->in(
"id", $a_ids,
false,
"integer"));
144 if ($a_entity ==
"tax_usage")
152 $ilDB->in(
"tax_id", $a_ids,
false,
"integer"));
158 if ($a_entity ==
"tax_tree")
164 " ,parent,depth,type,title,order_nr ".
165 " FROM tax_tree JOIN tax_node ON (child = obj_id) ".
167 $ilDB->in(
"tax_id", $a_ids,
false,
"integer").
174 if ($a_entity ==
"tax_node_assignment")
180 " FROM tax_node_assignment ".
182 $ilDB->in(
"node_id", $a_ids,
false,
"integer"));
198 "tax_tree" => array(
"ids" => $a_rec[
"Id"]),
199 "tax_usage" => array(
"ids" => $a_rec[
"Id"])
203 "tax_node_assignment" => array(
"ids" => $a_rec[
"Child"])
220 function importRecord($a_entity, $a_types, $a_rec, $a_mapping, $a_schema_version)
228 include_once(
"./Services/Taxonomy/classes/class.ilObjTaxonomy.php");
240 $newObj->setTitle($a_rec[
"Title"]);
241 $newObj->setDescription($a_rec[
"Description"]);
242 $newObj->setSortingMode($a_rec[
"SortingMode"]);
245 $this->current_obj = $newObj;
246 $a_mapping->addMapping(
"Services/Taxonomy",
"tax", $a_rec[
"Id"], $newObj->getId());
250 switch ($a_rec[
"Type"])
253 $parent = (int) $a_mapping->getMapping(
"Services/Taxonomy",
"tax_tree", $a_rec[
"Parent"]);
254 $tax_id = $a_mapping->getMapping(
"Services/Taxonomy",
"tax", $a_rec[
"TaxId"]);
257 $parent = $this->current_obj->getTree()->readRootId();
260 $node->setTitle($a_rec[
"Title"]);
261 $node->setOrderNr($a_rec[
"OrderNr"]);
262 $node->setTaxonomyId($tax_id);
265 $a_mapping->addMapping(
"Services/Taxonomy",
"tax_tree", $a_rec[
"Child"],
271 case "tax_node_assignment":
272 $new_item_id = (int) $a_mapping->getMapping(
"Services/Taxonomy",
"tax_item",
273 $a_rec[
"Component"].
":".$a_rec[
"ItemType"].
":".$a_rec[
"ItemId"]);
274 $new_node_id = (int) $a_mapping->getMapping(
"Services/Taxonomy",
"tax_tree", $a_rec[
"NodeId"]);
278 $new_item_id_obj = (int) $a_mapping->getMapping(
"Services/Taxonomy",
"tax_item_obj_id",
279 $a_rec[
"Component"].
":".$a_rec[
"ItemType"].
":".$a_rec[
"ItemId"]);
280 if ($new_item_id > 0 && $new_node_id > 0 && $new_item_id_obj > 0)
282 include_once(
"./Services/Taxonomy/classes/class.ilTaxNodeAssignment.php");
283 $node_ass =
new ilTaxNodeAssignment($a_rec[
"Component"], $new_item_id_obj, $a_rec[
"ItemType"], $this->current_obj->getId());
289 $usage = $a_mapping->getMapping(
"Services/Taxonomy",
"tax_usage_of_obj", $a_rec[
"ObjId"]);
294 $a_mapping->addMapping(
"Services/Taxonomy",
"tax_usage_of_obj", $a_rec[
"ObjId"],
295 $this->current_obj->getId());