ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
class.ilTestExporter.php
Go to the documentation of this file.
1 <?php
2 
27 {
28  private $ds;
29 
33  public function init(): void
34  {
35  }
36 
37  public function getXmlRepresentation(string $a_entity, string $a_schema_version, string $a_id): string
38  {
39  include_once './Modules/Test/classes/class.ilObjTest.php';
40  $tst = new ilObjTest($a_id, false);
41 
42  require_once 'Modules/Test/classes/class.ilTestExportFactory.php';
43  $expFactory = new ilTestExportFactory($tst);
44  $testExport = $expFactory->getExporter('xml');
45  $zip = $testExport->buildExportFile();
46 
47  global $DIC; /* @var ILIAS\DI\Container $DIC */
48  $DIC['ilLog']->write(__METHOD__ . ': Created zip file ' . $zip);
49  return ''; // Sagt mjansen
50  }
51 
59  public function getXmlExportTailDependencies(string $a_entity, string $a_target_release, array $a_ids): array
60  {
61  if ($a_entity == 'tst') {
62  $deps = array();
63 
64  $taxIds = $this->getDependingTaxonomyIds($a_ids);
65 
66  if (count($taxIds)) {
67  $deps[] = array(
68  'component' => 'Services/Taxonomy',
69  'entity' => 'tax',
70  'ids' => $taxIds
71  );
72  }
73 
74  // service settings
75  $deps[] = array(
76  "component" => "Services/Object",
77  "entity" => "common",
78  "ids" => $a_ids
79  );
80 
81  return $deps;
82  }
83 
84  return parent::getXmlExportTailDependencies($a_entity, $a_target_release, $a_ids);
85  }
86 
91  private function getDependingTaxonomyIds($testObjIds): array
92  {
93  include_once 'Services/Taxonomy/classes/class.ilObjTaxonomy.php';
94 
95  $taxIds = array();
96 
97  foreach ($testObjIds as $testObjId) {
98  foreach (ilObjTaxonomy::getUsageOfObject($testObjId) as $taxId) {
99  $taxIds[$taxId] = $taxId;
100  }
101  }
102 
103  return $taxIds;
104  }
105 
113  public function getValidSchemaVersions(string $a_entity): array
114  {
115  return array(
116  "4.1.0" => array(
117  "namespace" => "http://www.ilias.de/Modules/Test/htlm/4_1",
118  "xsd_file" => "ilias_tst_4_1.xsd",
119  "uses_dataset" => false,
120  "min" => "4.1.0",
121  "max" => "")
122  );
123  }
124 }
init()
Initialisation.
static getUsageOfObject(int $a_obj_id, bool $a_include_titles=false)
getXmlExportTailDependencies(string $a_entity, string $a_target_release, array $a_ids)
Get tail dependencies.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
global $DIC
Definition: feed.php:28
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
getDependingTaxonomyIds($testObjIds)
getXmlRepresentation(string $a_entity, string $a_schema_version, string $a_id)
getValidSchemaVersions(string $a_entity)
Returns schema versions that the component can export to.