ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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 
4 include_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  array(
82  "component" => "Services/Object",
83  "entity" => "common",
84  "ids" => $a_ids)
85  );
86  }
87  return array();
88  }
89 
97  public function getValidSchemaVersions($a_entity)
98  {
99  if ($a_entity == "svy") {
100  return array(
101  "4.1.0" => array(
102  "namespace" => "http://www.ilias.de/Modules/Survey/htlm/4_1",
103  "xsd_file" => "ilias_svy_4_1.xsd",
104  "uses_dataset" => false,
105  "min" => "4.1.0",
106  "max" => "")
107  );
108  } else {
109  return array(
110  "5.1.0" => array(
111  "namespace" => "http://www.ilias.de/Modules/Survey/svy/5_1",
112  "xsd_file" => "ilias_svy_5_1.xsd",
113  "uses_dataset" => true,
114  "min" => "5.1.0",
115  "max" => "")
116  );
117  }
118  }
119 }
init()
Initialisation.
static unzip($a_file, $overwrite=false, $a_flat=false)
unzip file
getXmlExportTailDependencies($a_entity, $a_target_release, $a_ids)
Get tail dependencies.
Used for container export with tests.
Xml Exporter class.
Export class for surveys.
Survey Data set class.
getValidSchemaVersions($a_entity)
Returns schema versions that the component can export to.
getXmlRepresentation($a_entity, $a_schema_version, $a_id)
Get xml representation.
$GLOBALS['JPEG_Segment_Names']
Global Variable: XMP_tag_captions.