ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilTaxonomyDataSet Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

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

Public Member Functions

 getSupportedVersions ()
 
 readData (string $a_entity, string $a_version, array $a_ids)
 @inheritDoc More...
 
 importRecord (string $a_entity, array $a_types, array $a_rec, ilImportMapping $a_mapping, string $a_schema_version)
 Needs to be overwritten for import use case. More...
 
- Public Member Functions inherited from ilDataSet
 __construct ()
 
 init (string $a_entity, string $a_schema_version)
 Init. More...
 
 getSupportedVersions ()
 
 readData (string $a_entity, string $a_version, array $a_ids)
 Read data from DB. More...
 
 initByExporter (ilXmlExporter $xml_exporter)
 
 setImportDirectory (string $a_val)
 
 getImportDirectory ()
 
 setDSPrefix (string $a_val)
 
 getDSPrefix ()
 
 getDSPrefixString ()
 
 getDirectDataFromQuery (string $a_query, bool $a_convert_to_leading_upper=true, bool $a_set=true)
 Get data from query.This is a standard procedure, all db field names are directly mapped to abstract fields. More...
 
 convertToLeadingUpper (string $a_str)
 Make xyz_abc a XyzAbc string. More...
 
 getXmlRepresentation (string $a_entity, string $a_schema_version, ?array $a_ids, string $a_field="", bool $a_omit_header=false, bool $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 ...> ... </types> <set entity="table_name"> <rec> <field_1>content</field_1> <field_2>my_date</field_2> <field_3>my_number</field_3> </rec> ... </set> </dataset> More...
 
 addRecordsXml (ilXmlWriter $a_writer, array $a_prefixes, string $a_entity, string $a_schema_version, array $a_ids, ?string $a_field="")
 
 afterXmlRecordWriting (string $a_entity, string $a_version, array $a_set)
 
 getNamespaces (array &$namespaces, string $a_entity, string $a_schema_version)
 
 getXmlRecord (string $a_entity, string $a_version, array $a_set)
 Get xml record for version. More...
 
 getXmlTypes (string $a_entity, string $a_version)
 Get xml types. More...
 
 getXMLEntityName (string $a_entity, string $a_version)
 Get entity name for xml (may be overwritten) More...
 
 getXMLEntityTag (string $a_entity, string $a_schema_version)
 Get entity tag. More...
 
 setImport (ilSurveyImporter $a_val)
 
 getImport ()
 
 setCurrentInstallationId (string $a_val)
 
 getCurrentInstallationId ()
 
 importRecord (string $a_entity, array $a_types, array $a_rec, ilImportMapping $a_mapping, string $a_schema_version)
 Needs to be overwritten for import use case. More...
 
 getCollection (array $record, string $entity, string $schema_version, string $field, string $value)
 
 getContainerExportConfig (array $record, string $entity, string $schema_version, string $field, string $value)
 

Protected Member Functions

 getXmlNamespace (string $a_entity, string $a_schema_version)
 
 getTypes (string $a_entity, string $a_version)
 @inheritDoc More...
 
 getDependencies (string $a_entity, string $a_version, ?array $a_rec=null, ?array $a_ids=null)
 Determine the dependent sets of data. More...
 
- Protected Member Functions inherited from ilDataSet
 getTypes (string $a_entity, string $a_version)
 Get (abstract) types for (abstract) field names. More...
 
 getXmlNamespace (string $a_entity, string $a_schema_version)
 
 getExportDirInContainer (string $exp_dir)
 
 getIRSSContainerExportConfig (StorableResource $source_container, string $source_path, string $target_path="")
 
 getDependencies (string $a_entity, string $a_version, ?array $a_rec=null, ?array $a_ids=null)
 
 createObjectExportId (string $a_type, string $a_id)
 Build ilias export id. More...
 
 parseObjectExportId (string $a_id, ?string $a_fallback_id=null)
 Parse export id. More...
 
 stripTags (array $rec, array $omit_keys=[])
 

Protected Attributes

ilObjTaxonomy $current_obj
 
- Protected Attributes inherited from ilDataSet
ILIAS ResourceStorage Services $irss
 
string $current_installation_id = ""
 
array $data = []
 
ilDBInterface $db
 
ilLogger $ds_log
 
string $import_directory = ""
 
string $entity = ""
 
string $schema_version = ""
 
string $component_export_dir = ""
 
string $ds_prefix = "ds"
 
string $version = ""
 
ilSurveyImporter $import
 
ilExport $export
 

Additional Inherited Members

- Data Fields inherited from ilDataSet
const DATASET_NS = 'http://www.ilias.de/Services/DataSet/ds/4_3'
 
const DATASET_NS_PREFIX = 'ds'
 
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
 
int $dircnt = 0
 

Detailed Description

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning 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
    Alexander Killing killi.nosp@m.ng@l.nosp@m.eifos.nosp@m..de

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

Member Function Documentation

◆ getDependencies()

ilTaxonomyDataSet::getDependencies ( string  $a_entity,
string  $a_version,
?array  $a_rec = null,
?array  $a_ids = null 
)
protected

Determine the dependent sets of data.

Reimplemented from ilDataSet.

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

173 : array {
174 switch ($a_entity) {
175 case "tax":
176 return array(
177 "tax_tree" => array("ids" => $a_rec["Id"] ?? null),
178 "tax_usage" => array("ids" => $a_rec["Id"] ?? null)
179 );
180 case "tax_tree":
181 return array(
182 "tax_node_assignment" => array("ids" => $a_rec["Child"] ?? null)
183 );
184 }
185 return [];
186 }

◆ getSupportedVersions()

ilTaxonomyDataSet::getSupportedVersions ( )

Reimplemented from ilDataSet.

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

32 : array
33 {
34 return array("4.3.0");
35 }

◆ getTypes()

ilTaxonomyDataSet::getTypes ( string  $a_entity,
string  $a_version 
)
protected

@inheritDoc

Reimplemented from ilDataSet.

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

45 : array
46 {
47 // tax
48 if ($a_entity == "tax") {
49 switch ($a_version) {
50 case "4.3.0":
51 return array(
52 "Id" => "integer",
53 "Title" => "text",
54 "Description" => "text",
55 "SortingMode" => "integer"
56 );
57 }
58 }
59
60 // tax_usage
61 if ($a_entity == "tax_usage") {
62 switch ($a_version) {
63 case "4.3.0":
64 return array(
65 "TaxId" => "integer",
66 "ObjId" => "integer"
67 );
68 }
69 }
70
71 // tax_tree
72 if ($a_entity == "tax_tree") {
73 switch ($a_version) {
74 case "4.3.0":
75 return array(
76 "TaxId" => "integer",
77 "Child" => "integer",
78 "Parent" => "integer",
79 "Depth" => "integer",
80 "Type" => "text",
81 "Title" => "text",
82 "OrderNr" => "integer"
83 );
84 }
85 }
86
87 // tax_node_assignment
88 if ($a_entity == "tax_node_assignment") {
89 switch ($a_version) {
90 case "4.3.0":
91 return array(
92 "NodeId" => "integer",
93 "Component" => "text",
94 "ItemType" => "text",
95 "ItemId" => "integer"
96 );
97 }
98 }
99 return [];
100 }

◆ getXmlNamespace()

ilTaxonomyDataSet::getXmlNamespace ( string  $a_entity,
string  $a_schema_version 
)
protected

Reimplemented from ilDataSet.

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

37 : string
38 {
39 return "http://www.ilias.de/xml/Services/Taxonomy/" . $a_entity;
40 }

◆ importRecord()

ilTaxonomyDataSet::importRecord ( string  $a_entity,
array  $a_types,
array  $a_rec,
ilImportMapping  $a_mapping,
string  $a_schema_version 
)

Needs to be overwritten for import use case.

Reimplemented from ilDataSet.

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

198 : void {
199 $a_rec = $this->stripTags($a_rec);
200 switch ($a_entity) {
201 case "tax":
202 $newObj = new ilObjTaxonomy();
203 $newObj->create();
204
205 $newObj->setTitle($a_rec["Title"]);
206 $newObj->setDescription($a_rec["Description"]);
207 $newObj->setSortingMode((int) $a_rec["SortingMode"]);
208 $newObj->update();
209
210 $this->current_obj = $newObj;
211 $a_mapping->addMapping("components/ILIAS/Taxonomy", "tax", $a_rec["Id"], $newObj->getId());
212 break;
213
214 case "tax_tree":
215 switch ($a_rec["Type"]) {
216 case "taxn":
217 $parent = (int) $a_mapping->getMapping("components/ILIAS/Taxonomy", "tax_tree", $a_rec["Parent"]);
218 $tax_id = $a_mapping->getMapping("components/ILIAS/Taxonomy", "tax", $a_rec["TaxId"]);
219 if ($parent == 0) {
220 $parent = $this->current_obj->getTree()->readRootId();
221 }
222 $node = new ilTaxonomyNode();
223 $node->setTitle($a_rec["Title"]);
224 $node->setOrderNr((int) $a_rec["OrderNr"]);
225 $node->setTaxonomyId((int) $tax_id);
226 $node->create();
227 ilTaxonomyNode::putInTree((int) $tax_id, $node, (int) $parent, 0, (int) $a_rec["OrderNr"]);
228 $a_mapping->addMapping(
229 "components/ILIAS/Taxonomy",
230 "tax_tree",
231 $a_rec["Child"],
232 $node->getId()
233 );
234 break;
235 }
236
237 // no break
238 case "tax_node_assignment":
239 $new_item_id = (int) $a_mapping->getMapping(
240 "components/ILIAS/Taxonomy",
241 "tax_item",
242 ($a_rec["Component"] ?? "") .
243 ":" . ($a_rec["ItemType"] ?? "") . ":" .
244 ($a_rec["ItemId"] ?? "")
245 );
246 $new_node_id = (int) $a_mapping->getMapping("components/ILIAS/Taxonomy", "tax_tree", $a_rec["NodeId"] ?? "");
247
248 // this is needed since 4.4 (but not exported with 4.3)
249 // with 4.4 this should be part of export/import
250 $new_item_id_obj = (int) $a_mapping->getMapping(
251 "components/ILIAS/Taxonomy",
252 "tax_item_obj_id",
253 ($a_rec["Component"] ?? "") .
254 ":" . ($a_rec["ItemType"] ?? "") . ":" .
255 ($a_rec["ItemId"] ?? "")
256 );
257 if ($new_item_id > 0 && $new_node_id > 0 && $new_item_id_obj > 0) {
258 $node_ass = new ilTaxNodeAssignment(
259 $a_rec["Component"],
260 $new_item_id_obj,
261 $a_rec["ItemType"],
262 $this->current_obj->getId()
263 );
264 $node_ass->addAssignment($new_node_id, $new_item_id);
265 }
266 break;
267
268 case "tax_usage":
269 $usage = $a_mapping->getMapping("components/ILIAS/Taxonomy", "tax_usage_of_obj", $a_rec["ObjId"]);
270 if ($usage != "") {
271 $usage .= ":";
272 }
273 $a_mapping->addMapping(
274 "components/ILIAS/Taxonomy",
275 "tax_usage_of_obj",
276 $a_rec["ObjId"],
277 $usage . $this->current_obj->getId()
278 );
279 break;
280 }
281 }
stripTags(array $rec, array $omit_keys=[])
addMapping(string $a_comp, string $a_entity, string $a_old_id, string $a_new_id)
getMapping(string $a_comp, string $a_entity, string $a_old_id)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static putInTree(int $a_tax_id, ilTaxonomyNode $a_node, int $a_parent_id=0, int $a_target_node_id=0, int $a_order_nr=0)

References ilImportMapping\addMapping(), ilImportMapping\getMapping(), ILIAS\Repository\int(), and ilTaxonomyNode\putInTree().

+ Here is the call graph for this function:

◆ readData()

ilTaxonomyDataSet::readData ( string  $a_entity,
string  $a_version,
array  $a_ids 
)

@inheritDoc

Reimplemented from ilDataSet.

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

105 : void
106 {
108
109 if (!is_array($a_ids)) {
110 $a_ids = array($a_ids);
111 }
112
113 // tax
114 if ($a_entity == "tax") {
115 switch ($a_version) {
116 case "4.3.0":
117 $this->getDirectDataFromQuery("SELECT id, title, description, " .
118 " sorting_mode" .
119 " FROM tax_data JOIN object_data ON (tax_data.id = object_data.obj_id) " .
120 "WHERE " .
121 $ilDB->in("id", $a_ids, false, "integer"));
122 break;
123 }
124 }
125
126 // tax usage
127 if ($a_entity == "tax_usage") {
128 switch ($a_version) {
129 case "4.3.0":
130 $this->getDirectDataFromQuery("SELECT tax_id, obj_id " .
131 " FROM tax_usage " .
132 "WHERE " .
133 $ilDB->in("tax_id", $a_ids, false, "integer"));
134 break;
135 }
136 }
137
138 // tax_tree
139 if ($a_entity == "tax_tree") {
140 switch ($a_version) {
141 case "4.3.0":
142 $this->getDirectDataFromQuery("SELECT tax_id, child " .
143 " ,parent,depth,type,title,order_nr " .
144 " FROM tax_tree JOIN tax_node ON (child = obj_id) " .
145 " WHERE " .
146 $ilDB->in("tax_id", $a_ids, false, "integer") .
147 " ORDER BY depth");
148 break;
149 }
150 }
151
152 // tax node assignment
153 if ($a_entity == "tax_node_assignment") {
154 switch ($a_version) {
155 case "4.3.0":
156 $this->getDirectDataFromQuery("SELECT node_id, component, item_type, item_id " .
157 " FROM tax_node_assignment " .
158 "WHERE " .
159 $ilDB->in("node_id", $a_ids, false, "integer"));
160 break;
161 }
162 }
163 }
getDirectDataFromQuery(string $a_query, bool $a_convert_to_leading_upper=true, bool $a_set=true)
Get data from query.This is a standard procedure, all db field names are directly mapped to abstract ...
ilDBInterface $db

References ilDataSet\$db, $ilDB, and ilDataSet\getDirectDataFromQuery().

+ Here is the call graph for this function:

Field Documentation

◆ $current_obj

ilObjTaxonomy ilTaxonomyDataSet::$current_obj
protected

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


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