ILIAS  Release_5_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
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.
 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.
 getXmlExportTailDependencies ($a_entity, $a_target_release, $a_ids)
 Get tail dependencies.
- Public Member Functions inherited from ilXmlExporter
 __construct ()
 Constructor.
 setExportDirectories ($a_dir_relative, $a_dir_absolute)
 Export directories.
 getRelativeExportDirectory ()
 Get relative export directory.
 getAbsoluteExportDirectory ()
 Get absolute export directory.
 determineSchemaVersion ($a_entity, $a_target_release)
 Determine schema version.

Protected Attributes

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

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

Detailed Description

Member Function Documentation

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

Reimplemented from ilXmlExporter.

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

{
return array(
'4.5.0' => array(
'namespace' => 'http://www.ilias.de/Modules/DataCollection/dcl/4_5',
'xsd_file" => "ilias_dcl_4_5.xsd',
'uses_dataset' => true,
'min' => '4.5.0',
'max' => ''
)
);
}
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.

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

{
foreach ($a_ids as $id) {
foreach ($m_ids as $m) {
$mob_ids[] = $m;
}
}
$dependencies = array(
'component' => 'Modules/File',
'entity' => 'file',
'ids' => array(),
),
'component' => 'Services/MediaObjects',
'entity' => 'mob',
'ids' => array(),
),
);
// Direct SQL query is faster than looping over objects
$page_object_ids = array();
foreach ($a_ids as $dcl_obj_id) {
$sql = "SELECT stloc2.value AS ext_id, f.`datatype_id` FROM il_dcl_stloc2_value AS stloc2 "
. "INNER JOIN il_dcl_record_field AS rf ON (rf.`id` = stloc2.`record_field_id`) "
. "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`) "
. "WHERE t.`obj_id` = " . $this->db->quote($dcl_obj_id, 'integer') . " " . "AND f.datatype_id IN ("
. implode(',', array_keys($dependencies)) . ") AND stloc2.`value` IS NOT NULL";
$set = $this->db->query($sql);
while ($rec = $this->db->fetchObject($set)) {
$dependencies[$rec->datatype_id]['ids'][] = (int)$rec->ext_id;
}
}
// Return external dependencies/IDs if there are any
$return = array();
if (count($dependencies[ilDataCollectionDatatype::INPUTFORMAT_FILE]['ids'])) {
$return[] = $dependencies[ilDataCollectionDatatype::INPUTFORMAT_FILE];
}
if (count($dependencies[ilDataCollectionDatatype::INPUTFORMAT_MOB]['ids'])) {
$return[] = $dependencies[ilDataCollectionDatatype::INPUTFORMAT_MOB];
}
return $return;
}

+ Here is the call graph for this function:

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.

{
$page_object_ids = array();
foreach ($a_ids as $dcl_obj_id) {
// If a DCL table has a detail view, we need to export the associated page objects!
$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) "
. "WHERE il_dcl_table.obj_id = " . $this->db->quote($dcl_obj_id, 'integer') . " "
. "AND il_dcl_view.type=0 AND il_dcl_view.formtype=0";
$set = $this->db->query($sql);
while ($rec = $this->db->fetchObject($set)) {
$page_object_ids[] = "dclf:" . $rec->page_obj_id;
}
}
if (count($page_object_ids)) {
return array(
array(
'component' => 'Services/COPage',
'entity' => 'pg',
'ids' => $page_object_ids,
)
);
}
return array();
}
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.

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

{
$this->ds->setExportDirectories($this->dir_relative, $this->dir_absolute);
return $this->ds->getXmlRepresentation($a_entity, $a_schema_version, $a_id, '', true, true);
}

+ Here is the call graph for this function:

ilDataCollectionExporter::init ( )

Reimplemented from ilXmlExporter.

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

References $ilDB.

{
global $ilDB;
$this->ds = new ilDataCollectionDataSet();
$this->ds->setDSPrefix('ds');
$this->db = $ilDB;
}

Field Documentation

ilDataCollectionExporter::$db
protected

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

ilDataCollectionExporter::$ds
protected

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


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