ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
class.ilLearningSequenceExporter.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
9 {
10  public function init()
11  {
12  global $DIC;
13 
14  $this->settings = $DIC["ilSetting"];
15  $this->rbac_review = $DIC["rbacreview"];
16  }
17 
18  public function getXmlRepresentation($entity, $target_release, $obj_id)
19  {
20  $writer = $this->getWriter((int) $obj_id);
21  $writer->start();
22 
23  return $writer->getXml();
24  }
25 
26  protected function getWriter(int $obj_id) : ilLearningSequenceXMLWriter
27  {
28  if ($type = ilObject::_lookupType($obj_id) != "lso") {
29  throw new Exception("Wrong type " . $type . " for lso export.");
30  }
31 
32  $ls_ref_id = end(ilObject::_getAllReferences($obj_id));
33  $ls_object = ilObjectFactory::getInstanceByRefId($ls_ref_id, false);
34  $lp_settings = new ilLPObjSettings($obj_id);
35 
36  return new ilLearningSequenceXMLWriter(
37  $ls_object,
38  $this->settings,
39  $lp_settings,
40  $this->rbac_review
41  );
42  }
43 
44  public function getValidSchemaVersions($entity)
45  {
46  return array(
47  "5.4.0" => array(
48  "namespace" => "http://www.ilias.de/Modules/LearningSequence/lso/5_4",
49  "xsd_file" => "ilias_lso_5_4.xsd",
50  "uses_dataset" => false,
51  "min" => "5.4.0",
52  "max" => ""
53  )
54  );
55  }
56 
57  public function getXmlExportHeadDependencies($entity, $target_release, $ids)
58  {
59  return array(
60  array(
61  'component' => 'Services/Container',
62  'entity' => 'struct',
63  'ids' => $ids
64  )
65  );
66  }
67 
71  public function getXmlExportTailDependencies($a_entity, $a_target_release, $a_ids)
72  {
73  $res = [];
74 
75  if ($a_entity == "lso") {
76  // service settings
77  $res[] = array(
78  "component" => "Services/Object",
79  "entity" => "common",
80  "ids" => $a_ids
81  );
82  }
83 
84  return $res;
85  }
86 
87 }
settings()
Definition: settings.php:2
$type
global $DIC
Definition: saml.php:7
static _getAllReferences($a_id)
get all reference ids of object
Xml Exporter class.
foreach($_POST as $key=> $value) $res
getXmlRepresentation($entity, $target_release, $obj_id)
getXmlExportHeadDependencies($entity, $target_release, $ids)
static _lookupType($a_id, $a_reference=false)
lookup object type
static getInstanceByRefId($a_ref_id, $stop_on_error=true)
get an instance of an Ilias object by reference id
getXmlExportTailDependencies($a_entity, $a_target_release, $a_ids)