48 if ($new_id = $a_mapping->
getMapping(
'Services/Container',
'objs', $a_id)) {
53 $questionParentObjId = $newObj->getId();
56 $new_id = $a_mapping->
getMapping(
'Modules/Test',
'tst',
'new_id');
59 $questionParentObjId =
ilSession::get(
'tst_import_qst_parent') ?? $newObj->getId();
62 $newObj->loadFromDb();
67 if (!@file_exists($xml_file)) {
68 $DIC[
'ilLog']->write(__METHOD__ .
': Cannot find xml definition: ' . $xml_file);
71 if (!@file_exists($qti_file)) {
72 $DIC[
'ilLog']->write(__METHOD__ .
': Cannot find xml definition: ' . $qti_file);
81 $newObj->mark_schema->flush();
87 $qtiParser->setTestObject($newObj);
88 $qtiParser->startParsing();
89 $newObj = $qtiParser->getTestObject();
93 $questionPageParser->setQuestionMapping($qtiParser->getImportMapping());
94 $questionPageParser->startParsing();
98 if ($newObj->isRandomTest()) {
117 $a_mapping->
addMapping(
"Modules/Test",
"tst", $a_id, $newObj->getId());
122 foreach ($question_id_mapping as $oldQuestionId => $newQuestionId) {
126 "tst:quest:$oldQuestionId",
133 "tst:quest:$oldQuestionId",
157 foreach ($maps as $old => $new) {
158 if ($old ==
"new_id" || (
int) $old <= 0) {
162 if (isset(self::$finallyProcessedTestsRegistry[$new])) {
168 if ($testOBJ->isRandomTest()) {
172 self::$finallyProcessedTestsRegistry[$new] =
true;
184 if ($new_tax_ids !==
false) {
185 $tax_ids = explode(
":", $new_tax_ids);
187 foreach ($tax_ids as $tid) {
194 $ilDB = $DIC[
'ilDB'];
207 $srcPoolDefList->loadDefinitions();
209 foreach ($srcPoolDefList as $definition) {
211 if (!is_array($definition->getMappedTaxonomyFilter()) || 0 === count($definition->getMappedTaxonomyFilter())) {
215 $definition->setMappedTaxonomyFilter(
218 $definition->getMappedTaxonomyFilter()
221 $definition->saveToDb();
232 $newMappedFilter = array();
234 foreach ($mappedFilter as $taxId => $taxNodes) {
245 $newMappedFilter[$newTaxId] = array();
247 foreach ($taxNodes as $taxNodeId) {
254 if (!$newTaxNodeId) {
258 $newMappedFilter[$newTaxId][] = $newTaxNodeId;
262 return $newMappedFilter;
277 $qti = $this->
getImportDirectory() .
'/' . preg_replace(
'/test|tst/',
'qti', $basename) .
'.xml';
279 return array(
$xml,$qti);
285 $dir = dirname($dir);
292 $name = basename($dir);
298 $testOBJ->questions = [];
300 $parser->setTestOBJ($testOBJ);
301 $parser->setImportMapping($a_mapping);
302 $parser->startParsing();
314 $parser->startParsing();
317 $importer->setTargetParentObjId($testOBJ->
getId());
318 $importer->setImportInstallationId($this->
getInstallId());
319 $importer->setImportMappingRegistry($mapping);
320 $importer->setImportMappingComponent(
'Modules/Test');
321 $importer->setImportAssignmentList($parser->getAssignmentList());
325 if ($importer->getFailedImportAssignmentList()->assignmentsExist()) {
332 return $importer->getSuccessImportAssignmentList();
344 $parser->startParsing();
347 $importer->setTargetTestId($testOBJ->
getTestId());
348 $importer->setImportInstallationId($this->
getInstallId());
349 $importer->setImportMappingRegistry($mapping);
350 $importer->setImportedQuestionSkillAssignmentList($assignmentList);
351 $importer->setImportThresholdList($parser->getSkillLevelThresholdImportList());
354 if ($importer->getFailedThresholdImportSkillList()->skillsExist()) {
static get(string $a_var)
setOnline($a_online=true)
importXmlRepresentation(string $a_entity, string $a_id, string $a_xml, ilImportMapping $a_mapping)
Import XML.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
registerFailedImports(ilAssQuestionAssignedSkillList $skillList)
getTestId()
Gets the database id of the additional test data.
getNewMappedTaxonomyFilter(ilImportMapping $mapping, array $mappedFilter)
addMapping(string $a_comp, string $a_entity, string $a_old_id, string $a_new_id)
getImportDirectoryContainer()
parseXmlFileNames()
Create qti and xml file name.
importQuestionSkillAssignments(ilImportMapping $mapping, ilObjTest $testOBJ, $xmlFile)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
getMapping(string $a_comp, string $a_entity, string $a_old_id)
getMappingsOfEntity(string $a_comp, string $a_entity)
addTexonomyAndQuestionsMapping(array $question_id_mapping, int $new_obj_id, ilImportMapping $mapping)
finalRandomTestTaxonomyProcessing(ilImportMapping $mapping, $oldTstObjId, $newTstObjId, ilObjTest $testOBJ)
Legacy Content Object Parser.
importRandomQuestionSetConfig(ilObjTest $testOBJ, $xmlFile, $a_mapping)
setOfflineStatus(bool $status)
importSkillLevelThresholds(ilImportMapping $mapping, ilAssQuestionSkillAssignmentList $assignmentList, ilObjTest $testOBJ, $xmlFile)
static saveUsage(int $a_tax_id, int $a_obj_id)
static getInstanceByObjId(?int $obj_id, bool $stop_on_error=true)
get an instance of an Ilias object by object id
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
finalProcessing(ilImportMapping $a_mapping)
Final processing.
static $finallyProcessedTestsRegistry
registerFailedImports(ilAssQuestionSkillAssignmentImportList $assignmentList)
static set(string $a_var, $a_val)
Set a value.
static _setImportDirectory($a_import_dir=null)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...