ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
class.exQuestionPoolImporter.php
Go to the documentation of this file.
1<?php
2
3/* Copyright (c) 1998-2013 ILIAS open source, Extended GPL, see docs/LICENSE */
4
14{
21 public function importXmlRepresentation($a_entity, $a_id, $a_xml, $a_mapping)
22 {
30 }
31
38 public function finalProcessing($a_mapping)
39 {
40 global $DIC; /* @var ILIAS\DI\Container $DIC */
41
42 $maps = $a_mapping->getMappingsOfEntity("Modules/TestQuestionPool", "qpl");
43
44 foreach ($maps as $old => $new) {
45 if ($old != "new_id" && (int) $old > 0) {
46 $newQstIds = $a_mapping->getMapping("Services/AssessmentQuestion", "qst", $old);
47
48 if ($newQstIds !== false) {
49 $qstIds = explode(":", $newQstIds);
50 foreach ($qstIds as $qId) {
51 $qstInstance = $DIC->question()->getQuestionInstance($qId);
52 $qstInstance->setParentId($new);
53 $qstInstance->save();
54 }
55 }
56
57 $qstMappings = $a_mapping->getMappingsOfEntity('Services/AssessmentQuestion', 'qst');
58
59 foreach ($qstMappings as $oldQstId => $newQstId) {
60 // process all question ids within the consumer component database,
61 // look for the old qst id and map to the new qst id
62 }
63 }
64 }
65 }
66}
An exception for terminatinating execution or to throw for unit testing.
finalProcessing($a_mapping)
Final processing.
importXmlRepresentation($a_entity, $a_id, $a_xml, $a_mapping)
Xml importer class.
$DIC
Definition: xapitoken.php:46