ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
ilCmiXapiDataSet Class Reference
+ Inheritance diagram for ilCmiXapiDataSet:
+ Collaboration diagram for ilCmiXapiDataSet:

Public Member Functions

 buildMetaData ($id)
 
 importRecord (string $a_entity, array $a_types, array $a_rec, ilImportMapping $a_mapping, string $a_schema_version)
 
 getSupportedVersions ()
 Get supported versions. More...
 
 getXmlNamespace ($a_entity, $a_schema_version)
 Get xml namespace. More...
 
- Public Member Functions inherited from ilDataSet
 __construct ()
 Constructor. More...
 
 init ($a_entity, $a_schema_version)
 Init. More...
 
 getSupportedVersions ()
 Get supported version. More...
 
 readData ($a_entity, $a_version, $a_ids)
 Read data from DB. More...
 
 setExportDirectories ($a_relative, $a_absolute)
 Set export directories. More...
 
 setImportDirectory ($a_val)
 Set import directory. More...
 
 getImportDirectory ()
 Get import directory. More...
 
 setDSPrefix ($a_val)
 Set XML dataset namespace prefix. More...
 
 getDSPrefix ()
 Get XML dataset namespace prefix. More...
 
 getDSPrefixString ()
 
 getDirectDataFromQuery ($a_query, $a_convert_to_leading_upper=true, $a_set=true)
 Get data from query.This is a standard procedure, all db field names are directly mapped to abstract fields. More...
 
 convertToLeadingUpper ($a_str)
 Make xyz_abc a XyzAbc string. More...
 
 getJsonRepresentation ()
 Get json representation. More...
 
 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 ...> ... </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 ($a_writer, $a_prefixes, $a_entity, $a_schema_version, $a_ids, $a_field="")
 Add records xml. More...
 
 afterXmlRecordWriting ($a_entity, $a_version, $a_set)
 After xml record writing hook record. More...
 
 getNamespaces (&$namespaces, $a_entity, $a_schema_version)
 Get xml namespaces. More...
 
 getXmlRecord ($a_entity, $a_version, $a_set)
 Get xml record for version. More...
 
 getJsonRecord ($a_set)
 Get json record for version. More...
 
 getXmlTypes ($a_entity, $a_version)
 Get xml types. More...
 
 getJsonTypes ($a_entity, $a_version)
 Get json types. More...
 
 getXMLEntityName ($a_entity, $a_version)
 Get entity name for xml (may be overwritten) More...
 
 getXMLEntityTag ($a_entity, $a_schema_version)
 Get entity tag. More...
 
 getJsonEntityName ($a_entity, $a_version)
 Get entity name for json (may be overwritten) More...
 
 setImport ($a_val)
 Set import object. More...
 
 getImport ()
 Get import object. More...
 
 setCurrentInstallationId ($a_val)
 Set current installation id. More...
 
 getCurrentInstallationId ()
 Get current installation id. More...
 

Data Fields

 $_cmixSettingsProperties
 
- 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
 

Protected Member Functions

 getTypes ($a_entity, $a_version)
 Get field types for entity. 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 ($a_entity, $a_version)
 Get (abstract) types for (abstract) field names. More...
 
 getXmlNamespace ($a_entity, $a_schema_version)
 Get xml namespace. More...
 
 createObjectExportId ($a_type, $a_id)
 Build ilias export id. More...
 
 parseObjectExportId ($a_id, $a_fallback_id=null)
 Parse export id. More...
 

Private Member Functions

 buildManifest ()
 
 buildProperties ($a_entity, $a_omit_header=false)
 

Private Attributes

 $_data = []
 
 $_archive = []
 
 $_dataSetMapping = null
 
 $_main_object_id = null
 
 $_element_db_mapping = []
 

Additional Inherited Members

- Protected Attributes inherited from ilDataSet
 $current_installation_id = ""
 
 $db
 
 $ds_log
 

Detailed Description

Definition at line 12 of file class.ilCmiXapiDataSet.php.

Member Function Documentation

◆ buildManifest()

ilCmiXapiDataSet::buildManifest ( )
private
Returns
string

Definition at line 313 of file class.ilCmiXapiDataSet.php.

314 {
315 $manWriter = new ilXmlWriter();
316 $manWriter->xmlHeader();
317 foreach ($this->_archive['files'] as $key => $value) {
318 $manWriter->xmlElement($key, null, $value, true, true);
319 }
320 #$manWriter->appendXML ("</content>\n");
321 return $manWriter->xmlDumpMem(true);
322 }
XML writer class.

◆ buildMetaData()

ilCmiXapiDataSet::buildMetaData (   $id)
Parameters
$id
Returns
string

Definition at line 303 of file class.ilCmiXapiDataSet.php.

304 {
305 $md2xml = new ilMD2XML($id, $id, "cmix");
306 $md2xml->startExport();
307 return $md2xml->getXML();
308 }

◆ buildProperties()

ilCmiXapiDataSet::buildProperties (   $a_entity,
  $a_omit_header = false 
)
private
Parameters
$a_entity
bool$a_omit_header
Returns
string

Definition at line 329 of file class.ilCmiXapiDataSet.php.

330 {
331 $atts = array(
332 "InstallationId" => IL_INST_ID,
333 "InstallationUrl" => ILIAS_HTTP_PATH,
334 "TopEntity" => $a_entity
335 );
336
337 $writer = new ilXmlWriter();
338
339 $writer->xmlStartTag('DataSet', $atts);
340
341 if (!$a_omit_header) {
342 $writer->xmlHeader();
343 }
344
345 foreach ($this->data as $key => $value) {
346 $writer->xmlElement($key, null, $value, true, true);
347 }
348
349 $writer->xmlEndTag("DataSet");
350
351 return $writer->xmlDumpMem(true);
352 }

References ILIAS_HTTP_PATH.

◆ getDependencies()

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

Determine the dependent sets of data.

Definition at line 417 of file class.ilCmiXapiDataSet.php.

422 : array {
423 return [];
424 }

◆ getSupportedVersions()

ilCmiXapiDataSet::getSupportedVersions ( )

Get supported versions.

Parameters

return array

Reimplemented from ilDataSet.

Definition at line 398 of file class.ilCmiXapiDataSet.php.

398 : array
399 {
400 return array("5.1.0");
401 }

◆ getTypes()

ilCmiXapiDataSet::getTypes (   $a_entity,
  $a_version 
)
protected

Get field types for entity.

Parameters
string$a_entityentity
string$a_versionversion number
Returns
array types array

Reimplemented from ilDataSet.

Definition at line 143 of file class.ilCmiXapiDataSet.php.

143 : array
144 {
145 $types = [];
146 foreach ($this->_cmixSettingsProperties as $key => $value) {
147 $types[$key] = $value["db_type"];
148 }
149 //var_dump($types); exit;
150 //return $types;
151
152 if ($a_entity == "cmix") {
153 switch ($a_version) {
154 case "5.1.0":
155 $types = [];
156 foreach ($this->_cmixSettingsProperties as $key => $value) {
157 $types[$key] = $value["db_type"];
158 }
159 //return $types;
160 break;
161 }
162 }
163 return $types;
164 }

◆ getXmlNamespace()

ilCmiXapiDataSet::getXmlNamespace (   $a_entity,
  $a_schema_version 
)

Get xml namespace.

Parameters
string$a_entity
string$a_schema_version
Returns
string

Reimplemented from ilDataSet.

Definition at line 409 of file class.ilCmiXapiDataSet.php.

409 : string
410 {
411 return "http://www.ilias.de/xml/Modules/CmiXapi/" . $a_entity;
412 }

◆ importRecord()

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

Definition at line 361 of file class.ilCmiXapiDataSet.php.

367 : void {
368 //var_dump( [$a_entity, $a_types, $a_rec, $a_mapping, $a_schema_version] ); exit;
369 switch ($a_entity) {
370 case "cmix":
371
372 include_once("./Modules/CmiXapi/classes/class.ilObjCmiXapi.php");
373
374 if ($new_id = $a_mapping->getMapping('Services/Container', 'objs', $a_rec['Id'])) {
375 $newObj = ilObjectFactory::getInstanceByObjId($new_id, false);
376 } else {
377 $newObj = new ilObjCmiXapi();
378 $newObj->setType("cmix");
379 $newObj->create(true);
380 }
381
382 $newObj->setTitle($a_rec["Title"]);
383 $newObj->setDescription($a_rec["Description"]);
384 $newObj->update();
385
386
387 //$this->current_obj = $newObj;
388 $a_mapping->addMapping("Modules/CmiXapi", "cmix", $a_rec["Id"], $newObj->getId());
389 break;
390 }
391 }
getMapping($a_comp, $a_entity, $a_old_id)
Get a mapping.
addMapping($a_comp, $a_entity, $a_old_id, $a_new_id)
Add mapping.
static getInstanceByObjId($a_obj_id, $stop_on_error=true)
get an instance of an Ilias object by object id

References ilImportMapping\addMapping(), ilObjectFactory\getInstanceByObjId(), and ilImportMapping\getMapping().

+ Here is the call graph for this function:

Field Documentation

◆ $_archive

ilCmiXapiDataSet::$_archive = []
private

Definition at line 15 of file class.ilCmiXapiDataSet.php.

◆ $_cmixSettingsProperties

ilCmiXapiDataSet::$_cmixSettingsProperties

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

◆ $_data

ilCmiXapiDataSet::$_data = []
private

Definition at line 14 of file class.ilCmiXapiDataSet.php.

◆ $_dataSetMapping

ilCmiXapiDataSet::$_dataSetMapping = null
private

Definition at line 16 of file class.ilCmiXapiDataSet.php.

◆ $_element_db_mapping

ilCmiXapiDataSet::$_element_db_mapping = []
private

Definition at line 18 of file class.ilCmiXapiDataSet.php.

◆ $_main_object_id

ilCmiXapiDataSet::$_main_object_id = null
private

Definition at line 17 of file class.ilCmiXapiDataSet.php.


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