ILIAS  release_8 Revision v8.19-1-g4e8f2f9140c
All Data Structures Namespaces Files Functions Variables Modules Pages
ilDataCollectionExporter 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 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
string $dir_relative = ""
 
string $dir_absolute = ""
 
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

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

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

Member Function Documentation

◆ getValidSchemaVersions()

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

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

37  : array
38  {
39  return array(
40  '4.5.0' => array(
41  'namespace' => 'https://www.ilias.de/Modules/DataCollection/dcl/4_5',
42  'xsd_file" => "ilias_dcl_4_5.xsd',
43  'uses_dataset' => true,
44  'min' => '4.5.0',
45  'max' => '8.12',
46  ),
47  '8.13' => array(
48  'namespace' => 'https://www.ilias.de/Modules/DataCollection/dcl/4_5',
49  'xsd_file" => "ilias_dcl_4_5.xsd',
50  'uses_dataset' => true,
51  'min' => '8.13',
52  'max' => '',
53  ),
54  );
55  }

◆ 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

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

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

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

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

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

◆ getXmlRepresentation()

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

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

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

57  : string
58  {
60  $this->ds->setExportDirectories($this->dir_relative, $this->dir_absolute);
61 
62  return $this->ds->getXmlRepresentation($a_entity, $a_schema_version, [$a_id], '', true, true);
63  }
static makeDirParents(string $a_dir)
Create a new directory and all parent directories.
+ Here is the call graph for this function:

◆ init()

ilDataCollectionExporter::init ( )

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

References $DIC, and $ilDB.

24  : void
25  {
26  global $DIC;
27  $ilDB = $DIC['ilDB'];
28  $this->ds = new ilDataCollectionDataSet();
29  $this->ds->setDSPrefix('ds');
30  $this->db = $ilDB;
31  }
global $DIC
Definition: feed.php:28
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

Field Documentation

◆ $db

ilDBInterface ilDataCollectionExporter::$db
protected

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

◆ $ds

ilDataCollectionDataSet ilDataCollectionExporter::$ds
protected

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


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