ILIAS  trunk Revision v11.0_alpha-1753-gb21ca8c4367
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
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" => "components/ILIAS/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)->getExportStyleId();
68  if ($style_id > 0) {
69  $style_ids[] = $style_id;
70  }
71  }
72  if (count($style_ids)) {
73  $res[] = array(
74  "component" => "components/ILIAS/Style",
75  "entity" => "sty",
76  "ids" => $style_ids
77  );
78  }
79 
80  // service settings
81  $res[] = array(
82  "component" => "components/ILIAS/ILIASObject",
83  "entity" => "common",
84  "ids" => $a_ids
85  );
86 
87  $md_ids = [];
88  foreach ($a_ids as $id) {
89  $md_ids[] = $id . ':0:blog';
90  }
91  if (!empty($md_ids)) {
92  $res[] = [
93  'component' => 'components/ILIAS/MetaData',
94  'entity' => 'md',
95  'ids' => $md_ids,
96  ];
97  }
98 
99  return $res;
100  }
101 
102  public function getXmlRepresentation(
103  string $a_entity,
104  string $a_schema_version,
105  string $a_id
106  ): string {
107  $this->ds->initByExporter($this);
108  return $this->ds->getXmlRepresentation($a_entity, $a_schema_version, [$a_id], "", true, true);
109  }
110 
111  public function getValidSchemaVersions(
112  string $a_entity
113  ): array {
114  return array(
115  "8.0" => array(
116  "namespace" => "https://www.ilias.de/Modules/Blog/8",
117  "xsd_file" => "ilias_blog_8.xsd",
118  "uses_dataset" => true,
119  "min" => "8.0",
120  "max" => ""
121  ),
122  "5.3.0" => array(
123  "namespace" => "https://www.ilias.de/Modules/Blog/5_0",
124  "xsd_file" => "ilias_blog_5_0.xsd",
125  "uses_dataset" => true,
126  "min" => "5.3.0",
127  "max" => ""
128  ),
129  "5.0.0" => array(
130  "namespace" => "https://www.ilias.de/Modules/Blog/5_0",
131  "xsd_file" => "ilias_blog_5_0.xsd",
132  "uses_dataset" => true,
133  "min" => "5.0.0",
134  "max" => "5.2.99"
135  ),
136  "4.3.0" => array(
137  "namespace" => "https://www.ilias.de/Modules/Blog/4_3",
138  "xsd_file" => "ilias_blog_4_3.xsd",
139  "uses_dataset" => true,
140  "min" => "4.3.0",
141  "max" => "4.9.9"
142  )
143  );
144  }
145 }
$res
Definition: ltiservices.php:66
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:
getXmlExportTailDependencies(string $a_entity, string $a_target_release, array $a_ids)
global $DIC
Definition: shib_login.php:22
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
ILIAS Style Content DomainService $content_style_domain
getXmlRepresentation(string $a_entity, string $a_schema_version, string $a_id)