ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
class.ilBlogImporter.php
Go to the documentation of this file.
1 <?php
2 
25 {
26  protected ilBlogDataSet $ds;
27  protected \ILIAS\Style\Content\DomainService $content_style_domain;
28 
29  public function init(): void
30  {
31  global $DIC;
32 
33  $this->ds = new ilBlogDataSet();
34  $this->ds->setDSPrefix("ds");
35  $this->content_style_domain = $DIC
36  ->contentStyle()
37  ->domain();
38 
39  $cop_config = $this->getImport()->getConfig("Services/COPage");
40  $cop_config->setUpdateIfExists(true);
41  }
42 
43  public function importXmlRepresentation(
44  string $a_entity,
45  string $a_id,
46  string $a_xml,
47  ilImportMapping $a_mapping
48  ): void {
49  $this->ds->setImportDirectory($this->getImportDirectory());
50  $parser = new ilDataSetImportParser(
51  $a_entity,
52  $this->getSchemaVersion(),
53  $a_xml,
54  $this->ds,
55  $a_mapping
56  );
57  }
58 
59  public function finalProcessing(
60  ilImportMapping $a_mapping
61  ): void {
62  $blp_map = $a_mapping->getMappingsOfEntity("Services/COPage", "pg");
63  foreach ($blp_map as $blp_id) {
64  $blp_id = (int) substr($blp_id, 4);
65  $blog_id = ilBlogPosting::lookupBlogId($blp_id);
66  ilBlogPosting::_writeParentId("blp", $blp_id, (int) $blog_id);
67  }
68 
69  $sty_map = $a_mapping->getMappingsOfEntity("Services/Style", "sty");
70  foreach ($sty_map as $old_sty_id => $new_sty_id) {
71  if (is_array(ilBlogDataSet::$style_map[$old_sty_id])) {
72  foreach (ilBlogDataSet::$style_map[$old_sty_id] as $blog_id) {
73  $this->content_style_domain
74  ->styleForObjId($blog_id)
75  ->updateStyleId($new_sty_id);
76  }
77  }
78  }
79  }
80 }
static array $style_map
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _writeParentId(string $a_parent_type, int $a_pg_id, int $a_par_id)
Blog Data set class This class implements the following entities:
Manifest parser for ILIAS standard export files.
ILIAS Style Content DomainService $content_style_domain
global $DIC
Definition: feed.php:28
finalProcessing(ilImportMapping $a_mapping)
getMappingsOfEntity(string $a_comp, string $a_entity)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static lookupBlogId(int $a_posting_id)
importXmlRepresentation(string $a_entity, string $a_id, string $a_xml, ilImportMapping $a_mapping)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...