ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
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)
 Get tail dependencies. More...
 
- 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 39 of file class.ilDataCollectionExporter.php.

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

◆ 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 70 of file class.ilDataCollectionExporter.php.

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

References ilObjMediaPool\getAllMobIds(), ilDataCollectionDatatype\INPUTFORMAT_FILE, and ilDataCollectionDatatype\INPUTFORMAT_MOB.

+ Here is the call graph for this function:

◆ getXmlExportTailDependencies()

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

Get tail dependencies.

Parameters
stringentity
stringtarget release
arrayids
Returns
array array of array with keys "component", entity", "ids"

Reimplemented from ilXmlExporter.

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

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

◆ 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 52 of file class.ilDataCollectionExporter.php.

52 {
54 $this->ds->setExportDirectories($this->dir_relative, $this->dir_absolute);
55
56 return $this->ds->getXmlRepresentation($a_entity, $a_schema_version, $a_id, '', true, true);
57 }
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 $ilDB;
28 $this->ds = new ilDataCollectionDataSet();
29 $this->ds->setDSPrefix('ds');
30 $this->db = $ilDB;
31 }
DataCollection dataset class.
global $ilDB

References $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: