ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
class.ilSurveyExporter.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2010 ILIAS open source, Extended GPL, see docs/LICENSE */
3
4include_once("./Services/Export/classes/class.ilXmlExporter.php");
5
14{
18 private $ds;
19
23 public function init()
24 {
25 include_once("./Modules/Survey/classes/class.ilSurveyDataSet.php");
26 $this->ds = new ilSurveyDataSet();
27 $this->ds->setExportDirectories($this->dir_relative, $this->dir_absolute);
28 $this->ds->setDSPrefix("ds");
29 }
30
31
40 public function getXmlRepresentation($a_entity, $a_schema_version, $a_id)
41 {
42 if ($a_entity == "svy") {
43 include_once './Modules/Survey/classes/class.ilObjSurvey.php';
44 $svy = new ilObjSurvey($a_id, false);
45 $svy->loadFromDb();
46
47 include_once("./Modules/Survey/classes/class.ilSurveyExport.php");
48 $svy_exp = new ilSurveyExport($svy, 'xml');
49 $zip = $svy_exp->buildExportFile();
50
51 // Unzip, since survey deletes this dir
52 ilUtil::unzip($zip);
53
54 $GLOBALS['ilLog']->write(__METHOD__ . ': Created zip file ' . $zip);
55 return "";
56 } else {
57 return $this->ds->getXmlRepresentation($a_entity, $a_schema_version, $a_id, "", true, true);
58 }
59 }
60
69 public function getXmlExportTailDependencies($a_entity, $a_target_release, $a_ids)
70 {
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 );
82 }
83 return array();
84 }
85
93 public function getValidSchemaVersions($a_entity)
94 {
95 if ($a_entity == "svy") {
96 return array(
97 "4.1.0" => array(
98 "namespace" => "http://www.ilias.de/Modules/Survey/htlm/4_1",
99 "xsd_file" => "ilias_svy_4_1.xsd",
100 "uses_dataset" => false,
101 "min" => "4.1.0",
102 "max" => "")
103 );
104 } else {
105 return array(
106 "5.1.0" => array(
107 "namespace" => "http://www.ilias.de/Modules/Survey/svy/5_1",
108 "xsd_file" => "ilias_svy_5_1.xsd",
109 "uses_dataset" => true,
110 "min" => "5.1.0",
111 "max" => "")
112 );
113 }
114 }
115}
An exception for terminatinating execution or to throw for unit testing.
Survey Data set class.
Export class for surveys.
Used for container export with tests.
getXmlExportTailDependencies($a_entity, $a_target_release, $a_ids)
Get tail dependencies.
getValidSchemaVersions($a_entity)
Returns schema versions that the component can export to.
getXmlRepresentation($a_entity, $a_schema_version, $a_id)
Get xml representation.
static unzip($a_file, $overwrite=false, $a_flat=false)
unzip file
Xml Exporter class.
$GLOBALS['loaded']
Global hash that tracks already loaded includes.