ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
All Data Structures Namespaces Files Functions Variables Modules Pages
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  // tile image
76  $deps[] = array(
77  "component" => "Services/Object",
78  "entity" => "tile",
79  "ids" => $a_ids);
80 
81  return $deps;
82  }
83 
89  protected function getActiveAdvMDRecords($a_id)
90  {
91  $active = array();
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 
120  public function getXmlRepresentation($a_entity, $a_schema_version, $a_id)
121  {
122  return $this->ds->getXmlRepresentation($a_entity, $a_schema_version, $a_id, "", true, true);
123  }
124 
132  public function getValidSchemaVersions($a_entity)
133  {
134  return array(
135  "4.1.0" => array(
136  "namespace" => "http://www.ilias.de/Modules/Session/sess/4_1",
137  "xsd_file" => "ilias_sess_4_1.xsd",
138  "uses_dataset" => true,
139  "min" => "4.1.0",
140  "max" => "4.4.999"),
141  "5.0.0" => array(
142  "namespace" => "http://www.ilias.de/Modules/Session/sess/5_0",
143  "xsd_file" => "ilias_sess_5_0.xsd",
144  "uses_dataset" => true,
145  "min" => "5.0.0",
146  "max" => "5.0.999"),
147  "5.1.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.1.0",
152  "max" => "5.3.999"),
153  "5.4.0" => array(
154  "namespace" => "http://www.ilias.de/Modules/Session/sess/5_1",
155  "xsd_file" => "ilias_sess_5_1.xsd",
156  "uses_dataset" => true,
157  "min" => "5.4.0",
158  "max" => ""),
159  );
160  }
161 }
getValidSchemaVersions($a_entity)
Returns schema versions that the component can export to.
getXmlRepresentation($a_entity, $a_schema_version, $a_id)
Get xml representation.
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