ILIAS  release_8 Revision v8.24
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 include_once './Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php';
62 $qpl = new ilObjQuestionPool($a_id, false);
63 $qpl->loadFromDb();
64
65 include_once("./Modules/TestQuestionPool/classes/class.ilQuestionpoolExport.php");
66 $qpl_exp = new ilQuestionpoolExport($qpl, 'xml');
67 $qpl_exp->buildExportFile();
68
69 global $DIC; /* @var ILIAS\DI\Container $DIC */
70 $DIC['ilLog']->write(__METHOD__ . ': Created zip file');
71 return ''; // sagt mjansen
72 }
73
81 public function getXmlExportTailDependencies(string $a_entity, string $a_target_release, array $a_ids): array
82 {
83 if ($a_entity == 'qpl') {
84 $deps = array();
85
86 $taxIds = $this->getDependingTaxonomyIds($a_ids);
87
88 if (count($taxIds)) {
89 $deps[] = array(
90 'component' => 'Services/Taxonomy',
91 'entity' => 'tax',
92 'ids' => $taxIds
93 );
94 }
95
96 return $deps;
97 }
98
99 return parent::getXmlExportTailDependencies($a_entity, $a_target_release, $a_ids);
100 }
101
106 private function getDependingTaxonomyIds($poolObjIds): array
107 {
108 include_once 'Services/Taxonomy/classes/class.ilObjTaxonomy.php';
109
110 $taxIds = array();
111
112 foreach ($poolObjIds as $poolObjId) {
113 foreach (ilObjTaxonomy::getUsageOfObject($poolObjId) as $taxId) {
114 $taxIds[$taxId] = $taxId;
115 }
116 }
117
118 return $taxIds;
119 }
120
127 public function getValidSchemaVersions(string $a_entity): array
128 {
129 return array(
130 "4.1.0" => array(
131 "namespace" => "http://www.ilias.de/Modules/TestQuestionPool/htlm/4_1",
132 "xsd_file" => "ilias_qpl_4_1.xsd",
133 "uses_dataset" => false,
134 "min" => "4.1.0",
135 "max" => "")
136 );
137 }
138}
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.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
global $DIC
Definition: feed.php:28