ILIAS  release_8 Revision v8.24
ilCOPageImporter Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

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

Public Member Functions

 importXmlRepresentation (string $a_entity, string $a_id, string $a_xml, ilImportMapping $a_mapping)
 
 afterContainerImportProcessing (ilImportMapping $a_mapping)
 
- Public Member Functions inherited from ilXmlImporter
 __construct ()
 
 setImport (ilImport $a_val)
 
 getImport ()
 
 init ()
 
 setInstallId (string $a_val)
 
 getInstallId ()
 
 setInstallUrl (string $a_val)
 
 getInstallUrl ()
 
 setSchemaVersion (string $a_val)
 
 getSchemaVersion ()
 
 setImportDirectory (string $a_val)
 
 getImportDirectory ()
 
 setSkipEntities (array $a_val)
 
 getSkipEntities ()
 
 exportedFromSameInstallation ()
 
 importXmlRepresentation (string $a_entity, string $a_id, string $a_xml, ilImportMapping $a_mapping)
 
 finalProcessing (ilImportMapping $a_mapping)
 
 afterContainerImportProcessing (ilImportMapping $mapping)
 

Protected Attributes

ilImportConfig $config
 
ilLogger $log
 
ilCOPageDataSet $ds
 
array $importer_plugins = array()
 
- Protected Attributes inherited from ilXmlImporter
array $skip_entities = array()
 
ilImport $imp
 
string $install_id
 
string $install_url
 
string $schema_version
 
string $import_directory
 

Detailed Description

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning Importer class for pages

Author
Alexander Killing killi.nosp@m.ng@l.nosp@m.eifos.nosp@m..de

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

Member Function Documentation

◆ afterContainerImportProcessing()

ilCOPageImporter::afterContainerImportProcessing ( ilImportMapping  $a_mapping)

Reimplemented from ilXmlImporter.

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

177 : void {
178 }

◆ importXmlRepresentation()

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

Reimplemented from ilXmlImporter.

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

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

References ilXmlImporter\getSchemaVersion().

+ Here is the call graph for this function:

Field Documentation

◆ $config

ilImportConfig ilCOPageImporter::$config
protected

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

◆ $ds

ilCOPageDataSet ilCOPageImporter::$ds
protected

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

◆ $importer_plugins

array ilCOPageImporter::$importer_plugins = array()
protected

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

◆ $log

ilLogger ilCOPageImporter::$log
protected

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


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