ILIAS  trunk Revision v13.0_alpha-52-g21c366bbdd4
class.ilBlogImporter.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
29{
30 protected \ILIAS\Blog\InternalService $blog_service;
32 protected ilBlogDataSet $ds;
33 protected \ILIAS\Style\Content\DomainService $content_style_domain;
34
35 public function __construct()
36 {
38 global $DIC;
39 $this->page_manager = $DIC->copage()->internal()->domain()->page();
40 $this->content_style_domain = $DIC
41 ->contentStyle()
42 ->domain();
43 $this->blog_service = $DIC->blog()->internal();
44 }
45
46 public function init(): void
47 {
48 $this->ds = new ilBlogDataSet();
49 $this->ds->setDSPrefix("ds");
50 $cop_config = $this->getImport()->getConfig("components/ILIAS/COPage");
51 $cop_config->setUpdateIfExists(true);
52 }
53
54 public function importXmlRepresentation(
55 string $a_entity,
56 string $a_id,
57 string $a_xml,
58 ilImportMapping $a_mapping
59 ): void {
60 $this->ds->setImportDirectory($this->getImportDirectory());
62 $a_entity,
63 $this->getSchemaVersion(),
64 $a_xml,
65 $this->ds,
66 $a_mapping
67 );
68 }
69
70 public function finalProcessing(
71 ilImportMapping $a_mapping
72 ): void {
73 $blp_map = $a_mapping->getMappingsOfEntity("components/ILIAS/COPage", "pg");
74 foreach ($blp_map as $blp_id) {
75 $blp_id = (int) substr($blp_id, 4);
76 $blog_id = $this->blog_service->domain()->posting()->lookupBlogId($blp_id);
77 $this->page_manager->writeParentId("blp", $blp_id, (int) $blog_id);
78 }
79
80 $sty_map = $a_mapping->getMappingsOfEntity("components/ILIAS/Style", "sty");
81 foreach ($sty_map as $old_sty_id => $new_sty_id) {
82 if (is_array(ilBlogDataSet::$style_map[$old_sty_id] ?? false)) {
83 foreach (ilBlogDataSet::$style_map[$old_sty_id] as $blog_id) {
84 $this->content_style_domain
85 ->styleForObjId($blog_id)
86 ->updateStyleId((int) $new_sty_id);
87 }
88 }
89 }
90 }
91}
Blog Data set class This class implements the following entities:
static array $style_map
Importer class for blog.
ILIAS Blog InternalService $blog_service
ILIAS Style Content DomainService $content_style_domain
finalProcessing(ilImportMapping $a_mapping)
PageManagerInterface $page_manager
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...
getMappingsOfEntity(string $a_comp, string $a_entity)
Xml importer class.
setImportDirectory(string $a_val)
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
foreach(array_slice( $argv, 1) as $argument) if(!is_dir($target)) $parser
global $DIC
Definition: shib_login.php:26