ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
ilTestExporter Class Reference

Used for container export with tests. More...

+ Inheritance diagram for ilTestExporter:
+ Collaboration diagram for ilTestExporter:

Public Member Functions

 __construct ()
 
 init ()
 Initialisation. More...
 
 getXmlRepresentation (string $a_entity, string $a_schema_version, string $id)
 
 getXmlExportHeadDependencies (string $entity, string $target_release, array $ids)
 
 getXmlExportTailDependencies (string $a_entity, string $a_target_release, array $a_ids)
 
 getValidSchemaVersions (string $a_entity)
 Returns schema versions that the component can export to. More...
 
- Public Member Functions inherited from ilXmlExporter
 __construct ()
 
 setExport (ilExport $a_exp)
 
 getExport ()
 
 getXmlRepresentation (string $a_entity, string $a_schema_version, string $a_id)
 
 init ()
 
 setExportDirectories (string $a_dir_relative, string $a_dir_absolute)
 
 getRelativeExportDirectory ()
 
 getAbsoluteExportDirectory ()
 
 getXmlExportHeadDependencies (string $a_entity, string $a_target_release, array $a_ids)
 Get head dependencies. More...
 
 getXmlExportTailDependencies (string $a_entity, string $a_target_release, array $a_ids)
 Get tail dependencies. More...
 
 getValidSchemaVersions (string $a_entity)
 Returns schema versions that the component can export to. More...
 
 determineSchemaVersion (string $a_entity, string $a_target_release)
 

Private Member Functions

 getDependingTaxonomyIds (array $test_obj_ids)
 

Private Attributes

ilLanguage $lng
 
ilLogger $log
 
ilTree $tree
 
ilCtrl $ctrl
 
ilComponentRepository $component_repository
 
QuestionInfoService $questioninfo
 

Additional Inherited Members

- Static Public Member Functions inherited from ilXmlExporter
static lookupExportDirectory (string $a_obj_type, int $a_obj_id, string $a_export_type='xml', string $a_entity="")
 
- Protected Attributes inherited from ilXmlExporter
string $dir_relative = ""
 
string $dir_absolute = ""
 
ilExport $exp
 

Detailed Description

Used for container export with tests.

Author
Stefan Meyer meyer.nosp@m.@lei.nosp@m.fos.c.nosp@m.om
Version
$Id$

Definition at line 30 of file class.ilTestExporter.php.

Constructor & Destructor Documentation

◆ __construct()

ilTestExporter::__construct ( )

Definition at line 39 of file class.ilTestExporter.php.

References $DIC, ILIAS\MetaData\Repository\Validation\Data\__construct(), ILIAS\Repository\ctrl(), and ILIAS\Repository\lng().

40  {
41  global $DIC;
42  $this->lng = $DIC['lng'];
43  $this->log = $DIC['ilLog'];
44  $this->tree = $DIC['tree'];
45  $this->ctrl = $DIC['ilCtrl'];
46  $this->component_repository = $DIC['component.repository'];
47  $this->questioninfo = $DIC->testQuestionPool()->questionInfo();
48 
50  }
global $DIC
Definition: feed.php:28
__construct(VocabulariesInterface $vocabularies)
+ Here is the call graph for this function:

Member Function Documentation

◆ getDependingTaxonomyIds()

ilTestExporter::getDependingTaxonomyIds ( array  $test_obj_ids)
private
Parameters
array<int>$testObjIds
Returns
array<int> $taxIds

Definition at line 157 of file class.ilTestExporter.php.

References ilObjTaxonomy\getUsageOfObject().

Referenced by getXmlExportTailDependencies().

157  : array
158  {
159  $tax_ids = [];
160 
161  foreach ($test_obj_ids as $test_obj_id) {
162  foreach (ilObjTaxonomy::getUsageOfObject($test_obj_id) as $tax_id) {
163  $tax_ids[$tax_id] = $tax_id;
164  }
165  }
166 
167  return $tax_ids;
168  }
static getUsageOfObject(int $a_obj_id, bool $a_include_titles=false)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getValidSchemaVersions()

ilTestExporter::getValidSchemaVersions ( string  $a_entity)

Returns schema versions that the component can export to.

ILIAS chooses the first one, that has min/max constraints which fit to the target release. Please put the newest on top.

Parameters
string$a_entity
Returns
array

Definition at line 177 of file class.ilTestExporter.php.

177  : array
178  {
179  return [
180  '4.1.0' => [
181  'namespace' => 'http://www.ilias.de/Modules/Test/htlm/4_1',
182  'xsd_file' => 'ilias_tst_4_1.xsd',
183  'uses_dataset' => false,
184  'min' => '4.1.0',
185  'max' => ''
186  ]
187  ];
188  }

◆ getXmlExportHeadDependencies()

ilTestExporter::getXmlExportHeadDependencies ( string  $entity,
string  $target_release,
array  $ids 
)

Definition at line 84 of file class.ilTestExporter.php.

References $id, and ilObjMediaObject\_getMobsOfObject().

84  : array
85  {
86  if ($entity === 'tst') {
87  $mobs = [];
88  $files = [];
89  foreach ($ids as $id) {
90  $tst = new ilObjTest((int) $id, false);
91  $tst->read();
92  $intro_page_id = $tst->getMainSettings()->getIntroductionSettings()->getIntroductionPageId();
93  if ($intro_page_id !== null) {
94  $mobs = array_merge($mobs, ilObjMediaObject::_getMobsOfObject('tst:pg', $intro_page_id));
95  $files = array_merge($files, ilObjFile::_getFilesOfObject('tst:pg', $intro_page_id));
96  }
97 
98  $concluding_remarks_page_id = $tst->getMainSettings()->getFinishingSettings()->getConcludingRemarksPageId();
99  if ($concluding_remarks_page_id !== null) {
100  $mobs = array_merge($mobs, ilObjMediaObject::_getMobsOfObject('tst:pg', $concluding_remarks_page_id));
101  $files = array_merge($files, ilObjFile::_getFilesOfObject('tst:pg', $concluding_remarks_page_id));
102  }
103  }
104 
105  return [
106  [
107  'component' => 'Services/MediaObjects',
108  'entity' => 'mob',
109  'ids' => $mobs
110  ],
111  [
112  'component' => 'Modules/File',
113  'entity' => 'file',
114  'ids' => $files
115  ]
116  ];
117  }
118 
119  return parent::getXmlExportTailDependencies($entity, $target_release, $ids);
120  }
static _getMobsOfObject(string $a_type, int $a_id, int $a_usage_hist_nr=0, string $a_lang="-")
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
+ Here is the call graph for this function:

◆ getXmlExportTailDependencies()

ilTestExporter::getXmlExportTailDependencies ( string  $a_entity,
string  $a_target_release,
array  $a_ids 
)
Parameters
array<int>ids
Returns
array<array> array of array with keys 'component', 'entity', 'ids'

Definition at line 126 of file class.ilTestExporter.php.

References getDependingTaxonomyIds().

126  : array
127  {
128  if ($a_entity == 'tst') {
129  $deps = [];
130 
131  $tax_ids = $this->getDependingTaxonomyIds($a_ids);
132 
133  if (count($tax_ids)) {
134  $deps[] = [
135  'component' => 'Services/Taxonomy',
136  'entity' => 'tax',
137  'ids' => $tax_ids
138  ];
139  }
140 
141  $deps[] = [
142  'component' => 'Services/Object',
143  'entity' => 'common',
144  'ids' => $a_ids
145  ];
146 
147  return $deps;
148  }
149 
150  return parent::getXmlExportTailDependencies($a_entity, $a_target_release, $a_ids);
151  }
getDependingTaxonomyIds(array $test_obj_ids)
+ Here is the call graph for this function:

◆ getXmlRepresentation()

ilTestExporter::getXmlRepresentation ( string  $a_entity,
string  $a_schema_version,
string  $id 
)

Definition at line 59 of file class.ilTestExporter.php.

References ILIAS\Repository\ctrl(), and ILIAS\Repository\lng().

59  : string
60  {
61  $tst = new ilObjTest((int) $id, false);
62  $tst->read();
63  $test_export_factory = new ilTestExportFactory(
64  $tst,
65  $this->lng,
66  $this->log,
67  $this->tree,
68  $this->component_repository,
69  $this->questioninfo
70  );
71  $test_export = $test_export_factory->getExporter('xml');
72 
73  $parameters = $this->ctrl->getParameterArrayByClass(ilTestExportGUI::class);
74  if (!empty($parameters['export_results'])) {
75  $test_export->setResultExportingEnabledForTestExport(true);
76  $this->ctrl->clearParameterByClass(ilTestExportGUI::class, 'export_results');
77  }
78  $zip = $test_export->buildExportFile();
79 
80  $this->log->write(__METHOD__ . ': Created zip file ' . $zip);
81  return ''; // Sagt mjansen
82  }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
+ Here is the call graph for this function:

◆ init()

ilTestExporter::init ( )

Initialisation.

Definition at line 55 of file class.ilTestExporter.php.

55  : void
56  {
57  }

Field Documentation

◆ $component_repository

ilComponentRepository ilTestExporter::$component_repository
private

Definition at line 36 of file class.ilTestExporter.php.

◆ $ctrl

ilCtrl ilTestExporter::$ctrl
private

Definition at line 35 of file class.ilTestExporter.php.

◆ $lng

ilLanguage ilTestExporter::$lng
private

Definition at line 32 of file class.ilTestExporter.php.

◆ $log

ilLogger ilTestExporter::$log
private

Definition at line 33 of file class.ilTestExporter.php.

◆ $questioninfo

QuestionInfoService ilTestExporter::$questioninfo
private

Definition at line 37 of file class.ilTestExporter.php.

◆ $tree

ilTree ilTestExporter::$tree
private

Definition at line 34 of file class.ilTestExporter.php.


The documentation for this class was generated from the following file: