diff --git a/components/ILIAS/Test/classes/class.ilObjTest.php b/components/ILIAS/Test/classes/class.ilObjTest.php index bc99bf17b0f9..4925654caf57 100755 --- a/components/ILIAS/Test/classes/class.ilObjTest.php +++ b/components/ILIAS/Test/classes/class.ilObjTest.php @@ -3962,9 +3962,6 @@ public function exportPagesXML(&$a_xml_writer, $a_inst, $a_target_dir, &$expLog) { $this->mob_ids = []; - // MetaData - $this->exportXMLMetaData($a_xml_writer); - // PageObjects $expLog->write(date("[y-m-d H:i:s] ") . "Start Export Page Objects"); $this->bench->start("ContentObjectExport", "exportPageObjects"); @@ -3987,20 +3984,6 @@ public function exportPagesXML(&$a_xml_writer, $a_inst, $a_target_dir, &$expLog) $expLog->write(date("[y-m-d H:i:s] ") . "Finished Export File Items"); } - /** - * export content objects meta data to xml (see ilias_co.dtd) - * - * @param object $a_xml_writer ilXmlWriter object that receives the - * xml data - */ - public function exportXMLMetaData(&$a_xml_writer) - { - $md2xml = new ilMD2XML($this->getId(), 0, $this->getType()); - $md2xml->setExportMode(true); - $md2xml->startExport(); - $a_xml_writer->appendXML($md2xml->getXML()); - } - /** * Returns the installation id for a given identifier * diff --git a/components/ILIAS/Test/classes/class.ilTestExporter.php b/components/ILIAS/Test/classes/class.ilTestExporter.php index 29b2b93d6584..56bb4247dde5 100755 --- a/components/ILIAS/Test/classes/class.ilTestExporter.php +++ b/components/ILIAS/Test/classes/class.ilTestExporter.php @@ -97,6 +97,19 @@ public function getXmlExportTailDependencies(string $a_entity, string $a_target_ 'ids' => $a_ids ]; + + $md_ids = []; + foreach ($a_ids as $id) { + $md_ids[] = $id . ':0:tst'; + } + if ($md_ids !== []) { + $deps[] = [ + 'component' => 'components/ILIAS/MetaData', + 'entity' => 'md', + 'ids' => $md_ids + ]; + } + return $deps; } diff --git a/components/ILIAS/Test/classes/class.ilTestImporter.php b/components/ILIAS/Test/classes/class.ilTestImporter.php index b78e06c4997d..3954344cb106 100755 --- a/components/ILIAS/Test/classes/class.ilTestImporter.php +++ b/components/ILIAS/Test/classes/class.ilTestImporter.php @@ -131,6 +131,12 @@ public function importXmlRepresentation( $this->importSkillLevelThresholds($a_mapping, $importedAssignmentList, $new_obj, $xmlfile); $a_mapping->addMapping("components/ILIAS/Test", "tst", (string) $a_id, (string) $new_obj->getId()); + $a_mapping->addMapping( + "components/ILIAS/MetaData", + "md", + $a_id . ":0:tst", + $new_obj->getId() . ":0:tst" + ); } public function addTexonomyAndQuestionsMapping( diff --git a/components/ILIAS/TestQuestionPool/classes/class.ilObjQuestionPool.php b/components/ILIAS/TestQuestionPool/classes/class.ilObjQuestionPool.php index eab8fc8c57a0..b844f77eb8a0 100755 --- a/components/ILIAS/TestQuestionPool/classes/class.ilObjQuestionPool.php +++ b/components/ILIAS/TestQuestionPool/classes/class.ilObjQuestionPool.php @@ -52,7 +52,7 @@ public function __construct(int $a_id = 0, bool $a_call_by_reference = true) $this->type = 'qpl'; - parent::__construct($a_id, $a_call_by_reference); + parent::__construct((int) $a_id, $a_call_by_reference); $this->skill_service_enabled = false; } @@ -345,7 +345,7 @@ public function objectToXmlWriter(ilXmlWriter &$a_xml_writer, $a_inst, $a_target $a_xml_writer->xmlStartTag('ContentObject', $attrs); // MetaData - $this->exportXMLMetaData($a_xml_writer); + $this->exportTitleAndDescription($a_xml_writer); // Settings $this->exportXMLSettings($a_xml_writer); @@ -395,18 +395,10 @@ protected function populateQuestionSkillAssignmentsXml(ilXmlWriter &$a_xml_write $skillQuestionAssignmentExporter->export(); } - /** - * export content objects meta data to xml (see ilias_co.dtd) - * - * @param object $a_xml_writer ilXmlWriter object that receives the - * xml data - */ - public function exportXMLMetaData(&$a_xml_writer): void + public function exportTitleAndDescription(ilXmlWriter &$a_xml_writer): void { - $md2xml = new ilMD2XML($this->getId(), 0, $this->getType()); - $md2xml->setExportMode(true); - $md2xml->startExport(); - $a_xml_writer->appendXML($md2xml->getXML()); + $a_xml_writer->xmlElement('Title', null, $this->getTitle()); + $a_xml_writer->xmlElement('Description', null, $this->getDescription()); } public function modifyExportIdentifier($a_tag, $a_param, $a_value) diff --git a/components/ILIAS/TestQuestionPool/classes/class.ilObjQuestionPoolXMLParser.php b/components/ILIAS/TestQuestionPool/classes/class.ilObjQuestionPoolXMLParser.php index 33acff3f9eda..6b51f5b3783d 100755 --- a/components/ILIAS/TestQuestionPool/classes/class.ilObjQuestionPoolXMLParser.php +++ b/components/ILIAS/TestQuestionPool/classes/class.ilObjQuestionPoolXMLParser.php @@ -1,4 +1,5 @@ inMetaDataTag && $this->inMdGeneralTag) { - $this->cdata = ''; - } - break; - case 'Description': - if ($this->inMetaDataTag && $this->inMdGeneralTag) { - $this->cdata = ''; - } + $this->cdata = ''; break; case 'Settings': @@ -108,7 +102,7 @@ public function handlerEndTag($xmlParser, $tagName): void break; case 'Title': - if ($this->inMetaDataTag && $this->inMdGeneralTag && !$this->description_processed) { + if (!$this->title_processed) { $this->poolOBJ->setTitle($this->cdata); $this->title_processed = true; $this->cdata = ''; @@ -116,7 +110,7 @@ public function handlerEndTag($xmlParser, $tagName): void break; case 'Description': - if ($this->inMetaDataTag && $this->inMdGeneralTag && !$this->description_processed) { + if (!$this->description_processed) { $this->poolOBJ->setDescription($this->cdata); $this->description_processed = true; $this->cdata = ''; diff --git a/components/ILIAS/TestQuestionPool/classes/class.ilTestQuestionPoolExporter.php b/components/ILIAS/TestQuestionPool/classes/class.ilTestQuestionPoolExporter.php index 88f06450b83d..9234ff485c35 100755 --- a/components/ILIAS/TestQuestionPool/classes/class.ilTestQuestionPoolExporter.php +++ b/components/ILIAS/TestQuestionPool/classes/class.ilTestQuestionPoolExporter.php @@ -91,6 +91,18 @@ public function getXmlExportTailDependencies(string $a_entity, string $a_target_ ]; } + $md_ids = []; + foreach ($a_ids as $id) { + $md_ids[] = $id . ':0:qpl'; + } + if ($md_ids !== []) { + $deps[] = [ + 'component' => 'components/ILIAS/MetaData', + 'entity' => 'md', + 'ids' => $md_ids + ]; + } + return $deps; } diff --git a/components/ILIAS/TestQuestionPool/classes/class.ilTestQuestionPoolImporter.php b/components/ILIAS/TestQuestionPool/classes/class.ilTestQuestionPoolImporter.php index 762569890760..641729323cad 100755 --- a/components/ILIAS/TestQuestionPool/classes/class.ilTestQuestionPoolImporter.php +++ b/components/ILIAS/TestQuestionPool/classes/class.ilTestQuestionPoolImporter.php @@ -143,6 +143,13 @@ public function importXmlRepresentation(string $a_entity, string $a_id, string $ $this->importQuestionSkillAssignments($xmlfile, $a_mapping, $new_obj->getId()); $a_mapping->addMapping("components/ILIAS/TestQuestionPool", "qpl", $a_id, (string) $new_obj->getId()); + $a_mapping->addMapping( + "components/ILIAS/MetaData", + "md", + $a_id . ":0:qpl", + $new_obj->getId() . ":0:qpl" + ); + $new_obj->saveToDb(); }