ILIAS  release_8 Revision v8.24
ilAdvancedMetaDataExporter Class Reference

Export class for adv md. More...

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

Public Member Functions

 init ()
 Initialisation. More...
 
 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...
 
 getXmlRepresentation (string $a_entity, string $a_schema_version, string $a_id)
 
 getValidSchemaVersions (string $a_entity)
 Returns schema versions that the component can export to. More...
 
- 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)
 

Static Private Attributes

static array $local_recs_done = []
 

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="")
 
- Protected Attributes inherited from ilXmlExporter
string $dir_relative = ""
 
string $dir_absolute = ""
 
ilExport $exp
 

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 12 of file class.ilAdvancedMetaDataExporter.php.

Member Function Documentation

◆ getValidSchemaVersions()

ilAdvancedMetaDataExporter::getValidSchemaVersions ( string  $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. Example: return array ( "4.1.0" => array( "namespace" => "http://www.ilias.de/Services/MetaData/md/4_1", "xsd_file" => "ilias_md_4_1.xsd", "min" => "4.1.0", "max" => "") );

Reimplemented from ilXmlExporter.

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

135 : array
136 {
137 return array(
138 "4.4.0" => array(
139 "namespace" => "http://www.ilias.de/Services/AdvancedMetaData/advmd/4_4",
140 "xsd_file" => "ilias_advmd_4_4.xsd",
141 "uses_dataset" => true,
142 "min" => "4.4.0",
143 "max" => ""
144 )
145 );
146 }

◆ getXmlExportHeadDependencies()

ilAdvancedMetaDataExporter::getXmlExportHeadDependencies ( string  $a_entity,
string  $a_target_release,
array  $a_ids 
)

Get head dependencies.

Returns
array array of array with keys "component", entity", "ids"

Reimplemented from ilXmlExporter.

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

23 : array
24 {
25 return array();
26 }

◆ getXmlExportTailDependencies()

ilAdvancedMetaDataExporter::getXmlExportTailDependencies ( string  $a_entity,
string  $a_target_release,
array  $a_ids 
)

Get tail dependencies.

Returns
array array of array with keys "component", entity", "ids"

Reimplemented from ilXmlExporter.

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

28 : array
29 {
30 return array();
31 }

◆ getXmlRepresentation()

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

Reimplemented from ilXmlExporter.

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

33 : string
34 {
35 $parts = explode(":", $a_id);
36 if (sizeof($parts) != 2) {
37 return "";
38 }
39 $obj_id = (int) $parts[0];
40 $rec_id = (int) $parts[1];
41
42 // any data for current record and object?
44 if (!$raw) {
45 return "";
46 }
47
48 // gather sub-item data from value entries
49 $sub_items = array();
50 foreach ($raw as $item) {
51 $sub_items[$item["sub_type"]][] = $item["sub_id"];
52 }
53
54 // gather all relevant data
55 $items = array();
56 foreach ($sub_items as $sub_type => $sub_ids) {
57 foreach (array_unique($sub_ids) as $sub_id) {
58 $values_record = new ilAdvancedMDValues($rec_id, $obj_id, $sub_type, $sub_id);
59 $defs = $values_record->getDefinitions();
60 $values_record->read();
61 foreach ($values_record->getADTGroup()->getElements() as $element_id => $element) {
62 if (!$element->isNull()) {
63 $def = $defs[$element_id];
64 $items[$rec_id][] = array(
65 'id' => $def->generateImportId($def->getFieldId()),
66 'sub_type' => $sub_type,
67 'sub_id' => $sub_id,
68 'value' => $def->getValueForXML($element)
69 );
70 }
71 }
72 }
73 }
74
75 // #17066 - local advmd record
76 $local_recs = array();
77 $rec_obj = new ilAdvancedMDRecord($rec_id);
78 if ($rec_obj->getParentObject()) {
79 $xml = new ilXmlWriter();
80 $rec_obj->toXML($xml);
81 $xml = $xml->xmlDumpMem(false);
82
83 $local_recs[$rec_obj->getRecordId()] = base64_encode($xml);
84 }
85
86 // we only want non-empty fields
87 if (sizeof($items)) {
88 $xml = new ilXmlWriter();
89
90 foreach ($items as $record_id => $record_items) {
91 $xml->xmlStartTag('AdvancedMetaData');
92
93 $is_local = array_key_exists($record_id, $local_recs);
94
95 // add local record data?
96 if ($is_local) {
97 // we need to add this only once
98 if (!array_key_exists($record_id, self::$local_recs_done)) {
99 $xml->xmlElement(
100 'Record',
101 array('local_id' => $record_id),
102 $local_recs[$record_id]
103 );
104
105 self::$local_recs_done[] = $record_id;
106 }
107 }
108
109 foreach ($record_items as $item) {
110 $att = array(
111 'id' => $item['id'],
112 'sub_type' => $item['sub_type'],
113 'sub_id' => $item['sub_id']
114 );
115
116 if ($is_local) {
117 $att['local_rec_id'] = $record_id;
118 }
119
120 $xml->xmlElement(
121 'Value',
122 $att,
123 $item['value']
124 );
125 }
126
127 $xml->xmlEndTag('AdvancedMetaData');
128 }
129
130 return $xml->xmlDumpMem(false);
131 }
132 return "";
133 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static findByObjectId(int $a_obj_id)
Find all entries for object (regardless of sub-type/sub-id)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
if($clientAssertionType !='urn:ietf:params:oauth:client-assertion-type:jwt-bearer'|| $grantType !='client_credentials') $parts
Definition: ltitoken.php:64
$xml
Definition: metadata.php:351

References $parts, $xml, ilAdvancedMDValues\findByObjectId(), and ILIAS\Repository\int().

+ Here is the call graph for this function:

◆ init()

ilAdvancedMetaDataExporter::init ( )

Initialisation.

Reimplemented from ilXmlExporter.

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

19 : void
20 {
21 }

Field Documentation

◆ $local_recs_done

array ilAdvancedMetaDataExporter::$local_recs_done = []
staticprivate

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


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