ILIAS  release_4-4 Revision
All Data Structures Namespaces Files Functions Variables Modules Pages
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

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

119  {
120  return array (
121  "4.4.0" => array(
122  "namespace" => "http://www.ilias.de/Services/AdvancedMetaData/advmd/4_4",
123  "xsd_file" => "ilias_advmd_4_4.xsd",
124  "uses_dataset" => true,
125  "min" => "4.4.0",
126  "max" => "")
127  );
128  }

◆ 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"

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"

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

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

References $query, $row, ilAdvancedMDFieldDefinition\_getDefinitionsByRecordId(), ilAdvancedMDFieldDefinition\_lookupImportId(), and ilXmlWriter\xmlStartTag().

61  {
62  global $ilDB;
63 
64  $parts = explode(":", $a_id);
65  if(sizeof($parts) != 2)
66  {
67  return;
68  }
69  $obj_id = $parts[0];
70  $rec_id = $parts[1];
71 
72  include_once('Services/AdvancedMetaData/classes/class.ilAdvancedMDFieldDefinition.php');
73  $field_ids = array();
75  {
76  $field_ids[] = $def->getFieldId();
77  }
78 
79  if(!sizeof($field_ids))
80  {
81  return;
82  }
83 
84  $xml = new ilXmlWriter;
85  $xml->xmlStartTag('AdvancedMetaData');
86 
87  $query = "SELECT field_id,value,sub_id,sub_type".
88  " FROM adv_md_values ".
89  " WHERE obj_id = ".$ilDB->quote($a_id, "integer").
90  " AND ".$ilDB->in("field_id", $field_ids, "", "integer");
91  $set = $ilDB->query($query);
92  while($row = $ilDB->fetchAssoc($set))
93  {
94  if(trim($row['value']) != "")
95  {
96  $xml->xmlElement('Value',
97  array(
99  'sub_id' => $row['sub_id'],
100  'sub_type' => $row['sub_type'],
101  ),
102  $row['value']);
103  }
104  }
105 
106  $xml->xmlEndTag('AdvancedMetaData');
107 
108  return $xml->xmlDumpMem(false);
109  }
static _getDefinitionsByRecordId($a_record_id)
get definitions
xmlStartTag($tag, $attrs=NULL, $empty=FALSE, $encode=TRUE, $escape=TRUE)
Writes a starttag.
XML writer class.
static _lookupImportId($a_field_id)
Lookup import id.
+ Here is the call graph for this function:

◆ init()

ilAdvancedMetaDataExporter::init ( )

Initialisation.

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: