ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
class.ilContainerImporter.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2010 ILIAS open source, Extended GPL, see docs/LICENSE */
3
4include_once("./Services/Export/classes/class.ilXmlImporter.php");
5
16{
17
21 protected $cont_log;
22
23 public function init()
24 {
25 $this->cont_log = ilLoggerFactory::getLogger('cont');
26 }
27
33 function importXmlRepresentation($a_entity, $a_id, $a_xml, $a_mapping)
34 {
35 include_once './Services/Container/classes/class.ilContainerXmlParser.php';
36
37 $this->cont_log->debug('Import xml: '. $a_xml);
38 $this->cont_log->debug('Using id: ' . $a_id);
39
40 $parser = new ilContainerXmlParser($a_mapping,trim($a_xml));
41 $parser->parse($a_id);
42 }
43
47 function finalProcessing($a_mapping)
48 {
49 // pages
50 include_once('./Services/COPage/classes/class.ilPageObject.php');
51 $page_map = $a_mapping->getMappingsOfEntity('Services/COPage', 'pg');
52 foreach ($page_map as $old_pg_id => $new_pg_id)
53 {
54 $parts = explode(':', $old_pg_id);
55 $pg_type = $parts[0];
56 $old_obj_id = $parts[1];
57 $new_pg_id = array_pop(explode(':', $new_pg_id));
58 $new_obj_id = $a_mapping->getMapping('Services/Container', 'objs', $old_obj_id);
59 // see bug #22718, this missed a check for the pg type
60 if (in_array($pg_type, array("crs", "grp", "fold", "cont")))
61 {
62 if ($new_obj_id > 0)
63 {
64 ilPageObject::_writeParentId($pg_type, $new_pg_id, $new_obj_id);
65 $this->cont_log->debug('write parent id, type: '.$pg_type.", page id: ".$new_pg_id.", parent id: ".$new_obj_id);
66 }
67 }
68 }
69
70 // style
71 include_once('./Services/Style/Content/classes/class.ilObjStyleSheet.php');
72 $sty_map = $a_mapping->getMappingsOfEntity('Services/Style', 'sty');
73 foreach ($sty_map as $old_sty_id => $new_sty_id)
74 {
75 if(is_array(ilContainerXmlParser::$style_map[$old_sty_id]))
76 {
77 foreach(ilContainerXmlParser::$style_map[$old_sty_id] as $obj_id)
78 {
79 ilObjStyleSheet::writeStyleUsage($obj_id, $new_sty_id);
80 }
81 }
82 }
83 }
84}
85?>
$parser
Definition: BPMN2Parser.php:24
An exception for terminatinating execution or to throw for unit testing.
container xml importer
finalProcessing($a_mapping)
Final processing.
importXmlRepresentation($a_entity, $a_id, $a_xml, $a_mapping)
Import XML.
XML parser for container structure.
static getLogger($a_component_id)
Get component logger.
static writeStyleUsage($a_obj_id, $a_style_id)
Write style usage.
static _writeParentId($a_parent_type, $a_pg_id, $a_par_id)
Write parent id.
Xml importer class.