19declare(strict_types=1);
61 protected readonly \
ilTree $tree,
70 $this->export_dir = $test_obj->getExportDirectory();
73 $this->export_dir = $test_obj->getExportDirectory();
74 $this->subdir =
"{$date}__{$this->inst_id}__tst_{$this->test_obj->getId()}";
75 $this->filename = $this->subdir .
'.xml';
76 $this->resultsfile =
"{$date}__{$this->inst_id}__results_{$this->test_obj->getId()}.xml";
77 $this->qti_filename =
"{$date}__{$this->inst_id}__qti_{$this->test_obj->getId()}.xml";
93 $clone->result_exporting_enabled = $enable;
101 $clone->filename = $clone->subdir .
'.xml';
102 $path_array = explode(
'__', $clone->subdir);
103 $clone->resultsfile =
"{$path_array[0]}__{$path_array[1]}__results_{$this->test_obj->getId()}.xml";
104 $clone->qti_filename =
"{$path_array[0]}__{$path_array[1]}__qti_{$this->test_obj->getId()}.xml";
110 $this->bench->start(
'TestExport',
'write');
114 $this->xml = new \ilXmlWriter();
117 $this->xml->xmlSetDtdDef(
'<!DOCTYPE Test SYSTEM "http://www.ilias.uni-koeln.de/download/dtd/ilias_co.dtd">');
120 $this->xml->xmlSetGenCmt(
'Export of ILIAS Test '
121 .
"{$this->test_obj->getId()} of installation {$this->inst_id}");
124 $this->xml->xmlHeader();
126 $this->xml->xmlStartTag(
'ContentObject', [
'Type' =>
'Test']);
129 $this->test_obj->createExportDirectory();
133 $exp_log = new \ilLog(
134 $this->test_obj->getExportDirectory(),
138 $exp_log->setLogFormat(
'');
139 $exp_log->write(date(
'[y-m-d H:i:s] ') .
'Start Export');
142 $qti_file = fopen($this->export_dir .
'/' . $this->subdir .
'/' . $this->qti_filename,
'wb');
147 $this->bench->start(
'TestExport',
'write_getXML');
148 $this->test_obj->exportPagesXML(
151 $this->export_dir .
'/' . $this->subdir,
154 $this->bench->stop(
'TestExport',
'write_getXML');
162 $this->xml->xmlEndTag(
'ContentObject');
164 $this->bench->start(
'TestExport',
'write_dumpToFile');
165 $this->xml->xmlDumpFile($this->export_dir .
'/' . $this->subdir .
'/' . $this->filename,
false);
166 $this->bench->stop(
'TestExport',
'write_dumpToFile');
169 $resultwriter = new \ilTestResultsToXML(
175 "{$this->export_dir}/{$this->subdir}/objects"
177 $resultwriter->setIncludeRandomTestQuestionsEnabled($this->test_obj->isRandomTest());
178 $this->bench->start(
'TestExport',
'write_results');
179 $resultwriter->xmlDumpFile($this->export_dir .
'/' . $this->subdir .
'/' . $this->resultsfile,
false);
180 $this->bench->stop(
'TestExport',
'write_results');
184 $this->bench->start(
'QuestionpoolExport',
'write_saveAdditionalMobs');
186 $this->bench->stop(
'QuestionpoolExport',
'write_saveAdditionalMobs');
189 $this->bench->start(
'TestExport',
'write_zipFile');
191 $this->export_dir .
'/' . $this->subdir,
192 $this->export_dir .
'/' . $this->subdir .
'.zip'
194 $this->bench->stop(
'TestExport',
'write_zipFile');
199 $exp_log->write(date(
'[y-m-d H:i:s] ') .
'Finished Export');
200 $this->bench->stop(
'TestExport',
'write');
202 unlink($this->export_dir .
'/' . $this->subdir .
'.zip');
204 return $this->export_dir .
'/' . $this->subdir .
'.zip';
212 $this->file_delivery->legacyDelivery()->attached(
222 $tst_qti_xml = $this->test_obj->toXML();
225 if (strpos($tst_qti_xml,
'</section>') !==
false) {
226 $qti_xml = str_replace(
'</section>',
"{$qst_qti_xml}</section>", $tst_qti_xml);
228 $qti_xml = str_replace(
"<section ident=\"1\"/>",
"<section ident=\"1\">\n{$qst_qti_xml}</section>", $tst_qti_xml);
237 $xml = $question_obj->toXML(
false);
240 $xml = preg_replace(
'/<questestinterop>/',
'',
$xml);
241 $xml = preg_replace(
'/<\/questestinterop>/',
'',
$xml);
250 foreach ($mobs as $mob) {
252 $mob_obj = new \ilObjMediaObject($mob);
253 $mob_obj->exportFiles($a_export_dir);
259 foreach ($mobs as $mob) {
261 $mob_obj = new \ilObjMediaObject($mob);
262 $mob_obj->exportFiles($a_export_dir);
274 $skill_question_assignment_exporter = new \ilAssQuestionSkillAssignmentExporter();
275 $skill_question_assignment_exporter->setXmlWriter($a_xml_writer);
276 $skill_question_assignment_exporter->setQuestionIds($questions);
277 $skill_question_assignment_exporter->setAssignmentList($assignment_list);
278 $skill_question_assignment_exporter->export();
285 $threshold_list = new \ilTestSkillLevelThresholdList($this->db);
286 $threshold_list->setTestId($this->test_obj->getTestId());
287 $threshold_list->loadFromDb();
289 $skill_level_threshold_exporter = new \ilTestSkillLevelThresholdExporter();
290 $skill_level_threshold_exporter->setXmlWriter($a_xml_writer);
291 $skill_level_threshold_exporter->setAssignmentList($assignment_list);
292 $skill_level_threshold_exporter->setThresholdList($threshold_list);
293 $skill_level_threshold_exporter->export();
298 $assignment_list = new \ilAssQuestionSkillAssignmentList($this->db);
299 $assignment_list->setParentObjId($this->test_obj->getId());
300 $assignment_list->loadFromDb();
301 $assignment_list->loadAdditionalSkillData();
303 return $assignment_list;
withResultExportingEnabled(bool $enable)
exportXHTMLMediaObjects($a_export_dir)
buildQuestionSkillAssignmentList()
populateSkillLevelThresholdsXml(\ilXmlWriter $a_xml_writer, \ilAssQuestionSkillAssignmentList $assignment_list)
bool $result_exporting_enabled
populateQuestionSetConfigXml(\ilXmlWriter $xmlWriter)
ilTestParticipantList $forced_access_filtered_participant_list
populateQuestionSkillAssignmentsXml(\ilXmlWriter $a_xml_writer, \ilAssQuestionSkillAssignmentList $assignment_list, array $questions)
__construct(protected readonly \ilLanguage $lng, protected readonly \ilDBInterface $db, protected readonly \ilBenchmark $bench, protected readonly TestLogger $logger, protected readonly \ilTree $tree, protected readonly \ilComponentRepository $component_repository, protected readonly GeneralQuestionPropertiesRepository $questionrepository, protected readonly FileDeliveryServices $file_delivery, protected readonly \ilObjTest $test_obj, protected readonly ResourceStorage $irss, protected readonly \ilObjUser $user)
withExportDirInfo(string $export_dir)
getQuestionQtiXml(int $question_id)
isResultExportingEnabled()
static instantiateQuestion(int $question_id)
static zip(string $a_dir, string $a_file, bool $compress_content=false)
static makeDir(string $a_dir)
creates a new directory and inherits all filesystem permissions of the parent directory You may pass ...
Tree class data representation in hierachical trees using the Nested Set Model with Gaps by Joe Celco...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Readable part of repository interface to ilComponentDataDB.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...