ILIAS  release_7 Revision v7.30-3-g800a261c036
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 global $DIC; /* @var ILIAS\DI\Container $DIC */
44 $DIC['ilLog']->write(__METHOD__ . ': Created zip file ' . $zip);
45 }
46
55 public function getXmlExportTailDependencies($a_entity, $a_target_release, $a_ids)
56 {
57 if ($a_entity == 'tst') {
58 $deps = array();
59
60 $taxIds = $this->getDependingTaxonomyIds($a_ids);
61
62 if (count($taxIds)) {
63 $deps[] = array(
64 'component' => 'Services/Taxonomy',
65 'entity' => 'tax',
66 'ids' => $taxIds
67 );
68 }
69
70 // service settings
71 $deps[] = array(
72 "component" => "Services/Object",
73 "entity" => "common",
74 "ids" => $a_ids
75 );
76
77 return $deps;
78 }
79
80 return parent::getXmlExportTailDependencies($a_entity, $a_target_release, $a_ids);
81 }
82
87 private function getDependingTaxonomyIds($testObjIds)
88 {
89 include_once 'Services/Taxonomy/classes/class.ilObjTaxonomy.php';
90
91 $taxIds = array();
92
93 foreach ($testObjIds as $testObjId) {
94 foreach (ilObjTaxonomy::getUsageOfObject($testObjId) as $taxId) {
95 $taxIds[$taxId] = $taxId;
96 }
97 }
98
99 return $taxIds;
100 }
101
109 public function getValidSchemaVersions($a_entity)
110 {
111 return array(
112 "4.1.0" => array(
113 "namespace" => "http://www.ilias.de/Modules/Test/htlm/4_1",
114 "xsd_file" => "ilias_tst_4_1.xsd",
115 "uses_dataset" => false,
116 "min" => "4.1.0",
117 "max" => "")
118 );
119 }
120}
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.
global $DIC
Definition: goto.php:24