ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
class.ilSessionExporter.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2010 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
4 include_once("./Services/Export/classes/class.ilXmlExporter.php");
5 
14 {
15  private $ds;
16 
20  public function init()
21  {
22  include_once("./Modules/Session/classes/class.ilSessionDataSet.php");
23  $this->ds = new ilSessionDataSet();
24  $this->ds->setExportDirectories($this->dir_relative, $this->dir_absolute);
25  $this->ds->setDSPrefix("ds");
26  }
27 
35  public function getXmlExportTailDependencies($a_entity, $a_target_release, $a_ids)
36  {
37  $deps = [];
38 
39  $advmd_ids = array();
40  foreach ($a_ids as $id) {
41  $rec_ids = $this->getActiveAdvMDRecords($id);
42  if (sizeof($rec_ids)) {
43  foreach ($rec_ids as $rec_id) {
44  $advmd_ids[] = $id . ":" . $rec_id;
45  }
46  }
47  }
48  if (sizeof($advmd_ids)) {
49  $deps[] = array(
50  "component" => "Services/AdvancedMetaData",
51  "entity" => "advmd",
52  "ids" => $advmd_ids
53  );
54  }
55 
56  $md_ids = array();
57  foreach ($a_ids as $sess_id) {
58  $md_ids[] = $sess_id . ":0:sess";
59  }
60  if ($md_ids) {
61  $deps[] =
62  array(
63  "component" => "Services/MetaData",
64  "entity" => "md",
65  "ids" => $md_ids
66  );
67  }
68 
69  // service settings
70  $deps[] = array(
71  "component" => "Services/Object",
72  "entity" => "service_settings",
73  "ids" => $a_ids);
74 
75  return $deps;
76  }
77 
83  protected function getActiveAdvMDRecords($a_id)
84  {
85  $active = array();
86 
87  foreach (ilAdvancedMDRecord::_getActivatedRecordsByObjectType('sess') as $record_obj) {
88  foreach ($record_obj->getAssignedObjectTypes() as $obj_info) {
89  if ($obj_info['obj_type'] == 'sess' && $obj_info['optional'] == 0) {
90  $active[] = $record_obj->getRecordId();
91  }
92  // local activation
93  if (
94  $obj_info['obj_type'] == 'sess' &&
95  $obj_info['optional'] == 1 &&
96  $a_id == $record_obj->getParentObject()
97  ) {
98  $active[] = $record_obj->getRecordId();
99  }
100  }
101  }
102  return $active;
103  }
104 
105 
114  public function getXmlRepresentation($a_entity, $a_schema_version, $a_id)
115  {
116  return $this->ds->getXmlRepresentation($a_entity, $a_schema_version, $a_id, "", true, true);
117  }
118 
126  public function getValidSchemaVersions($a_entity)
127  {
128  return array(
129  "4.1.0" => array(
130  "namespace" => "http://www.ilias.de/Modules/Session/sess/4_1",
131  "xsd_file" => "ilias_sess_4_1.xsd",
132  "uses_dataset" => true,
133  "min" => "4.1.0",
134  "max" => "4.4.999"),
135  "5.0.0" => array(
136  "namespace" => "http://www.ilias.de/Modules/Session/sess/5_0",
137  "xsd_file" => "ilias_sess_5_0.xsd",
138  "uses_dataset" => true,
139  "min" => "5.0.0",
140  "max" => "5.0.999"),
141  "5.1.0" => array(
142  "namespace" => "http://www.ilias.de/Modules/Session/sess/5_1",
143  "xsd_file" => "ilias_sess_5_1.xsd",
144  "uses_dataset" => true,
145  "min" => "5.1.0",
146  "max" => "5.3.999"),
147  "5.4.0" => array(
148  "namespace" => "http://www.ilias.de/Modules/Session/sess/5_1",
149  "xsd_file" => "ilias_sess_5_1.xsd",
150  "uses_dataset" => true,
151  "min" => "5.4.0",
152  "max" => ""),
153  );
154  }
155 }
getValidSchemaVersions($a_entity)
Returns schema versions that the component can export to.
getXmlRepresentation($a_entity, $a_schema_version, $a_id)
Get xml representation.
if(!array_key_exists('StateId', $_REQUEST)) $id
Xml Exporter class.
Session data set class.
getXmlExportTailDependencies($a_entity, $a_target_release, $a_ids)
Get tail dependencies.
static _getActivatedRecordsByObjectType($a_obj_type, $a_sub_type="", $a_only_optional=false)
Get activated records by object type.
Exporter class for sessions.
getActiveAdvMDRecords($a_id)
get activated adv md records