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