60 : void {
61 $results_file_path = null;
62 if ($new_id = (
int) $a_mapping->
getMapping(
'components/ILIAS/Container',
'objs', $a_id)) {
63
65 $new_obj->saveToDb();
66
69 );
70 $selected_questions = [];
71 } else {
72
73 $new_id = (
int) $a_mapping->
getMapping(
'components/ILIAS/Test',
'tst',
'new_id');
75
76 $selected_questions =
ilSession::get(
'tst_import_selected_questions') ?? [];
79 );
82 }
83
84 $new_obj->loadFromDb();
85
86 if (!file_exists($xmlfile)) {
87 $this->
logger->error(__METHOD__ .
': Cannot find xml definition: ' . $xmlfile);
88 return;
89 }
90 if (!file_exists($qtifile)) {
91 $this->
logger->error(__METHOD__ .
': Cannot find xml definition: ' . $qtifile);
92 return;
93 }
94
95
97 $importdir,
98 $qtifile,
100 $new_obj->getId(),
101 $selected_questions,
103 );
104 $qti_parser->setTestObject($new_obj);
105 $qti_parser->startParsing();
106 $new_obj = $qti_parser->getTestObject();
107
108
110 $new_obj,
111 $xmlfile,
112 $importdir
113 );
114 $question_page_parser->setQuestionMapping($qti_parser->getImportMapping());
115 $question_page_parser->startParsing();
116
118
119 if ($new_obj->isRandomTest()) {
121 }
122
123 if ($results_file_path !== null && file_exists($results_file_path)) {
128 }
129
130 $new_obj->saveToDb();
131 $new_obj->update();
132
134 $a_mapping,
136 $new_obj,
137 $xmlfile
138 );
139
140 $a_mapping->
addMapping(
"components/ILIAS/Test",
"tst", (
string) $a_id, (
string) $new_obj->getId());
142 "components/ILIAS/MetaData",
143 "md",
144 $a_id . ":0:tst",
145 $new_obj->getId() . ":0:tst"
146 );
147 }
Legacy Content Object Parser.
static get(string $a_var)
static clear(string $a_var)
importQuestionSkillAssignments(ilImportMapping $mapping, ilObjTest $test_obj, ?string $xml_file)
importSkillLevelThresholds(ilImportMapping $mapping, ilAssQuestionSkillAssignmentList $assignment_list, ilObjTest $test_obj, ?string $xml_file)
addTaxonomyAndQuestionsMapping(array $question_id_mapping, int $new_obj_id, ilImportMapping $mapping)
importRandomQuestionSetConfig(ilObjTest $test_obj, ?string $xml_file, \ilImportMapping $a_mapping)
buildImportDirectoriesFromContainerImport(string $importdir)
buildImportDirectoriesFromImportFile(string $file_to_import)
buildResultsFilePath(string $importdir, string $subdir)