ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
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 = [];
83
84 $taxIds = $this->getDependingTaxonomyIds($a_ids);
85
86 if (count($taxIds)) {
87 $deps[] = [
88 'component' => 'components/ILIAS/Taxonomy',
89 'entity' => 'tax',
90 'ids' => $taxIds
91 ];
92 }
93
94 $md_ids = [];
95 foreach ($a_ids as $id) {
96 $md_ids[] = $id . ':0:qpl';
97 }
98 if ($md_ids !== []) {
99 $deps[] = [
100 'component' => 'components/ILIAS/MetaData',
101 'entity' => 'md',
102 'ids' => $md_ids
103 ];
104 }
105
106 return $deps;
107 }
108
109 return parent::getXmlExportTailDependencies($a_entity, $a_target_release, $a_ids);
110 }
111
116 private function getDependingTaxonomyIds($poolObjIds): array
117 {
118 $taxIds = [];
119
120 foreach ($poolObjIds as $poolObjId) {
121 foreach (ilObjTaxonomy::getUsageOfObject($poolObjId) as $taxId) {
122 $taxIds[$taxId] = $taxId;
123 }
124 }
125
126 return $taxIds;
127 }
128
135 public function getValidSchemaVersions(string $a_entity): array
136 {
137 return [
138 "4.1.0" => [
139 "namespace" => "http://www.ilias.de/Modules/TestQuestionPool/htlm/4_1",
140 "xsd_file" => "ilias_qpl_4_1.xsd",
141 "uses_dataset" => false,
142 "min" => "4.1.0",
143 "max" => ""]
144 ];
145 }
146}
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
static getDataDir()
get data directory (outside webspace)
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...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
getXmlRepresentation(string $a_entity, string $a_schema_version, string $a_id)
Get xml representation.
getValidSchemaVersions(string $a_entity)
Returns schema versions that the component can export to.
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.
Xml Exporter class.
global $DIC
Definition: shib_login.php:26