ILIAS  release_8 Revision v8.24
class.ilSurveyExporter.php
Go to the documentation of this file.
1<?php
2
25{
27
28 public function init(): void
29 {
30 $this->ds = new ilSurveyDataSet();
31 $this->ds->setExportDirectories($this->dir_relative, $this->dir_absolute);
32 $this->ds->setDSPrefix("ds");
33 }
34
35 public function getXmlRepresentation(
36 string $a_entity,
37 string $a_schema_version,
38 string $a_id
39 ): string {
40 if ($a_entity === "svy") {
41 $svy = new ilObjSurvey($a_id, false);
42 $svy->loadFromDb();
43
44 $svy_exp = new ilSurveyExport($svy, 'xml');
45 $zip = $svy_exp->buildExportFile();
46
47 // Unzip, since survey deletes this dir
49
50 // unzip does not extract the included directory
51 // Modules/Survey/set_1 anymore (since 7/2023)
52 $missing = $svy_exp->export_dir . "/" . $svy_exp->subdir .
53 "/Modules/Survey/set_1";
55
56 // here: svy_data/svy_301/export/1698817474__0__svy_301
57 // svy_301/export/1698817474__0__svy_301/Modules/Survey/set_1
58 // svy_data/svy_301/export/1698817474__0__svy_301.zip
59 $GLOBALS['ilLog']->write(__METHOD__ . ': Created zip file ' . $zip);
60 return "";
61 } else {
62 return $this->ds->getXmlRepresentation($a_entity, $a_schema_version, [$a_id], "", true, true);
63 }
64 }
65
67 string $a_entity,
68 string $a_target_release,
69 array $a_ids
70 ): array {
71 if ($a_entity === "svy") {
72 return array(
73 array(
74 "component" => "Modules/Survey",
75 "entity" => "svy_quest_skill",
76 "ids" => $a_ids),
77 array(
78 "component" => "Modules/Survey",
79 "entity" => "svy_skill_threshold",
80 "ids" => $a_ids),
81 array(
82 "component" => "Services/Object",
83 "entity" => "common",
84 "ids" => $a_ids)
85 );
86 }
87 return array();
88 }
89
90 public function getValidSchemaVersions(
91 string $a_entity
92 ): array {
93 if ($a_entity === "svy") {
94 return array(
95 "4.1.0" => array(
96 "namespace" => "https://www.ilias.de/Modules/Survey/htlm/4_1",
97 "xsd_file" => "ilias_svy_4_1.xsd",
98 "uses_dataset" => false,
99 "min" => "4.1.0",
100 "max" => "")
101 );
102 } else {
103 return array(
104 "5.1.0" => array(
105 "namespace" => "https://www.ilias.de/Modules/Survey/svy/5_1",
106 "xsd_file" => "ilias_svy_5_1.xsd",
107 "uses_dataset" => true,
108 "min" => "5.1.0",
109 "max" => "")
110 );
111 }
112 }
113}
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64
static makeDirParents(string $a_dir)
Create a new directory and all parent directories.
static unzip(string $path_to_zip_file, bool $overwrite_existing=false, bool $unpack_flat=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...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
getValidSchemaVersions(string $a_entity)
Returns schema versions that the component can export to.
getXmlRepresentation(string $a_entity, string $a_schema_version, string $a_id)
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...
if(!file_exists(getcwd() . '/ilias.ini.php'))
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Definition: confirmReg.php:20