ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
class.ilTestQuestionPoolExporter.php
Go to the documentation of this file.
1 <?php
2 
27 {
28  private $ds;
29 
33  public function init(): void
34  {
35  }
36 
43  public static function lookupExportDirectory(string $a_obj_type, int $a_obj_id, string $a_export_type = 'xml', string $a_entity = ""): string
44  {
45  if ($a_export_type == 'xml') {
46  return ilFileUtils::getDataDir() . "/qpl_data" . "/qpl_" . $a_obj_id . "/export_zip";
47  }
48  return ilFileUtils::getDataDir() . "/qpl_data" . "/qpl_" . $a_obj_id . "/export_" . $a_export_type;
49  }
50 
51 
59  public function getXmlRepresentation(string $a_entity, string $a_schema_version, string $a_id): string
60  {
61  $qpl = new ilObjQuestionPool($a_id, false);
62  $qpl->loadFromDb();
63 
64  $qpl_exp = new ilQuestionpoolExport($qpl, 'xml');
65  $qpl_exp->buildExportFile();
66 
67  global $DIC; /* @var ILIAS\DI\Container $DIC */
68  $DIC['ilLog']->write(__METHOD__ . ': Created zip file');
69  return ''; // sagt mjansen
70  }
71 
79  public function getXmlExportTailDependencies(string $a_entity, string $a_target_release, array $a_ids): array
80  {
81  if ($a_entity == 'qpl') {
82  $deps = array();
83 
84  $taxIds = $this->getDependingTaxonomyIds($a_ids);
85 
86  if (count($taxIds)) {
87  $deps[] = array(
88  'component' => 'Services/Taxonomy',
89  'entity' => 'tax',
90  'ids' => $taxIds
91  );
92  }
93 
94  return $deps;
95  }
96 
97  return parent::getXmlExportTailDependencies($a_entity, $a_target_release, $a_ids);
98  }
99 
104  private function getDependingTaxonomyIds($poolObjIds): array
105  {
106  $taxIds = array();
107 
108  foreach ($poolObjIds as $poolObjId) {
109  foreach (ilObjTaxonomy::getUsageOfObject($poolObjId) as $taxId) {
110  $taxIds[$taxId] = $taxId;
111  }
112  }
113 
114  return $taxIds;
115  }
116 
123  public function getValidSchemaVersions(string $a_entity): array
124  {
125  return array(
126  "4.1.0" => array(
127  "namespace" => "http://www.ilias.de/Modules/TestQuestionPool/htlm/4_1",
128  "xsd_file" => "ilias_qpl_4_1.xsd",
129  "uses_dataset" => false,
130  "min" => "4.1.0",
131  "max" => "")
132  );
133  }
134 }
getValidSchemaVersions(string $a_entity)
Returns schema versions that the component can export to.
getXmlRepresentation(string $a_entity, string $a_schema_version, string $a_id)
Get xml representation.
static getUsageOfObject(int $a_obj_id, bool $a_include_titles=false)
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...
static getDataDir()
get data directory (outside webspace)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static lookupExportDirectory(string $a_obj_type, int $a_obj_id, string $a_export_type='xml', string $a_entity="")
Overwritten for qpl.
getXmlExportTailDependencies(string $a_entity, string $a_target_release, array $a_ids)
Get tail dependencies.