ILIAS  release_4-3 Revision
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilTaxonomyDataSet Class Reference

Taxonomy data set class. More...

+ Inheritance diagram for ilTaxonomyDataSet:
+ Collaboration diagram for ilTaxonomyDataSet:

Public Member Functions

 getSupportedVersions ()
 Get supported versions.
 getXmlNamespace ($a_entity, $a_schema_version)
 Get xml namespace.
 readData ($a_entity, $a_version, $a_ids, $a_field="")
 Read data.
 importRecord ($a_entity, $a_types, $a_rec, $a_mapping, $a_schema_version)
 Import record.
- Public Member Functions inherited from ilDataSet
 __construct ()
 Constructor.
 init ($a_entity, $a_schema_version)
 Init.
 readData ($a_entity, $a_version, $a_ids)
 Read data from DB.
 setExportDirectories ($a_relative, $a_absolute)
 Set export directories.
 setImportDirectory ($a_val)
 Set import directory.
 getImportDirectory ()
 Get import directory.
 setDSPrefix ($a_val)
 Set XML dataset namespace prefix.
 getDSPrefix ()
 Get XML dataset namespace prefix.
 getDSPrefixString ()
 getDirectDataFromQuery ($a_query, $a_convert_to_leading_upper=true)
 Get data from query.This is a standard procedure, all db field names are directly mapped to abstract fields.
 convertToLeadingUpper ($a_str)
 Make xyz_abc a XyzAbc string.
 getJsonRepresentation ()
 Get json representation.
 getXmlRepresentation ($a_entity, $a_schema_version, $a_ids, $a_field="", $a_omit_header=false, $a_omit_types=false)
 Get xml representation <dataset install_id="123" install_url="..."> <types entity="table_name" version="4.0.1"> <ftype name="field_1" type="text"> <ftype name="field_2" type="date"> <ftype name="field_3" type="integer"> </types> <types ...> ...
 addRecordsXml ($a_writer, $a_prefixes, $a_entity, $a_schema_version, $a_ids, $a_field="")
 Add records xml.
 afterXmlRecordWriting ($a_entity, $a_version, $a_set)
 After xml record writing hook record.
 getNamespaces (&$namespaces, $a_entity, $a_schema_version)
 Get xml namespaces.
 getXmlRecord ($a_entity, $a_version, $a_set)
 Get xml record for version.
 getJsonRecord ($a_set)
 Get json record for version.
 getXmlTypes ($a_entity, $a_version)
 Get xml types.
 getJsonTypes ($a_entity, $a_version)
 Get json types.
 getXMLEntityName ($a_entity, $a_version)
 Get entity name for xml (may be overwritten)
 getXMLEntityTag ($a_entity, $a_schema_version)
 Get entity tag.
 getJsonEntityName ($a_entity, $a_version)
 Get entity name for json (may be overwritten)
 setImport ($a_val)
 Set import object.
 getImport ()
 Get import object.

Protected Member Functions

 getTypes ($a_entity, $a_version)
 Get field types for entity.
 getDependencies ($a_entity, $a_version, $a_rec, $a_ids)
 Determine the dependent sets of data.
- Protected Member Functions inherited from ilDataSet
 createObjectExportId ($a_type, $a_id)
 Build ilias export id.
 parseObjectExportId ($a_id, $a_fallback_id=NULL)
 Parse export id.

Additional Inherited Members

- Data Fields inherited from ilDataSet
 $dircnt
const EXPORT_NO_INST_ID = 1
const EXPORT_ID_ILIAS_LOCAL = 2
const EXPORT_ID_ILIAS_LOCAL_INVALID = 3
const EXPORT_ID_ILIAS_REMOTE = 4
const EXPORT_ID_ILIAS_REMOTE_INVALID = 5
const EXPORT_ID = 6
const EXPORT_ID_INVALID = 7

Detailed Description

Taxonomy data set class.

This class implements the following entities:

  • tax: data from table tax_data/object_data
  • tax_usage: data from table tax_usage
  • tax_tree: data from a join on tax_tree and tax_node
  • tax_node_assignment: data from table tax_node_assignment
Author
Alex Killing alex..nosp@m.kill.nosp@m.ing@g.nosp@m.mx.d.nosp@m.e
Version
$Id$

Definition at line 19 of file class.ilTaxonomyDataSet.php.

Member Function Documentation

ilTaxonomyDataSet::getDependencies (   $a_entity,
  $a_version,
  $a_rec,
  $a_ids 
)
protected

Determine the dependent sets of data.

Definition at line 192 of file class.ilTaxonomyDataSet.php.

{
switch ($a_entity)
{
case "tax":
return array (
"tax_tree" => array("ids" => $a_rec["Id"]),
"tax_usage" => array("ids" => $a_rec["Id"])
);
case "tax_tree":
return array (
"tax_node_assignment" => array("ids" => $a_rec["Child"])
);
}
return false;
}
ilTaxonomyDataSet::getSupportedVersions ( )

Get supported versions.

Parameters
@return

Reimplemented from ilDataSet.

Definition at line 27 of file class.ilTaxonomyDataSet.php.

{
return array("4.3.0");
}
ilTaxonomyDataSet::getTypes (   $a_entity,
  $a_version 
)
protected

Get field types for entity.

Parameters
@return

Reimplemented from ilDataSet.

Definition at line 49 of file class.ilTaxonomyDataSet.php.

{
// tax
if ($a_entity == "tax")
{
switch ($a_version)
{
case "4.3.0":
return array(
"Id" => "integer",
"Title" => "text",
"Description" => "text",
"SortingMode" => "integer");
}
}
// tax_usage
if ($a_entity == "tax_usage")
{
switch ($a_version)
{
case "4.3.0":
return array(
"TaxId" => "integer",
"ObjId" => "integer"
);
}
}
// tax_tree
if ($a_entity == "tax_tree")
{
switch ($a_version)
{
case "4.3.0":
return array(
"TaxId" => "integer",
"Child" => "integer",
"Parent" => "integer",
"Depth" => "integer",
"Type" => "text",
"Title" => "text",
"OrderNr" => "integer"
);
}
}
// tax_node_assignment
if ($a_entity == "tax_node_assignment")
{
switch ($a_version)
{
case "4.3.0":
return array(
"NodeId" => "integer",
"Component" => "text",
"ItemType" => "text",
"ItemId" => "integer"
);
}
}
}
ilTaxonomyDataSet::getXmlNamespace (   $a_entity,
  $a_schema_version 
)

Get xml namespace.

Parameters
@return

Reimplemented from ilDataSet.

Definition at line 38 of file class.ilTaxonomyDataSet.php.

{
return "http://www.ilias.de/xml/Services/Taxonomy/".$a_entity;
}
ilTaxonomyDataSet::importRecord (   $a_entity,
  $a_types,
  $a_rec,
  $a_mapping,
  $a_schema_version 
)

Import record.

Parameters
@return

Definition at line 220 of file class.ilTaxonomyDataSet.php.

References ilTaxNodeAssignment\addAssignment(), and ilTaxonomyNode\putInTree().

{
//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;
}
}

+ Here is the call graph for this function:

ilTaxonomyDataSet::readData (   $a_entity,
  $a_version,
  $a_ids,
  $a_field = "" 
)

Read data.

Parameters
@return

Definition at line 119 of file class.ilTaxonomyDataSet.php.

References ilDataSet\getDirectDataFromQuery().

{
global $ilDB;
if (!is_array($a_ids))
{
$a_ids = array($a_ids);
}
// tax
if ($a_entity == "tax")
{
switch ($a_version)
{
case "4.3.0":
$this->getDirectDataFromQuery("SELECT id, title, description, ".
" sorting_mode".
" FROM tax_data JOIN object_data ON (tax_data.id = object_data.obj_id) ".
"WHERE ".
$ilDB->in("id", $a_ids, false, "integer"));
break;
}
}
// tax usage
if ($a_entity == "tax_usage")
{
switch ($a_version)
{
case "4.3.0":
$this->getDirectDataFromQuery("SELECT tax_id, obj_id ".
" FROM tax_usage ".
"WHERE ".
$ilDB->in("tax_id", $a_ids, false, "integer"));
break;
}
}
// tax_tree
if ($a_entity == "tax_tree")
{
switch ($a_version)
{
case "4.3.0":
$this->getDirectDataFromQuery("SELECT tax_id, child ".
" ,parent,depth,type,title,order_nr ".
" FROM tax_tree JOIN tax_node ON (child = obj_id) ".
" WHERE ".
$ilDB->in("tax_id", $a_ids, false, "integer").
" ORDER BY depth");
break;
}
}
// tax node assignment
if ($a_entity == "tax_node_assignment")
{
switch ($a_version)
{
case "4.3.0":
$this->getDirectDataFromQuery("SELECT node_id, component, item_type, item_id ".
" FROM tax_node_assignment ".
"WHERE ".
$ilDB->in("node_id", $a_ids, false, "integer"));
break;
}
}
}

+ Here is the call graph for this function:


The documentation for this class was generated from the following file: