ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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 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 {
44 include_once './Modules/Survey/classes/class.ilObjSurvey.php';
45 $svy = new ilObjSurvey($a_id, false);
46 $svy->loadFromDb();
47
48 include_once("./Modules/Survey/classes/class.ilSurveyExport.php");
49 $svy_exp = new ilSurveyExport($svy, 'xml');
50 $zip = $svy_exp->buildExportFile();
51
52 // Unzip, since survey deletes this dir
53 ilUtil::unzip($zip);
54
55 $GLOBALS['ilLog']->write(__METHOD__ . ': Created zip file ' . $zip);
56 return "";
57 }
58 else
59 {
60 return $this->ds->getXmlRepresentation($a_entity, $a_schema_version, $a_id, "", true, true);
61 }
62 }
63
72 function getXmlExportTailDependencies($a_entity, $a_target_release, $a_ids)
73 {
74 if ($a_entity == "svy")
75 {
76 return array (
77 array(
78 "component" => "Modules/Survey",
79 "entity" => "svy_quest_skill",
80 "ids" => $a_ids),
81 array(
82 "component" => "Modules/Survey",
83 "entity" => "svy_skill_threshold",
84 "ids" => $a_ids)
85 );
86
87 }
88 return array();
89 }
90
98 function getValidSchemaVersions($a_entity)
99 {
100 if ($a_entity == "svy")
101 {
102 return array(
103 "4.1.0" => array(
104 "namespace" => "http://www.ilias.de/Modules/Survey/htlm/4_1",
105 "xsd_file" => "ilias_svy_4_1.xsd",
106 "uses_dataset" => false,
107 "min" => "4.1.0",
108 "max" => "")
109 );
110 }
111 else
112 {
113 return array(
114 "5.1.0" => array(
115 "namespace" => "http://www.ilias.de/Modules/Survey/svy/5_1",
116 "xsd_file" => "ilias_svy_5_1.xsd",
117 "uses_dataset" => true,
118 "min" => "5.1.0",
119 "max" => "")
120 );
121 }
122 }
123}
124
125?>
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.