4 include_once(
"./Services/Export/classes/class.ilXmlImporter.php");
39 include_once
'./Services/Container/classes/class.ilContainerXmlParser.php';
41 $this->structure_xml = $a_xml;
42 $this->cont_log->debug(
'Import xml: ' . $a_xml);
43 $this->cont_log->debug(
'Using id: ' . $a_id);
46 $parser->parse($a_id);
56 include_once(
'./Services/COPage/classes/class.ilPageObject.php');
57 $page_map = $a_mapping->getMappingsOfEntity(
'Services/COPage',
'pg');
58 foreach ($page_map as $old_pg_id => $new_pg_id) {
59 $parts = explode(
':', $old_pg_id);
61 $old_obj_id = $parts[1];
62 $new_pg_id = array_pop(explode(
':', $new_pg_id));
63 $new_obj_id = $a_mapping->getMapping(
'Services/Container',
'objs', $old_obj_id);
65 if (in_array($pg_type, array(
"crs",
"grp",
"fold",
"cont"))) {
66 if ($new_obj_id > 0) {
68 $this->cont_log->debug(
'write parent id, type: ' . $pg_type .
", page id: " . $new_pg_id .
", parent id: " . $new_obj_id);
74 include_once(
'./Services/Style/Content/classes/class.ilObjStyleSheet.php');
75 $sty_map = $a_mapping->getMappingsOfEntity(
'Services/Style',
'sty');
76 foreach ($sty_map as $old_sty_id => $new_sty_id) {
85 $new_crs_obj_id = end($a_mapping->getMappingsOfEntity(
'Modules/Course',
'crs'));
87 $new_crs_ref_id = end($new_crs_ref_id);
89 $skl_local_prof_map = $a_mapping->getMappingsOfEntity(
'Services/Skill',
'skl_local_prof');
90 foreach ($skl_local_prof_map as $old_prof_id => $new_prof_id) {
92 $prof->updateRefIdAfterImport((
int) $new_crs_ref_id);
102 libxml_use_internal_errors(
true);
103 $root = simplexml_load_string($xml);
104 if ($root ===
false) {
106 foreach (libxml_get_errors() as $err) {
107 $errors .= $err->code .
'<br/>';
109 $this->cont_log->error($xml);
110 $this->cont_log->error(
'Cannot parse xml: ' .
$errors);
112 foreach ($root->xpath(
'//Item') as $item) {
115 foreach ($item->attributes() as
$name => $value) {
116 if ((
string) $name ==
'Offline') {
119 if ((
string) $name ==
'RefId') {
120 $ref_id = (string) $value;
123 if (is_null($offline)) {
124 $this->cont_log->debug(
'No offline handling for ref_id: ' . $ref_id);
127 $new_ref_id = $mapping->
getMapping(
'Services/Container',
'refs', $ref_id);
130 $this->cont_log->warning(
'Cannot create instance for ref_id: ' . $new_ref_id);
133 if ($obj->supportsOfflineHandling()) {
134 if ($this->
isRootNode($obj->getRefId(), $mapping)) {
135 $obj->setOfflineStatus(
true);
138 $obj->setOfflineStatus(!((
string) $offline ===
"0"));
154 $tree = $DIC->repositoryTree();
155 $parent_id = $tree->getParentId($ref_id);
157 return (
int) $parent_id === (int) $mapping->
getTargetId();
getMapping($a_comp, $a_entity, $a_old_id)
Get a mapping.
static getDefaultMemberRole($a_ref_id)
static _getAllReferences($a_id)
get all reference ids of object
static writeStyleUsage($a_obj_id, $a_style_id)
Write style usage.
importXmlRepresentation($a_entity, $a_id, $a_xml, $a_mapping)
Import XML.
static _writeParentId($a_parent_type, $a_pg_id, $a_par_id)
Write parent id.
getTargetId()
get target id
handleOfflineStatus(string $xml, ilImportMapping $mapping)
XML parser for container structure.
static getInstanceByRefId($a_ref_id, $stop_on_error=true)
get an instance of an Ilias object by reference id
static getLogger($a_component_id)
Get component logger.
finalProcessing($a_mapping)
isRootNode(int $ref_id, ilImportMapping $mapping)