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