ILIAS  release_7 Revision v7.30-3-g800a261c036
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

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

References $name, $res, ilPageObject\_exists(), ilXmlImporter\finalProcessing(), ilPageObjectFactory\getInstance(), ilPageComponentPluginImporter\getPCProperties(), ilPageComponentPluginImporter\getPCVersion(), ilXmlImporter\getSchemaVersion(), ilPageComponentPluginImporter\setPCProperties(), and ilPageComponentPluginImporter\setPCVersion().

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");
72  $parser = new ilDataSetImportParser(
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 {
115  if (ilPageObject::_exists($id[0], (int) $id[1], "-", true)) {
116  return;
117  }
118  $new_page = ilPageObjectFactory::getInstance($id[0]);
119  $new_page->setImportMode(true);
120  $new_page->setId($id[1]);
121  if ($lstr != "" && $lstr != "-") {
122  $new_page->setLanguage($lstr);
123  }
124  $this->log->debug(">>> CREATE PAGE " . $id[0] . ":" . $id[1]);
125  $new_page->setXMLContent($next_xml);
126  $new_page->setActive(true);
127  // array_key_exists does NOT work on simplexml!
128  if (isset($page_data["Active"])) {
129  $new_page->setActive($page_data["Active"]);
130  }
131  $new_page->setActivationStart($page_data["ActivationStart"]);
132  $new_page->setActivationEnd($page_data["ActivationEnd"]);
133  $new_page->setShowActivationInfo($page_data["ShowActivationInfo"]);
134  $new_page->createFromXML();
135  $this->extractPluginProperties($new_page);
136  }
137 
138  $a_xml = substr($a_xml, $p);
139  if ($lstr == "") {
140  $lstr = "-";
141  }
142  $a_mapping->addMapping("Services/COPage", "pgl", $a_id . ":" . $lstr, $pg_id . ":" . $lstr);
143  }
144  }
145  }
146  }
147  $this->log->debug("done");
148  }
static _exists($a_parent_type, $a_id, $a_lang="", $a_no_cache=false)
Checks whether page exists.
getSchemaVersion()
Get schema version.
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.
+ 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: