ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f870
ilAdvancedMetaDataExporter Class Reference

Export class for adv md. More...

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

Public Member Functions

 init ()
 Initialisation. 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...
 
 getXmlRepresentation ($a_entity, $a_schema_version, $a_id)
 Get xml representation. More...
 
 getValidSchemaVersions ($a_entity)
 Returns schema versions that the component can export to. More...
 
- Public Member Functions inherited from ilXmlExporter
 __construct ()
 Constructor. 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...
 

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 More...
 
- 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

◆ getValidSchemaVersions()

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.

148 {
149 return array (
150 "4.4.0" => array(
151 "namespace" => "http://www.ilias.de/Services/AdvancedMetaData/advmd/4_4",
152 "xsd_file" => "ilias_advmd_4_4.xsd",
153 "uses_dataset" => true,
154 "min" => "4.4.0",
155 "max" => "")
156 );
157 }

◆ getXmlExportHeadDependencies()

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.

34 {
35 return array();
36 }

◆ getXmlExportTailDependencies()

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.

48 {
49 return array();
50 }

◆ getXmlRepresentation()

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.

61 {
62 $parts = explode(":", $a_id);
63 if(sizeof($parts) != 2)
64 {
65 return;
66 }
67 $obj_id = $parts[0];
68 $rec_id = $parts[1];
69
70 // any data for current record and object?
71 include_once('Services/AdvancedMetaData/classes/class.ilAdvancedMDValues.php');
73 if(!$raw)
74 {
75 return;
76 }
77
78 // gather sub-item data from value entries
79 $sub_items = array();
80 foreach($raw as $item)
81 {
82 $sub_items[$item["sub_type"]][] = $item["sub_id"];
83 }
84
85 // gather all relevant data
86 $items = array();
87 foreach($sub_items as $sub_type => $sub_ids)
88 {
89 foreach(array_unique($sub_ids) as $sub_id)
90 {
91 $values_record = new ilAdvancedMDValues($rec_id, $obj_id, $sub_type, $sub_id);
92 $defs = $values_record->getDefinitions();
93 $values_record->read();
94 foreach($values_record->getADTGroup()->getElements() as $element_id => $element)
95 {
96 if(!$element->isNull())
97 {
98 $def = $defs[$element_id];
99 $items[$rec_id][] =array(
100 'id' => $def->getImportId(),
101 'sub_type' => $sub_type,
102 'sub_id' => $sub_id,
103 'value' => $def->getValueForXML($element)
104 );
105 }
106 }
107 }
108 }
109
110 // we only want non-empty fields
111 if(sizeof($items))
112 {
113 $xml = new ilXmlWriter;
114
115 foreach($items as $record_id => $record_items)
116 {
117 // no need to state record id here
118 $xml->xmlStartTag('AdvancedMetaData');
119
120 foreach($record_items as $item)
121 {
122 $xml->xmlElement(
123 'Value',
124 array(
125 'id' => $item['id'],
126 'sub_type' => $item['sub_type'],
127 'sub_id' => $item['sub_id']
128 ),
129 $item['value']
130 );
131 }
132
133 $xml->xmlEndTag('AdvancedMetaData');
134 }
135
136 return $xml->xmlDumpMem(false);
137 }
138 }
static findByObjectId($a_obj_id)
Find all entries for object (regardless of sub-type/sub-id)
XML writer class.
xmlStartTag($tag, $attrs=NULL, $empty=FALSE, $encode=TRUE, $escape=TRUE)
Writes a starttag.

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

+ Here is the call graph for this function:

◆ init()

ilAdvancedMetaDataExporter::init ( )

Initialisation.

Reimplemented from ilXmlExporter.

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

21 {
22
23 }

Field Documentation

◆ $ds

ilAdvancedMetaDataExporter::$ds
private

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


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