ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
ilDataCollectionExporter Class Reference

Class ilDataCollectionExporter. More...

+ Inheritance diagram for ilDataCollectionExporter:
+ Collaboration diagram for ilDataCollectionExporter:

Public Member Functions

 init ()
 
 getValidSchemaVersions ($a_entity)
 
 getXmlRepresentation ($a_entity, $a_schema_version, $a_id)
 Get xml representation. More...
 
 getXmlExportHeadDependencies ($a_entity, $a_target_release, $a_ids)
 MOB/File fieldtypes objects are head dependencies They must be exported and imported first, so the new DC has the new IDs of those objects available. More...
 
 getXmlExportTailDependencies ($a_entity, $a_target_release, $a_ids)
 
- Public Member Functions inherited from ilXmlExporter
 __construct ()
 Constructor. More...
 
 setExport (ilExport $a_exp)
 Set export object. More...
 
 getExport ()
 Get export. More...
 
 getXmlRepresentation ($a_entity, $a_schema_version, $a_id)
 Get xml representation. More...
 
 init ()
 
 setExportDirectories ($a_dir_relative, $a_dir_absolute)
 Export directories. More...
 
 getRelativeExportDirectory ()
 Get relative export directory. More...
 
 getAbsoluteExportDirectory ()
 Get absolute export directory. More...
 
 getXmlExportHeadDependencies ($a_entity, $a_target_release, $a_ids)
 Get head dependencies. More...
 
 getXmlExportTailDependencies ($a_entity, $a_target_release, $a_ids)
 Get tail dependencies. More...
 
 getValidSchemaVersions ($a_entity)
 Returns schema versions that the component can export to. More...
 
 determineSchemaVersion ($a_entity, $a_target_release)
 Determine schema version. More...
 

Protected Attributes

 $ds
 
 $db
 
- Protected Attributes inherited from ilXmlExporter
 $dir_relative
 
 $dir_absolute
 
 $exp
 

Additional Inherited Members

- Static Public Member Functions inherited from ilXmlExporter
static lookupExportDirectory ($a_obj_type, $a_obj_id, $a_export_type='xml', $a_entity="")
 export directory lookup More...
 

Detailed Description

Member Function Documentation

◆ getValidSchemaVersions()

ilDataCollectionExporter::getValidSchemaVersions (   $a_entity)
Parameters
string$a_entity
Returns
array

Reimplemented from ilXmlExporter.

Definition at line 40 of file class.ilDataCollectionExporter.php.

40 {
41 return array(
42 '4.5.0' => array(
43 'namespace' => 'http://www.ilias.de/Modules/DataCollection/dcl/4_5',
44 'xsd_file" => "ilias_dcl_4_5.xsd',
45 'uses_dataset' => true,
46 'min' => '4.5.0',
47 'max' => ''
48 )
49 );
50 }

◆ getXmlExportHeadDependencies()

ilDataCollectionExporter::getXmlExportHeadDependencies (   $a_entity,
  $a_target_release,
  $a_ids 
)

MOB/File fieldtypes objects are head dependencies They must be exported and imported first, so the new DC has the new IDs of those objects available.

Parameters
$a_entity
$a_target_release
$a_ids
Returns
array

Reimplemented from ilXmlExporter.

Definition at line 71 of file class.ilDataCollectionExporter.php.

71 {
72 $dependencies = array(
74 'component' => 'Modules/File',
75 'entity' => 'file',
76 'ids' => array(),
77 ),
79 'component' => 'Services/MediaObjects',
80 'entity' => 'mob',
81 'ids' => array(),
82 ),
83 );
84
85 // Direct SQL query is faster than looping over objects
86 foreach ($a_ids as $dcl_obj_id) {
87 $sql = "SELECT stloc2.value AS ext_id, f." . $this->db->quoteIdentifier('datatype_id') . " FROM il_dcl_stloc2_value AS stloc2 "
88 . "INNER JOIN il_dcl_record_field AS rf ON (rf." . $this->db->quoteIdentifier('id') . " = stloc2." . $this->db->quoteIdentifier('record_field_id') . ") "
89 . "INNER JOIN il_dcl_field AS f ON (rf." . $this->db->quoteIdentifier('field_id') . " = f." . $this->db->quoteIdentifier('id') . ") " . "INNER JOIN il_dcl_table AS t ON (t." . $this->db->quoteIdentifier('id') . " = f." . $this->db->quoteIdentifier('table_id') . ") "
90 . "WHERE t." . $this->db->quoteIdentifier('obj_id') . " = " . $this->db->quote($dcl_obj_id, 'integer') . " " . "AND f.datatype_id IN ("
91 . implode(',', array_keys($dependencies)) . ") AND stloc2." . $this->db->quoteIdentifier('value') . " IS NOT NULL";
92 $set = $this->db->query($sql);
93 while ($rec = $this->db->fetchObject($set)) {
94 $dependencies[$rec->datatype_id]['ids'][] = (int)$rec->ext_id;
95 }
96 }
97
98 // Return external dependencies/IDs if there are any
99 $return = array();
100 if (count($dependencies[ilDclDatatype::INPUTFORMAT_FILE]['ids'])) {
101 $return[] = $dependencies[ilDclDatatype::INPUTFORMAT_FILE];
102 }
103 if (count($dependencies[ilDclDatatype::INPUTFORMAT_MOB]['ids'])) {
104 $return[] = $dependencies[ilDclDatatype::INPUTFORMAT_MOB];
105 }
106
107 return $return;
108 }

References ilDclDatatype\INPUTFORMAT_FILE, and ilDclDatatype\INPUTFORMAT_MOB.

◆ getXmlExportTailDependencies()

ilDataCollectionExporter::getXmlExportTailDependencies (   $a_entity,
  $a_target_release,
  $a_ids 
)
Parameters
$a_entity
$a_target_release
$a_ids
Returns
array

Reimplemented from ilXmlExporter.

Definition at line 118 of file class.ilDataCollectionExporter.php.

118 {
119 $page_object_ids = array();
120 foreach ($a_ids as $dcl_obj_id) {
121 // If a DCL table has a detail view, we need to export the associated page objects!
122 $sql = "SELECT page_id FROM page_object "
123 . "WHERE parent_type = " . $this->db->quote('dclf', 'text') . " AND parent_id = " . $this->db->quote($dcl_obj_id, 'integer');
124 $set = $this->db->query($sql);
125 while ($rec = $this->db->fetchObject($set)) {
126 $page_object_ids[] = "dclf:" . $rec->page_id;
127 }
128 }
129 if (count($page_object_ids)) {
130 return array(
131 array(
132 'component' => 'Services/COPage',
133 'entity' => 'pg',
134 'ids' => $page_object_ids,
135 )
136 );
137 }
138
139 return array();
140 }

◆ getXmlRepresentation()

ilDataCollectionExporter::getXmlRepresentation (   $a_entity,
  $a_schema_version,
  $a_id 
)

Get xml representation.

Parameters
stringentity
stringschema version
stringid
Returns
string xml string

Reimplemented from ilXmlExporter.

Definition at line 53 of file class.ilDataCollectionExporter.php.

53 {
55 $this->ds->setExportDirectories($this->dir_relative, $this->dir_absolute);
56
57 return $this->ds->getXmlRepresentation($a_entity, $a_schema_version, $a_id, '', true, true);
58 }
static makeDirParents($a_dir)
Create a new directory and all parent directories.
getAbsoluteExportDirectory()
Get absolute export directory.

References ilXmlExporter\getAbsoluteExportDirectory(), and ilUtil\makeDirParents().

+ Here is the call graph for this function:

◆ init()

ilDataCollectionExporter::init ( )

Reimplemented from ilXmlExporter.

Definition at line 26 of file class.ilDataCollectionExporter.php.

26 {
27 global $DIC;
28 $ilDB = $DIC['ilDB'];
29 $this->ds = new ilDataCollectionDataSet();
30 $this->ds->setDSPrefix('ds');
31 $this->db = $ilDB;
32 }
DataCollection dataset class.
global $ilDB
global $DIC

References $DIC, and $ilDB.

Field Documentation

◆ $db

ilDataCollectionExporter::$db
protected

Definition at line 23 of file class.ilDataCollectionExporter.php.

◆ $ds

ilDataCollectionExporter::$ds
protected

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


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