ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilDataCollectionExporter Class Reference
+ Inheritance diagram for ilDataCollectionExporter:
+ Collaboration diagram for ilDataCollectionExporter:

Public Member Functions

 init ()
 
 getValidSchemaVersions (string $a_entity)
 
 getXmlRepresentation (string $a_entity, string $a_schema_version, string $a_id)
 
 getXmlExportHeadDependencies (string $a_entity, string $a_target_release, array $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 (string $a_entity, string $a_target_release, array $a_ids)
 
- Public Member Functions inherited from ilXmlExporter
 __construct ()
 
 setExport (ilExport $a_exp)
 
 getExport ()
 
 getXmlRepresentation (string $a_entity, string $a_schema_version, string $a_id)
 
 init ()
 
 setExportDirectories (string $a_dir_relative, string $a_dir_absolute)
 
 getRelativeExportDirectory ()
 
 getAbsoluteExportDirectory ()
 
 getXmlExportHeadDependencies (string $a_entity, string $a_target_release, array $a_ids)
 Get head dependencies. More...
 
 getXmlExportTailDependencies (string $a_entity, string $a_target_release, array $a_ids)
 Get tail dependencies. More...
 
 getValidSchemaVersions (string $a_entity)
 Returns schema versions that the component can export to. More...
 
 determineSchemaVersion (string $a_entity, string $a_target_release)
 

Protected Attributes

ilDataCollectionDataSet $ds
 
ilDBInterface $db
 
- Protected Attributes inherited from ilXmlExporter
ilExport $exp
 

Additional Inherited Members

- Static Public Member Functions inherited from ilXmlExporter
static lookupExportDirectory (string $a_obj_type, int $a_obj_id, string $a_export_type='xml', string $a_entity="")
 

Detailed Description

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

Member Function Documentation

◆ getValidSchemaVersions()

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

Reimplemented from ilXmlExporter.

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

39 : array
40 {
41 return [
42 '4.5.0' => [
43 'namespace' => 'https://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' => '8.12',
48 ],
49 '8.13' => [
50 'namespace' => 'https://www.ilias.de/Modules/DataCollection/dcl/4_5',
51 'xsd_file" => "ilias_dcl_4_5.xsd',
52 'uses_dataset' => true,
53 'min' => '8.13',
54 'max' => '',
55 ],
56 ];
57 }

◆ getXmlExportHeadDependencies()

ilDataCollectionExporter::getXmlExportHeadDependencies ( string  $a_entity,
string  $a_target_release,
array  $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
string$a_entity
string$a_target_release
array$a_ids
Returns
array

Reimplemented from ilXmlExporter.

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

75 : array
76 {
77 $dependencies = [
79 'component' => 'components/ILIAS/File',
80 'entity' => 'file',
81 'ids' => [],
82 ],
84 'component' => 'components/ILIAS/MediaObjects',
85 'entity' => 'mob',
86 'ids' => [],
87 ],
88 ];
89
90 // Direct SQL query is faster than looping over objects
91 foreach ($a_ids as $dcl_obj_id) {
92 $sql = "SELECT stloc2.value AS ext_id, f." . $this->db->quoteIdentifier('datatype_id') . " FROM il_dcl_stloc2_value AS stloc2 "
93 . "INNER JOIN il_dcl_record_field AS rf ON (rf." . $this->db->quoteIdentifier('id') . " = stloc2." . $this->db->quoteIdentifier('record_field_id') . ") "
94 . "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."
95 . $this->db->quoteIdentifier('id') . " = f." . $this->db->quoteIdentifier('table_id') . ") "
96 . "WHERE t." . $this->db->quoteIdentifier('obj_id') . " = " . $this->db->quote(
97 $dcl_obj_id,
98 'integer'
99 ) . " " . "AND f.datatype_id IN ("
100 . implode(
101 ',',
102 array_keys($dependencies)
103 ) . ") AND stloc2." . $this->db->quoteIdentifier('value') . " IS NOT NULL";
104 $set = $this->db->query($sql);
105 while ($rec = $this->db->fetchObject($set)) {
106 $dependencies[$rec->datatype_id]['ids'][] = (int) $rec->ext_id;
107 }
108 }
109
110 // Return external dependencies/IDs if there are any
111 $return = [];
112 if (count($dependencies[ilDclDatatype::INPUTFORMAT_FILEUPLOAD]['ids'])) {
113 $return[] = $dependencies[ilDclDatatype::INPUTFORMAT_FILEUPLOAD];
114 }
115 if (count($dependencies[ilDclDatatype::INPUTFORMAT_MOB]['ids'])) {
116 $return[] = $dependencies[ilDclDatatype::INPUTFORMAT_MOB];
117 }
118
119 return $return;
120 }

References ilDclDatatype\INPUTFORMAT_FILEUPLOAD, ilDclDatatype\INPUTFORMAT_MOB, and ILIAS\Repository\int().

+ Here is the call graph for this function:

◆ getXmlExportTailDependencies()

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

Reimplemented from ilXmlExporter.

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

128 : array
129 {
130 $deps = [];
131 $page_object_ids = [];
132 foreach ($a_ids as $dcl_obj_id) {
133 // If a DCL table has a detail view, we need to export the associated page objects!
134 $sql = "SELECT page_id FROM page_object "
135 . "WHERE parent_type = " . $this->db->quote(
136 'dclf',
137 'text'
138 ) . " AND parent_id = " . $this->db->quote($dcl_obj_id, 'integer');
139 $set = $this->db->query($sql);
140 while ($rec = $this->db->fetchObject($set)) {
141 $page_object_ids[] = "dclf:" . $rec->page_id;
142 }
143 }
144 if (count($page_object_ids)) {
145 $deps[] = [
146 'component' => 'components/ILIAS/COPage',
147 'entity' => 'pg',
148 'ids' => $page_object_ids
149 ];
150 }
151
152 $md_ids = [];
153 foreach ($a_ids as $id) {
154 $md_ids[] = $id . ':0:dcl';
155 }
156 if ($md_ids !== []) {
157 $deps[] = [
158 'component' => 'components/ILIAS/MetaData',
159 'entity' => 'md',
160 'ids' => $md_ids,
161 ];
162 }
163
164 return $deps;
165 }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23

References $id.

◆ getXmlRepresentation()

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

Reimplemented from ilXmlExporter.

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

59 : string
60 {
62 $this->ds->initByExporter($this);
63
64 return $this->ds->getXmlRepresentation($a_entity, $a_schema_version, [$a_id], '', true, true);
65 }
static makeDirParents(string $a_dir)
Create a new directory and all parent directories.

References ilXmlExporter\getAbsoluteExportDirectory(), and ilFileUtils\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 : void
27 {
28 global $DIC;
29 $ilDB = $DIC['ilDB'];
30 $this->ds = new ilDataCollectionDataSet();
31 $this->ds->setDSPrefix('ds');
32 $this->db = $ilDB;
33 }
global $DIC
Definition: shib_login.php:26

References $DIC, and $ilDB.

Field Documentation

◆ $db

ilDBInterface ilDataCollectionExporter::$db
protected

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

◆ $ds

ilDataCollectionDataSet ilDataCollectionExporter::$ds
protected

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


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