ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
ilCOPageImporter Class Reference

Importer class for pages. More...

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

Public Member Functions

 init ()
 Initialisation. More...
 
 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
 
- 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 45 of file class.ilCOPageImporter.php.

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

46  {
47  $this->log->debug("entity: ".$a_entity.", id: ".$a_id);
48 
49  if ($a_entity == "pgtp")
50  {
51  include_once("./Services/DataSet/classes/class.ilDataSetImportParser.php");
52  $parser = new ilDataSetImportParser($a_entity, $this->getSchemaVersion(),
53  $a_xml, $this->ds, $a_mapping);
54  }
55 
56  if ($a_entity == "pg")
57  {
58  $pg_id = $a_mapping->getMapping("Services/COPage", "pg", $a_id);
59 
60  $this->log->debug("mapping id: ".$pg_id);
61 
62  if ($pg_id != "")
63  {
64  $id = explode(":", $pg_id);
65  if (count($id) == 2)
66  {
67  include_once("./Services/COPage/classes/class.ilPageObjectFactory.php");
68 
69  while (substr($a_xml, 0, 11) == "<PageObject")
70  {
71  $l1 = strpos($a_xml, ">");
72 
73  $page_tag = "<?xml version='1.0'?> ".substr($a_xml, 0, $l1+1)."</PageObject>";
74  $page_data = simplexml_load_string($page_tag);
75  $lstr = $page_data['Language'];
76  $p = strpos($a_xml, "</PageObject>") + 13;
77  $next_xml = "<PageObject>".substr($a_xml, $l1+1, $p - $l1 -1);
78 
79  if ($this->config->getForceLanguage() != "")
80  {
81  $lstr = $this->config->getForceLanguage();
82  }
83  if ($lstr == "")
84  {
85  $lstr = "-";
86  }
87  // see bug #0019049
88  $next_xml = str_replace("&amp;", "&", $next_xml);
89  if ($this->config->getUpdateIfExists() && ilPageObject::_exists($id[0], $id[1], $lstr))
90  {
91  $page = ilPageObjectFactory::getInstance($id[0], $id[1], 0, $lstr);
92  $page->setImportMode(true);
93  $page->setXMLContent($next_xml);
94  $page->updateFromXML();
95  }
96  else
97  {
98  $new_page = ilPageObjectFactory::getInstance($id[0]);
99  $new_page->setImportMode(true);
100  $new_page->setId($id[1]);
101  if ($lstr != "" && $lstr != "-")
102  {
103  $new_page->setLanguage($lstr);
104  }
105  $new_page->setXMLContent($next_xml);
106  $new_page->setActive(true);
107  // array_key_exists does NOT work on simplexml!
108  if (isset($page_data["Active"]))
109  {
110  $new_page->setActive($page_data["Active"]);
111  }
112  $new_page->setActivationStart($page_data["ActivationStart"]);
113  $new_page->setActivationEnd($page_data["ActivationEnd"]);
114  $new_page->setShowActivationInfo($page_data["ShowActivationInfo"]);
115  $new_page->createFromXML();
116  }
117 
118  $a_xml = substr($a_xml, $p);
119  if ($lstr == "")
120  {
121  $lstr = "-";
122  }
123  $a_mapping->addMapping("Services/COPage", "pgl", $a_id.":".$lstr, $pg_id.":".$lstr);
124  }
125  }
126  }
127  }
128  $this->log->debug("done");
129  }
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.
$parser
Definition: BPMN2Parser.php:24
+ Here is the call graph for this function:

◆ init()

ilCOPageImporter::init ( )

Initialisation.

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

References ilXmlImporter\getImport(), and ilLoggerFactory\getLogger().

29  {
30  include_once("./Services/COPage/classes/class.ilCOPageDataSet.php");
31  $this->ds = new ilCOPageDataSet();
32  $this->ds->setDSPrefix("ds");
33  $this->config = $this->getImport()->getConfig("Services/COPage");
34 
35  $this->log = ilLoggerFactory::getLogger('copg');
36  }
COPage Data set class.
getImport()
Get import.
static getLogger($a_component_id)
Get component logger.
+ Here is the call graph for this function:

Field Documentation

◆ $ds

ilCOPageImporter::$ds
protected

Definition at line 23 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: