4 include_once(
"./Services/Export/classes/class.ilXmlImporter.php");
29 include_once
"./Modules/Test/classes/class.ilObjTest.php";
32 if ($new_id = $a_mapping->getMapping(
'Services/Container',
'objs', $a_id)) {
37 $questionParentObjId = $newObj->getId();
38 $newObj->setOnline(
true);
39 $questionParentObjId = $newObj->getId();
42 $new_id = $a_mapping->getMapping(
'Modules/Test',
'tst',
'new_id');
45 if (isset(
$_SESSION[
'tst_import_qst_parent'])) {
46 $questionParentObjId =
$_SESSION[
'tst_import_qst_parent'];
48 $questionParentObjId = $newObj->getId();
52 $newObj->loadFromDb();
56 if (!@file_exists($xml_file)) {
57 $GLOBALS[
'ilLog']->write(__METHOD__ .
': Cannot find xml definition: ' . $xml_file);
60 if (!@file_exists($qti_file)) {
61 $GLOBALS[
'ilLog']->write(__METHOD__ .
': Cannot find xml definition: ' . $qti_file);
70 $newObj->mark_schema->flush();
73 if (isset(
$_SESSION[
'tst_import_idents'])) {
80 include_once
"./Services/QTI/classes/class.ilQTIParser.php";
82 $qtiParser->setTestObject($newObj);
83 $result = $qtiParser->startParsing();
86 include_once(
"./Modules/LearningModule/classes/class.ilContObjParser.php");
88 $contParser->setQuestionMapping($qtiParser->getImportMapping());
89 $contParser->startParsing();
91 foreach ($qtiParser->getQuestionIdMapping() as $oldQuestionId => $newQuestionId) {
92 $a_mapping->addMapping(
95 "tst:quest:$oldQuestionId",
99 $a_mapping->addMapping(
102 "tst:quest:$oldQuestionId",
106 $a_mapping->addMapping(
114 if ($newObj->isRandomTest()) {
115 $newObj->questions =
array();
120 if (@file_exists(
$_SESSION[
"tst_import_results_file"])) {
121 include_once(
"./Modules/Test/classes/class.ilTestResultsImportParser.php");
123 $results->setQuestionIdMapping($a_mapping->getMappingsOfEntity(
'Modules/Test',
'quest'));
124 $results->setSrcPoolDefIdMapping($a_mapping->getMappingsOfEntity(
'Modules/Test',
'rnd_src_pool_def'));
135 $a_mapping->addMapping(
"Modules/Test",
"tst", $a_id, $newObj->getId());
148 $maps = $a_mapping->getMappingsOfEntity(
"Modules/Test",
"tst");
151 if (
$old ==
"new_id" || (
int)
$old <= 0) {
155 if (isset(self::$finallyProcessedTestsRegistry[
$new])) {
161 if ($testOBJ->isRandomTest()) {
165 self::$finallyProcessedTestsRegistry[
$new] =
true;
171 require_once
'Services/Taxonomy/classes/class.ilObjTaxonomy.php';
181 if ($new_tax_ids !==
false) {
182 $tax_ids = explode(
":", $new_tax_ids);
184 foreach ($tax_ids as $tid) {
193 require_once
'Modules/Test/classes/class.ilTestRandomQuestionSetSourcePoolDefinitionFactory.php';
199 require_once
'Modules/Test/classes/class.ilTestRandomQuestionSetSourcePoolDefinitionList.php';
206 $srcPoolDefList->loadDefinitions();
208 foreach ($srcPoolDefList as $definition) {
210 if (!is_array($definition->getMappedTaxonomyFilter()) || 0 === count($definition->getMappedTaxonomyFilter())) {
214 $definition->setMappedTaxonomyFilter(
217 $definition->getMappedTaxonomyFilter()
220 $definition->saveToDb();
231 $newMappedFilter =
array();
233 foreach ($mappedFilter as $taxId => $taxNodes) {
244 $newMappedFilter[$newTaxId] =
array();
246 foreach ($taxNodes as $taxNodeId) {
253 if (!$newTaxNodeId) {
257 $newMappedFilter[$newTaxId][] = $newTaxNodeId;
261 return $newMappedFilter;
275 $qti = $this->
getImportDirectory() .
'/' . preg_replace(
'/test|tst/',
'qti', $basename) .
'.xml';
283 $dir = dirname($dir);
290 $name = basename($dir);
296 require_once
'Modules/Test/classes/class.ilObjTestXMLParser.php';
299 $parser->setImportMapping($a_mapping);
311 require_once
'Modules/TestQuestionPool/classes/questions/class.ilAssQuestionSkillAssignmentXmlParser.php';
315 require_once
'Modules/TestQuestionPool/classes/questions/class.ilAssQuestionSkillAssignmentImporter.php';
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()) {
326 require_once
'Modules/TestQuestionPool/classes/questions/class.ilAssQuestionSkillAssignmentImportFails.php';
333 return $importer->getSuccessImportAssignmentList();
344 require_once
'Modules/Test/classes/class.ilTestSkillLevelThresholdXmlParser.php';
348 require_once
'Modules/Test/classes/class.ilTestSkillLevelThresholdImporter.php';
350 $importer->setTargetTestId($testOBJ->
getTestId());
351 $importer->setImportInstallationId($this->
getInstallId());
352 $importer->setImportMappingRegistry($mapping);
353 $importer->setImportedQuestionSkillAssignmentList($assignmentList);
354 $importer->setImportThresholdList(
$parser->getSkillLevelThresholdImportList());
357 if ($importer->getFailedThresholdImportSkillList()->skillsExist()) {
358 require_once
'Modules/Test/classes/class.ilTestSkillLevelThresholdImportFails.php';
getMapping($a_comp, $a_entity, $a_old_id)
Get a mapping.
setOnline($a_online=true)
registerFailedImports(ilAssQuestionAssignedSkillList $skillList)
getImportDirectory()
Get import directory.
getTestId()
Gets the database id of the additional test data.
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
getNewMappedTaxonomyFilter(ilImportMapping $mapping, array $mappedFilter)
getImportDirectoryContainer()
parseXmlFileNames()
Create qti and xml file name.
importQuestionSkillAssignments(ilImportMapping $mapping, ilObjTest $testOBJ, $xmlFile)
Importer class for files.
getId()
get object id public
finalRandomTestTaxonomyProcessing(ilImportMapping $mapping, $oldTstObjId, $newTstObjId, ilObjTest $testOBJ)
importXmlRepresentation($a_entity, $a_id, $a_xml, $a_mapping)
Import XML.
importRandomQuestionSetConfig(ilObjTest $testOBJ, $xmlFile, $a_mapping)
static getInstanceByObjId($a_obj_id, $stop_on_error=true)
get an instance of an Ilias object by object id
Create styles array
The data for the language used.
importSkillLevelThresholds(ilImportMapping $mapping, ilAssQuestionSkillAssignmentList $assignmentList, ilObjTest $testOBJ, $xmlFile)
finalProcessing($a_mapping)
Final processing.
Test results import parser.
static saveUsage($a_tax_id, $a_obj_id)
Save Usage.
getInstallId()
Get installation id.
static $finallyProcessedTestsRegistry
registerFailedImports(ilAssQuestionSkillAssignmentImportList $assignmentList)
static _setImportDirectory($a_import_dir=null)
set import directory