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
70 );
71 $selected_questions = [];
72 } else {
73
74 $new_id = (
int) $a_mapping->
getMapping(
'components/ILIAS/Test',
'tst',
'new_id');
76
77 $selected_questions =
ilSession::get(
'tst_import_selected_questions') ?? [];
80 );
83 }
84
85 $new_obj->loadFromDb();
86
87 if (!file_exists($xmlfile)) {
88 $this->
logger->error(__METHOD__ .
': Cannot find xml definition: ' . $xmlfile);
89 return;
90 }
91 if (!file_exists($qtifile)) {
92 $this->
logger->error(__METHOD__ .
': Cannot find xml definition: ' . $qtifile);
93 return;
94 }
95
96
98 $importdir,
99 $qtifile,
101 $new_obj->getId(),
102 $selected_questions,
104 );
105 $qti_parser->setTestObject($new_obj);
106 $qti_parser->startParsing();
107 $new_obj = $qti_parser->getTestObject();
108
109
111 $new_obj,
112 $xmlfile,
113 $importdir
114 );
115 $question_page_parser->setQuestionMapping($qti_parser->getImportMapping());
116 $question_page_parser->startParsing();
117
119
120 if ($new_obj->isRandomTest()) {
122 }
123
124 if ($results_file_path !== null && file_exists($results_file_path)) {
129 }
130
131 $new_obj->saveToDb();
132 $new_obj->update();
133
135 $a_mapping,
137 $new_obj,
138 $xmlfile
139 );
140
141 $a_mapping->
addMapping(
"components/ILIAS/Test",
"tst", (
string) $a_id, (
string) $new_obj->getId());
143 "components/ILIAS/MetaData",
144 "md",
145 $a_id . ":0:tst",
146 $new_obj->getId() . ":0:tst"
147 );
148 }
Legacy Content Object Parser.
static get(string $a_var)
static clear(string $a_var)
static set(string $a_var, $a_val)
Set a value.
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)