ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
class.ilTestQuestionPoolExporter.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2013 ILIAS open source, Extended GPL, see docs/LICENSE */
3
4include_once("./Services/Export/classes/class.ilXmlExporter.php");
5
14{
15 private $ds;
16
20 function init()
21 {
22 }
23
30 public static function lookupExportDirectory($a_obj_type, $a_obj_id, $a_export_type = 'xml', $a_entity = "")
31 {
32 if($a_export_type == 'xml')
33 {
34 return ilUtil::getDataDir() . "/qpl_data" . "/qpl_" . $a_obj_id . "/export_zip";
35
36 }
37 return ilUtil::getDataDir()."/qpl_data"."/qpl_".$a_obj_id."/export_".$a_export_type;
38 }
39
40
49 public function getXmlRepresentation($a_entity, $a_schema_version, $a_id)
50 {
51 include_once './Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php';
52 $qpl = new ilObjQuestionPool($a_id,false);
53 $qpl->loadFromDb();
54
55 include_once("./Modules/TestQuestionPool/classes/class.ilQuestionpoolExport.php");
56 $qpl_exp = new ilQuestionpoolExport($qpl, 'xml');
57 $zip = $qpl_exp->buildExportFile();
58
59 $GLOBALS['ilLog']->write(__METHOD__.': Created zip file '.$zip);
60 }
61
70 public function getXmlExportTailDependencies($a_entity, $a_target_release, $a_ids)
71 {
72 if($a_entity == 'qpl')
73 {
74 $deps = array();
75
76 $taxIds = $this->getDependingTaxonomyIds($a_ids);
77
78 if(count($taxIds))
79 {
80 $deps[] = array(
81 'component' => 'Services/Taxonomy',
82 'entity' => 'tax',
83 'ids' => $taxIds
84 );
85 }
86
87 return $deps;
88 }
89
90 return parent::getXmlExportTailDependencies($a_entity, $a_target_release, $a_ids);
91 }
92
97 private function getDependingTaxonomyIds($poolObjIds)
98 {
99 include_once 'Services/Taxonomy/classes/class.ilObjTaxonomy.php';
100
101 $taxIds = array();
102
103 foreach($poolObjIds as $poolObjId)
104 {
105 foreach(ilObjTaxonomy::getUsageOfObject($poolObjId) as $taxId)
106 {
107 $taxIds[$taxId] = $taxId;
108 }
109 }
110
111 return $taxIds;
112 }
113
121 function getValidSchemaVersions($a_entity)
122 {
123 return array (
124 "4.1.0" => array(
125 "namespace" => "http://www.ilias.de/Modules/TestQuestionPool/htlm/4_1",
126 "xsd_file" => "ilias_qpl_4_1.xsd",
127 "uses_dataset" => false,
128 "min" => "4.1.0",
129 "max" => "")
130 );
131 }
132
133}
134
135?>
An exception for terminatinating execution or to throw for unit testing.
static getUsageOfObject($a_obj_id, $a_include_titles=false)
Get usage of object.
Export class for questionpools.
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 lookupExportDirectory($a_obj_type, $a_obj_id, $a_export_type='xml', $a_entity="")
Overwritten for qpl.
static getDataDir()
get data directory (outside webspace)
Xml Exporter class.
$GLOBALS['loaded']
Global hash that tracks already loaded includes.