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))
38 $questionParentObjId = $newObj->getId();
39 $newObj->setOnline(
true);
40 $questionParentObjId = $newObj->getId();
45 $new_id = $a_mapping->getMapping(
'Modules/Test',
'tst',
'new_id');
48 if( isset(
$_SESSION[
'tst_import_qst_parent']) )
50 $questionParentObjId =
$_SESSION[
'tst_import_qst_parent'];
54 $questionParentObjId = $newObj->getId();
58 $newObj->loadFromDb();
62 if(!@file_exists($xml_file))
64 $GLOBALS[
'ilLog']->write(__METHOD__.
': Cannot find xml definition: '. $xml_file);
67 if(!@file_exists($qti_file))
69 $GLOBALS[
'ilLog']->write(__METHOD__.
': Cannot find xml definition: '. $qti_file);
78 $newObj->mark_schema->flush();
81 if( isset(
$_SESSION[
'tst_import_idents']) )
91 include_once
"./Services/QTI/classes/class.ilQTIParser.php";
93 $qtiParser->setTestObject($newObj);
94 $result = $qtiParser->startParsing();
97 include_once (
"./Modules/LearningModule/classes/class.ilContObjParser.php");
99 $contParser->setQuestionMapping($qtiParser->getImportMapping());
100 $contParser->startParsing();
102 foreach($qtiParser->getQuestionIdMapping() as $oldQuestionId => $newQuestionId)
104 $a_mapping->addMapping(
105 "Services/Taxonomy",
"tax_item",
"tst:quest:$oldQuestionId", $newQuestionId
108 $a_mapping->addMapping(
109 "Services/Taxonomy",
"tax_item_obj_id",
"tst:quest:$oldQuestionId", $newObj->getId()
112 $a_mapping->addMapping(
113 "Modules/Test",
"quest", $oldQuestionId, $newQuestionId
117 if( $newObj->isRandomTest() )
119 $newObj->questions =
array();
124 if(@file_exists(
$_SESSION[
"tst_import_results_file"]))
126 include_once(
"./Modules/Test/classes/class.ilTestResultsImportParser.php");
128 $results->setQuestionIdMapping($a_mapping->getMappingsOfEntity(
'Modules/Test',
'quest'));
129 $results->setSrcPoolDefIdMapping($a_mapping->getMappingsOfEntity(
'Modules/Test',
'rnd_src_pool_def'));
140 $a_mapping->addMapping(
"Modules/Test",
"tst", $a_id, $newObj->getId());
153 $maps = $a_mapping->getMappingsOfEntity(
"Modules/Test",
"tst");
157 if (
$old ==
"new_id" || (
int)
$old <= 0)
162 if( isset(self::$finallyProcessedTestsRegistry[
$new]) )
169 if( $testOBJ->isRandomTest() )
174 self::$finallyProcessedTestsRegistry[
$new] =
true;
180 require_once
'Services/Taxonomy/classes/class.ilObjTaxonomy.php';
185 'Services/Taxonomy',
'tax_usage_of_obj', $oldTstObjId
188 if($new_tax_ids !==
false)
190 $tax_ids = explode(
":", $new_tax_ids);
192 foreach($tax_ids as $tid)
202 require_once
'Modules/Test/classes/class.ilTestRandomQuestionSetSourcePoolDefinitionFactory.php';
207 require_once
'Modules/Test/classes/class.ilTestRandomQuestionSetSourcePoolDefinitionList.php';
209 $ilDB, $testOBJ, $srcPoolDefFactory
212 $srcPoolDefList->loadDefinitions();
214 foreach($srcPoolDefList as $definition)
216 if( !$definition->getMappedFilterTaxId() && !$definition->getMappedFilterTaxNodeId() )
222 'Services/Taxonomy',
'tax', $definition->getMappedFilterTaxId()
225 $definition->setMappedFilterTaxId($newTaxId ? $newTaxId : null);
228 'Services/Taxonomy',
'tax_tree', $definition->getMappedFilterTaxNodeId()
231 $definition->setMappedFilterTaxNodeId($newTaxNodeId ? $newTaxNodeId : null);
233 $definition->saveToDb();
243 $GLOBALS[
'ilLog']->write(__METHOD__.
': '.$this->getImportDirectory());
248 $qti = $this->
getImportDirectory().
'/'.preg_replace(
'/test|tst/',
'qti', $basename).
'.xml';
250 return array($xml,$qti);
256 $dir = dirname($dir);
263 $name = basename($dir);
269 require_once
'Modules/Test/classes/class.ilObjTestXMLParser.php';
272 $parser->setImportMapping($a_mapping);
284 require_once
'Modules/TestQuestionPool/classes/questions/class.ilAssQuestionSkillAssignmentXmlParser.php';
288 require_once
'Modules/TestQuestionPool/classes/questions/class.ilAssQuestionSkillAssignmentImporter.php';
290 $importer->setTargetParentObjId($testOBJ->
getId());
291 $importer->setImportInstallationId($this->
getInstallId());
292 $importer->setImportMappingRegistry($mapping);
293 $importer->setImportMappingComponent(
'Modules/Test');
294 $importer->setImportAssignmentList(
$parser->getAssignmentList());
298 if( $importer->getFailedImportAssignmentList()->assignmentsExist() )
300 require_once
'Modules/TestQuestionPool/classes/questions/class.ilAssQuestionSkillAssignmentImportFails.php';
307 return $importer->getSuccessImportAssignmentList();
318 require_once
'Modules/Test/classes/class.ilTestSkillLevelThresholdXmlParser.php';
322 require_once
'Modules/Test/classes/class.ilTestSkillLevelThresholdImporter.php';
324 $importer->setTargetTestId($testOBJ->
getTestId());
325 $importer->setImportInstallationId($this->
getInstallId());
326 $importer->setImportMappingRegistry($mapping);
327 $importer->setImportedQuestionSkillAssignmentList($assignmentList);
328 $importer->setImportThresholdList(
$parser->getSkillLevelThresholdImportList());
331 if( $importer->getFailedThresholdImportSkillList()->skillsExist() )
333 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.
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