ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
class.ilBlogExporter.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
26 {
27  protected ilBlogDataSet $ds;
28  protected \ILIAS\Style\Content\DomainService $content_style_domain;
29 
30  public function init(): void
31  {
32  global $DIC;
33 
34  $this->ds = new ilBlogDataSet();
35  $this->ds->setDSPrefix("ds");
36  $this->content_style_domain = $DIC
37  ->contentStyle()
38  ->domain();
39  }
40 
42  string $a_entity,
43  string $a_target_release,
44  array $a_ids
45  ): array {
46  $res = array();
47 
48  // postings
49  $pg_ids = array();
50  foreach ($a_ids as $id) {
51  $pages = ilBlogPosting::getAllPostings($id);
52  foreach (array_keys($pages) as $p) {
53  $pg_ids[] = "blp:" . $p;
54  }
55  }
56  if (count($pg_ids)) {
57  $res[] = array(
58  "component" => "Services/COPage",
59  "entity" => "pg",
60  "ids" => $pg_ids
61  );
62  }
63 
64  // style
65  $style_ids = array();
66  foreach ($a_ids as $id) {
67  $style_id = $this->content_style_domain->styleForObjId((int) $id)->getStyleId();
68  if ($style_id > 0) {
69  $style_ids[] = $style_id;
70  }
71  }
72  if (count($style_ids)) {
73  $res[] = array(
74  "component" => "Services/Style",
75  "entity" => "sty",
76  "ids" => $style_ids
77  );
78  }
79 
80  // service settings
81  $res[] = array(
82  "component" => "Services/Object",
83  "entity" => "common",
84  "ids" => $a_ids
85  );
86 
87  return $res;
88  }
89 
90  public function getXmlRepresentation(
91  string $a_entity,
92  string $a_schema_version,
93  string $a_id
94  ): string {
95  $this->ds->setExportDirectories($this->dir_relative, $this->dir_absolute);
96  return $this->ds->getXmlRepresentation($a_entity, $a_schema_version, [$a_id], "", true, true);
97  }
98 
99  public function getValidSchemaVersions(
100  string $a_entity
101  ): array {
102  return array(
103  "8.0" => array(
104  "namespace" => "https://www.ilias.de/Modules/Blog/8",
105  "xsd_file" => "ilias_blog_8.xsd",
106  "uses_dataset" => true,
107  "min" => "8.0",
108  "max" => ""
109  ),
110  "5.3.0" => array(
111  "namespace" => "https://www.ilias.de/Modules/Blog/5_0",
112  "xsd_file" => "ilias_blog_5_0.xsd",
113  "uses_dataset" => true,
114  "min" => "5.3.0",
115  "max" => ""
116  ),
117  "5.0.0" => array(
118  "namespace" => "https://www.ilias.de/Modules/Blog/5_0",
119  "xsd_file" => "ilias_blog_5_0.xsd",
120  "uses_dataset" => true,
121  "min" => "5.0.0",
122  "max" => "5.2.99"
123  ),
124  "4.3.0" => array(
125  "namespace" => "https://www.ilias.de/Modules/Blog/4_3",
126  "xsd_file" => "ilias_blog_4_3.xsd",
127  "uses_dataset" => true,
128  "min" => "4.3.0",
129  "max" => "4.9.9"
130  )
131  );
132  }
133 }
$res
Definition: ltiservices.php:69
Blog export definition.
getValidSchemaVersions(string $a_entity)
static getAllPostings(int $a_blog_id, int $a_limit=1000, int $a_offset=0)
Get all postings of blog.
Blog Data set class This class implements the following entities:
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
global $DIC
Definition: feed.php:28
getXmlExportTailDependencies(string $a_entity, string $a_target_release, array $a_ids)
ILIAS Style Content DomainService $content_style_domain
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
getXmlRepresentation(string $a_entity, string $a_schema_version, string $a_id)