ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ilCOPageImporter Class Reference

Importer class for pages. More...

+ Inheritance diagram for ilCOPageImporter:
+ Collaboration diagram for ilCOPageImporter:

Public Member Functions

 importXmlRepresentation ($a_entity, $a_id, $a_xml, $a_mapping)
 Import XML. More...
 
- Public Member Functions inherited from ilXmlImporter
 __construct ()
 Constructor. More...
 
 setImport ($a_val)
 Set import. More...
 
 getImport ()
 Get import. More...
 
 init ()
 Init. More...
 
 setInstallId ($a_val)
 Set installation id. More...
 
 getInstallId ()
 Get installation id. More...
 
 setInstallUrl ($a_val)
 Set installation url. More...
 
 getInstallUrl ()
 Get installation url. More...
 
 setSchemaVersion ($a_val)
 Set schema version. More...
 
 getSchemaVersion ()
 Get schema version. More...
 
 setImportDirectory ($a_val)
 Set import directory. More...
 
 getImportDirectory ()
 Get import directory. More...
 
 setSkipEntities ($a_val)
 Set skip entities. More...
 
 getSkipEntities ()
 Get skip entities. More...
 
 exportedFromSameInstallation ()
 Is exporting and importing installation identical? More...
 
 importXmlRepresentation ($a_entity, $a_id, $a_xml, $a_mapping)
 Import xml representation. More...
 
 finalProcessing ($a_mapping)
 Final processing. More...
 
 afterContainerImportProcessing (ilImportMapping $mapping)
 Called after all container objects have been implemented. More...
 

Protected Attributes

 $log
 
 $ds
 
 $importer_plugins = array()
 
- Protected Attributes inherited from ilXmlImporter
 $skip_entities = array()
 
 $imp
 

Detailed Description

Importer class for pages.

Author
Alex Killing alex..nosp@m.kill.nosp@m.ing@g.nosp@m.mx.d.nosp@m.e
Version
Id

Definition at line 13 of file class.ilCOPageImporter.php.

Member Function Documentation

◆ importXmlRepresentation()

ilCOPageImporter::importXmlRepresentation (   $a_entity,
  $a_id,
  $a_xml,
  $a_mapping 
)

Import XML.

Parameters

return

Reimplemented from ilXmlImporter.

Definition at line 66 of file class.ilCOPageImporter.php.

67 {
68 $this->log->debug("entity: " . $a_entity . ", id: " . $a_id);
69
70 if ($a_entity == "pgtp") {
71 include_once("./Services/DataSet/classes/class.ilDataSetImportParser.php");
73 $a_entity,
74 $this->getSchemaVersion(),
75 $a_xml,
76 $this->ds,
77 $a_mapping
78 );
79 }
80
81 if ($a_entity == "pg") {
82 $pg_id = $a_mapping->getMapping("Services/COPage", "pg", $a_id);
83
84 $this->log->debug("mapping id: " . $pg_id);
85
86 if ($pg_id != "") {
87 $id = explode(":", $pg_id);
88 if (count($id) == 2) {
89 include_once("./Services/COPage/classes/class.ilPageObjectFactory.php");
90
91 while (substr($a_xml, 0, 11) == "<PageObject") {
92 $l1 = strpos($a_xml, ">");
93
94 $page_tag = "<?xml version='1.0'?> " . substr($a_xml, 0, $l1+1) . "</PageObject>";
95 $page_data = simplexml_load_string($page_tag);
96 $lstr = $page_data['Language'];
97 $p = strpos($a_xml, "</PageObject>") + 13;
98 $next_xml = "<PageObject>" . substr($a_xml, $l1+1, $p - $l1 -1);
99
100 if ($this->config->getForceLanguage() != "") {
101 $lstr = $this->config->getForceLanguage();
102 }
103 if ($lstr == "") {
104 $lstr = "-";
105 }
106 // see bug #0019049
107 $next_xml = str_replace("&amp;", "&", $next_xml);
108 if ($this->config->getUpdateIfExists() && ilPageObject::_exists($id[0], $id[1], $lstr)) {
109 $page = ilPageObjectFactory::getInstance($id[0], $id[1], 0, $lstr);
110 $page->setImportMode(true);
111 $page->setXMLContent($next_xml);
112 $page->updateFromXML();
113 $this->extractPluginProperties($page);
114 } else {
116 $new_page->setImportMode(true);
117 $new_page->setId($id[1]);
118 if ($lstr != "" && $lstr != "-") {
119 $new_page->setLanguage($lstr);
120 }
121 $new_page->setXMLContent($next_xml);
122 $new_page->setActive(true);
123 // array_key_exists does NOT work on simplexml!
124 if (isset($page_data["Active"])) {
125 $new_page->setActive($page_data["Active"]);
126 }
127 $new_page->setActivationStart($page_data["ActivationStart"]);
128 $new_page->setActivationEnd($page_data["ActivationEnd"]);
129 $new_page->setShowActivationInfo($page_data["ShowActivationInfo"]);
130 $new_page->createFromXML();
131 $this->extractPluginProperties($new_page);
132 }
133
134 $a_xml = substr($a_xml, $p);
135 if ($lstr == "") {
136 $lstr = "-";
137 }
138 $a_mapping->addMapping("Services/COPage", "pgl", $a_id . ":" . $lstr, $pg_id . ":" . $lstr);
139 }
140 }
141 }
142 }
143 $this->log->debug("done");
144 }
$parser
Definition: BPMN2Parser.php:23
Manifest parser for ILIAS standard export files.
static getInstance($a_parent_type, $a_id=0, $a_old_nr=0, $a_lang="-")
Get page object instance.
static _exists($a_parent_type, $a_id, $a_lang="", $a_no_cache=false)
Checks whether page exists.
getSchemaVersion()
Get schema version.
if(!array_key_exists('StateId', $_REQUEST)) $id

References $id, $parser, ilPageObject\_exists(), ilPageObjectFactory\getInstance(), and ilXmlImporter\getSchemaVersion().

+ Here is the call graph for this function:

Field Documentation

◆ $ds

ilCOPageImporter::$ds
protected

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

◆ $importer_plugins

ilCOPageImporter::$importer_plugins = array()
protected

Definition at line 29 of file class.ilCOPageImporter.php.

◆ $log

ilCOPageImporter::$log
protected

Definition at line 18 of file class.ilCOPageImporter.php.


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