ILIAS  Release_5_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilAdvancedMetaDataExporter Class Reference

Export class for adv md. More...

+ Inheritance diagram for ilAdvancedMetaDataExporter:
+ Collaboration diagram for ilAdvancedMetaDataExporter:

Public Member Functions

 init ()
 Initialisation.
 getXmlExportHeadDependencies ($a_entity, $a_target_release, $a_ids)
 Get head dependencies.
 getXmlExportTailDependencies ($a_entity, $a_target_release, $a_ids)
 Get tail dependencies.
 getXmlRepresentation ($a_entity, $a_schema_version, $a_id)
 Get xml representation.
 getValidSchemaVersions ($a_entity)
 Returns schema versions that the component can export to.
- 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.

Private Attributes

 $ds

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
- Protected Attributes inherited from ilXmlExporter
 $dir_relative
 $dir_absolute

Detailed Description

Export class for adv md.

Author
Jörg Lützenkirchen luetz.nosp@m.enki.nosp@m.rchen.nosp@m.@lei.nosp@m.fos.c.nosp@m.om
Version
Id:

Definition at line 13 of file class.ilAdvancedMetaDataExporter.php.

Member Function Documentation

ilAdvancedMetaDataExporter::getValidSchemaVersions (   $a_entity)

Returns schema versions that the component can export to.

ILIAS chooses the first one, that has min/max constraints which fit to the target release. Please put the newest on top.

Returns

Reimplemented from ilXmlExporter.

Definition at line 147 of file class.ilAdvancedMetaDataExporter.php.

{
return array (
"4.4.0" => array(
"namespace" => "http://www.ilias.de/Services/AdvancedMetaData/advmd/4_4",
"xsd_file" => "ilias_advmd_4_4.xsd",
"uses_dataset" => true,
"min" => "4.4.0",
"max" => "")
);
}
ilAdvancedMetaDataExporter::getXmlExportHeadDependencies (   $a_entity,
  $a_target_release,
  $a_ids 
)

Get head dependencies.

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

Reimplemented from ilXmlExporter.

Definition at line 33 of file class.ilAdvancedMetaDataExporter.php.

{
return array();
}
ilAdvancedMetaDataExporter::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 47 of file class.ilAdvancedMetaDataExporter.php.

{
return array();
}
ilAdvancedMetaDataExporter::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 60 of file class.ilAdvancedMetaDataExporter.php.

References ilAdvancedMDValues\findByObjectId(), and ilXmlWriter\xmlStartTag().

{
$parts = explode(":", $a_id);
if(sizeof($parts) != 2)
{
return;
}
$obj_id = $parts[0];
$rec_id = $parts[1];
// any data for current record and object?
include_once('Services/AdvancedMetaData/classes/class.ilAdvancedMDValues.php');
if(!$raw)
{
return;
}
// gather sub-item data from value entries
$sub_items = array();
foreach($raw as $item)
{
$sub_items[$item["sub_type"]][] = $item["sub_id"];
}
// gather all relevant data
$items = array();
foreach($sub_items as $sub_type => $sub_ids)
{
foreach(array_unique($sub_ids) as $sub_id)
{
$values_record = new ilAdvancedMDValues($rec_id, $obj_id, $sub_type, $sub_id);
$defs = $values_record->getDefinitions();
$values_record->read();
foreach($values_record->getADTGroup()->getElements() as $element_id => $element)
{
if(!$element->isNull())
{
$def = $defs[$element_id];
$items[$rec_id][] =array(
'id' => $def->getImportId(),
'sub_type' => $sub_type,
'sub_id' => $sub_id,
'value' => $def->getValueForXML($element)
);
}
}
}
}
// we only want non-empty fields
if(sizeof($items))
{
$xml = new ilXmlWriter;
foreach($items as $record_id => $record_items)
{
// no need to state record id here
$xml->xmlStartTag('AdvancedMetaData');
foreach($record_items as $item)
{
$xml->xmlElement(
'Value',
array(
'id' => $item['id'],
'sub_type' => $item['sub_type'],
'sub_id' => $item['sub_id']
),
$item['value']
);
}
$xml->xmlEndTag('AdvancedMetaData');
}
return $xml->xmlDumpMem(false);
}
}

+ Here is the call graph for this function:

ilAdvancedMetaDataExporter::init ( )

Initialisation.

Reimplemented from ilXmlExporter.

Definition at line 20 of file class.ilAdvancedMetaDataExporter.php.

{
}

Field Documentation

ilAdvancedMetaDataExporter::$ds
private

Definition at line 15 of file class.ilAdvancedMetaDataExporter.php.


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