44 if (($new_id = $a_mapping->
getMapping(
'Services/Container',
'objs', $a_id)) !== null) {
46 $newObj->getObjectProperties()->storePropertyIsOnline($newObj->getObjectProperties()->getPropertyIsOnline()->withOffline());
49 } elseif (($new_id = $a_mapping->
getMapping(
'Modules/TestQuestionPool',
'qpl',
"new_id")) !== null) {
54 $DIC[
'ilLog']->write(__METHOD__ .
': non container and no tax mapping, perhaps old qpl export');
61 if (!@file_exists($xml_file)) {
62 $DIC[
'ilLog']->write(__METHOD__ .
': Cannot find xml definition: ' . $xml_file);
65 if (!@file_exists($qti_file)) {
66 $DIC[
'ilLog']->write(__METHOD__ .
': Cannot find qti definition: ' . $qti_file);
70 $this->poolOBJ = $newObj;
72 $newObj->fromXML($xml_file);
75 if (isset($_POST[
"qpl_new"]) && strlen($_POST[
"qpl_new"])) {
76 $newObj->setTitle($_POST[
"qpl_new"]);
87 $DIC[
'ilLog']->write(__METHOD__ .
': xml file: ' . $xml_file .
", qti file:" . $qti_file);
99 if (strlen($xml_file)) {
101 $questionPageParser->setQuestionMapping($qtiParser->getImportMapping());
102 $questionPageParser->startParsing();
104 foreach ($qtiParser->getImportMapping() as $k => $v) {
105 $oldQuestionId = substr($k, strpos($k,
'qst_') + strlen(
'qst_'));
106 $newQuestionId = $v[
'pool'];
111 "qpl:quest:$oldQuestionId",
118 "qpl:quest:$oldQuestionId",
123 "Modules/TestQuestionPool",
133 $a_mapping->
addMapping(
"Modules/TestQuestionPool",
"qpl", $a_id, $newObj->getId());
148 foreach ($maps as $old => $new) {
149 if ($old !=
"new_id" && (
int) $old > 0) {
151 $new_tax_ids = $a_mapping->
getMapping(
"Services/Taxonomy",
"tax_usage_of_obj", $old);
152 if ($new_tax_ids !== null) {
153 $tax_ids = explode(
":", $new_tax_ids);
154 foreach ($tax_ids as $tid) {
174 $qti = $this->
getImportDirectory() .
'/' . preg_replace(
'/qpl/',
'qti', $basename) .
'.xml';
176 return array($xml,$qti);
182 $dir = dirname($dir);
189 $name = basename($dir);
196 $parser->startParsing();
199 $importer->setTargetParentObjId($targetParentObjId);
200 $importer->setImportInstallationId($this->
getInstallId());
201 $importer->setImportMappingRegistry($mappingRegistry);
202 $importer->setImportMappingComponent(
'Modules/TestQuestionPool');
203 $importer->setImportAssignmentList($parser->getAssignmentList());
207 if ($importer->getFailedImportAssignmentList()->assignmentsExist()) {
209 $qsaImportFails->registerFailedImports($importer->getFailedImportAssignmentList());
211 $this->poolOBJ->getObjectProperties()->storePropertyIsOnline($this->poolOBJ->getObjectProperties()->getPropertyIsOnline()->withOffline());
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static get(string $a_var)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
importXmlRepresentation(string $a_entity, string $a_id, string $a_xml, ilImportMapping $a_mapping)
Import XML.
addMapping(string $a_comp, string $a_entity, string $a_old_id, string $a_new_id)
finalProcessing(ilImportMapping $a_mapping)
Final processing.
getMapping(string $a_comp, string $a_entity, string $a_old_id)
getMappingsOfEntity(string $a_comp, string $a_entity)
parseXmlFileNames()
Create qti and xml file name.
Legacy Content Object Parser.
static _setImportDirectory($a_import_dir=null)
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
getImportDirectoryContainer()
importQuestionSkillAssignments($xmlFile, ilImportMapping $mappingRegistry, $targetParentObjId)
static clear(string $a_var)
static set(string $a_var, $a_val)
Set a value.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...