ILIAS  release_10 Revision v10.1-43-ga1241a92c2f
class.ilSessionExporter.php
Go to the documentation of this file.
1 <?php
2 
20 declare(strict_types=1);
21 
30 {
32 
33  public function init(): void
34  {
35  $this->ds = new ilSessionDataSet();
36  $this->ds->initByExporter($this);
37  $this->ds->setDSPrefix("ds");
38  }
39 
40  public function getXmlExportTailDependencies(string $a_entity, string $a_target_release, array $a_ids): array
41  {
42  $deps = [];
43 
44  $advmd_ids = [];
45  foreach ($a_ids as $id) {
46  $rec_ids = $this->getActiveAdvMDRecords($id);
47  if (sizeof($rec_ids)) {
48  foreach ($rec_ids as $rec_id) {
49  $advmd_ids[] = $id . ":" . $rec_id;
50  }
51  }
52  }
53  if (sizeof($advmd_ids)) {
54  $deps[] = array(
55  "component" => "components/ILIAS/AdvancedMetaData",
56  "entity" => "advmd",
57  "ids" => $advmd_ids
58  );
59  }
60 
61  $md_ids = [];
62  foreach ($a_ids as $sess_id) {
63  $md_ids[] = $sess_id . ":0:sess";
64  }
65  if ($md_ids) {
66  $deps[] =
67  array(
68  "component" => "components/ILIAS/MetaData",
69  "entity" => "md",
70  "ids" => $md_ids
71  );
72  }
73 
74  // service settings
75  $deps[] = array(
76  "component" => "components/ILIAS/ILIASObject",
77  "entity" => "service_settings",
78  "ids" => $a_ids);
79 
80  // tile image
81  $deps[] = array(
82  "component" => "components/ILIAS/ILIASObject",
83  "entity" => "tile",
84  "ids" => $a_ids);
85 
86  return $deps;
87  }
88 
89  protected function getActiveAdvMDRecords(int $a_id): array
90  {
91  $active = [];
92 
93  foreach (ilAdvancedMDRecord::_getActivatedRecordsByObjectType('sess') as $record_obj) {
94  foreach ($record_obj->getAssignedObjectTypes() as $obj_info) {
95  if ($obj_info['obj_type'] == 'sess' && $obj_info['optional'] == 0) {
96  $active[] = $record_obj->getRecordId();
97  }
98  // local activation
99  if (
100  $obj_info['obj_type'] == 'sess' &&
101  $obj_info['optional'] == 1 &&
102  $a_id == $record_obj->getParentObject()
103  ) {
104  $active[] = $record_obj->getRecordId();
105  }
106  }
107  }
108  return $active;
109  }
110 
111  public function getXmlRepresentation(string $a_entity, string $a_schema_version, string $a_id): string
112  {
113  return $this->ds->getXmlRepresentation($a_entity, $a_schema_version, [$a_id], "", true, true);
114  }
115 
116  public function getValidSchemaVersions(string $a_entity): array
117  {
118  return [
119  "4.1.0" => [
120  "namespace" => "http://www.ilias.de/Modules/Session/sess/4_1",
121  "xsd_file" => "ilias_sess_4_1.xsd",
122  "uses_dataset" => true,
123  "min" => "4.1.0",
124  "max" => "4.4.999"
125  ],
126  "5.0.0" => [
127  "namespace" => "http://www.ilias.de/Modules/Session/sess/5_0",
128  "xsd_file" => "ilias_sess_5_0.xsd",
129  "uses_dataset" => true,
130  "min" => "5.0.0",
131  "max" => "5.0.999"
132  ],
133  "5.1.0" => [
134  "namespace" => "http://www.ilias.de/Modules/Session/sess/5_1",
135  "xsd_file" => "ilias_sess_5_1.xsd",
136  "uses_dataset" => true,
137  "min" => "5.1.0",
138  "max" => "5.3.999"
139  ],
140  "5.4.0" => [
141  "namespace" => "http://www.ilias.de/Modules/Session/sess/5_1",
142  "xsd_file" => "ilias_sess_5_1.xsd",
143  "uses_dataset" => true,
144  "min" => "5.4.0",
145  "max" => "5.4.99"
146  ],
147  "7.0" => [
148  "namespace" => "http://www.ilias.de/Modules/Session/sess/7",
149  "xsd_file" => "ilias_sess_7.xsd",
150  "uses_dataset" => true,
151  "min" => "7.0",
152  "max" => "8.99"
153  ],
154  "9.0" => [
155  "namespace" => "http://www.ilias.de/xml/Modules/Session/sess",
156  "xsd_file" => "ilias_sess_9.xsd",
157  "uses_dataset" => true,
158  "min" => "9.0",
159  "max" => ""
160  ]
161  ];
162  }
163 }
getXmlRepresentation(string $a_entity, string $a_schema_version, string $a_id)
getXmlExportTailDependencies(string $a_entity, string $a_target_release, array $a_ids)
getValidSchemaVersions(string $a_entity)
static _getActivatedRecordsByObjectType(string $a_obj_type, string $a_sub_type="", bool $a_only_optional=false)
Get activated records by object type.
Session data set class.
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:24
Exporter class for sessions.