ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
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
54 include_once("./Modules/TestQuestionPool/classes/class.ilQuestionpoolExport.php");
55 $qpl_exp = new ilQuestionpoolExport($qpl, 'xml');
56 $zip = $qpl_exp->buildExportFile();
57
58 $GLOBALS['ilLog']->write(__METHOD__.': Created zip file '.$zip);
59 }
60
69 public function getXmlExportTailDependencies($a_entity, $a_target_release, $a_ids)
70 {
71 if($a_entity == 'qpl')
72 {
73 $deps = array();
74
75 $taxIds = $this->getDependingTaxonomyIds($a_ids);
76
77 if(count($taxIds))
78 {
79 $deps[] = array(
80 'component' => 'Services/Taxonomy',
81 'entity' => 'tax',
82 'ids' => $taxIds
83 );
84 }
85
86 return $deps;
87 }
88
89 return parent::getXmlExportTailDependencies($a_entity, $a_target_release, $a_ids);
90 }
91
96 private function getDependingTaxonomyIds($poolObjIds)
97 {
98 include_once 'Services/Taxonomy/classes/class.ilObjTaxonomy.php';
99
100 $taxIds = array();
101
102 foreach($poolObjIds as $poolObjId)
103 {
104 foreach(ilObjTaxonomy::getUsageOfObject($poolObjId) as $taxId)
105 {
106 $taxIds[$taxId] = $taxId;
107 }
108 }
109
110 return $taxIds;
111 }
112
120 function getValidSchemaVersions($a_entity)
121 {
122 return array (
123 "4.1.0" => array(
124 "namespace" => "http://www.ilias.de/Modules/TestQuestionPool/htlm/4_1",
125 "xsd_file" => "ilias_qpl_4_1.xsd",
126 "uses_dataset" => false,
127 "min" => "4.1.0",
128 "max" => "")
129 );
130 }
131
132}
133
134?>
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['PHPCAS_CLIENT']
This global variable is used by the interface class phpCAS.
Definition: CAS.php:276