ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
class.ilTestExporter.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
24
33 public function getXmlRepresentation($a_entity, $a_schema_version, $a_id)
34 {
35 include_once './Modules/Test/classes/class.ilObjTest.php';
36 $tst = new ilObjTest($a_id,false);
37
38 require_once 'Modules/Test/classes/class.ilTestExportFactory.php';
39 $expFactory = new ilTestExportFactory($tst);
40 $testExport = $expFactory->getExporter('xml');
41 $zip = $testExport->buildExportFile();
42
43 $GLOBALS['ilLog']->write(__METHOD__.': Created zip file '.$zip);
44 }
45
54 public function getXmlExportTailDependencies($a_entity, $a_target_release, $a_ids)
55 {
56 if($a_entity == 'tst')
57 {
58 $deps = array();
59
60 $taxIds = $this->getDependingTaxonomyIds($a_ids);
61
62 if(count($taxIds))
63 {
64 $deps[] = array(
65 'component' => 'Services/Taxonomy',
66 'entity' => 'tax',
67 'ids' => $taxIds
68 );
69 }
70
71 return $deps;
72 }
73
74 return parent::getXmlExportTailDependencies($a_entity, $a_target_release, $a_ids);
75 }
76
81 private function getDependingTaxonomyIds($testObjIds)
82 {
83 include_once 'Services/Taxonomy/classes/class.ilObjTaxonomy.php';
84
85 $taxIds = array();
86
87 foreach($testObjIds as $testObjId)
88 {
89 foreach(ilObjTaxonomy::getUsageOfObject($testObjId) as $taxId)
90 {
91 $taxIds[$taxId] = $taxId;
92 }
93 }
94
95 return $taxIds;
96 }
97
105 function getValidSchemaVersions($a_entity)
106 {
107 return array (
108 "4.1.0" => array(
109 "namespace" => "http://www.ilias.de/Modules/Test/htlm/4_1",
110 "xsd_file" => "ilias_tst_4_1.xsd",
111 "uses_dataset" => false,
112 "min" => "4.1.0",
113 "max" => "")
114 );
115 }
116
117}
118
119?>
An exception for terminatinating execution or to throw for unit testing.
static getUsageOfObject($a_obj_id, $a_include_titles=false)
Get usage of object.
Used for container export with tests.
getDependingTaxonomyIds($testObjIds)
getXmlRepresentation($a_entity, $a_schema_version, $a_id)
Get xml representation.
getValidSchemaVersions($a_entity)
Returns schema versions that the component can export to.
init()
Initialisation.
getXmlExportTailDependencies($a_entity, $a_target_release, $a_ids)
Get tail dependencies.
Xml Exporter class.
$GLOBALS['loaded']
Global hash that tracks already loaded includes.