ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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 public 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 $deps = array();
58
59 $taxIds = $this->getDependingTaxonomyIds($a_ids);
60
61 if (count($taxIds)) {
62 $deps[] = array(
63 'component' => 'Services/Taxonomy',
64 'entity' => 'tax',
65 'ids' => $taxIds
66 );
67 }
68
69 return $deps;
70 }
71
72 return parent::getXmlExportTailDependencies($a_entity, $a_target_release, $a_ids);
73 }
74
79 private function getDependingTaxonomyIds($testObjIds)
80 {
81 include_once 'Services/Taxonomy/classes/class.ilObjTaxonomy.php';
82
83 $taxIds = array();
84
85 foreach ($testObjIds as $testObjId) {
86 foreach (ilObjTaxonomy::getUsageOfObject($testObjId) as $taxId) {
87 $taxIds[$taxId] = $taxId;
88 }
89 }
90
91 return $taxIds;
92 }
93
101 public function getValidSchemaVersions($a_entity)
102 {
103 return array(
104 "4.1.0" => array(
105 "namespace" => "http://www.ilias.de/Modules/Test/htlm/4_1",
106 "xsd_file" => "ilias_tst_4_1.xsd",
107 "uses_dataset" => false,
108 "min" => "4.1.0",
109 "max" => "")
110 );
111 }
112}
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.