ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f870
class.ilAdvancedMetaDataImporter.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
3
4include_once("./Services/Export/classes/class.ilXmlImporter.php");
5
14{
15 function importXmlRepresentation($a_entity, $a_id, $a_xml, $a_mapping)
16 {
17 include_once "Services/AdvancedMetaData/classes/class.ilAdvancedMDParser.php";
18 include_once "Services/AdvancedMetaData/classes/class.ilAdvancedMDRecord.php";
19
20 $parser = new ilAdvancedMDParser($a_id, $a_mapping);
21 $parser->setXMLContent($a_xml);
22 $parser->startParsing();
23
24 // select records for object
25 foreach($parser->getRecordIds() as $obj_id => $sub_types)
26 {
27 // currently only supported for wikis and glossary
28 if(!in_array(ilObject::_lookupType($obj_id), array("glo", "wiki")))
29 {
30 continue;
31 }
32
33 foreach($sub_types as $sub_type => $rec_ids)
34 {
35 ilAdvancedMDRecord::saveObjRecSelection($obj_id, $sub_type, array_unique($rec_ids), false);
36 }
37 }
38 }
39}
40
41?>
static saveObjRecSelection($a_obj_id, $a_sub_type="", array $a_records=null, $a_delete_before=true)
Save repository object record selection.
importXmlRepresentation($a_entity, $a_id, $a_xml, $a_mapping)
Import xml representation.
static _lookupType($a_id, $a_reference=false)
lookup object type
Xml importer class.