19 declare(strict_types=1);
61 protected readonly \
ilTree $tree,
69 $this->export_dir = $test_obj->getExportDirectory();
72 $this->export_dir = $test_obj->getExportDirectory();
73 $this->subdir =
"{$date}__{$this->inst_id}__tst_{$this->test_obj->getId()}";
74 $this->filename = $this->subdir .
'.xml';
75 $this->resultsfile =
"{$date}__{$this->inst_id}__results_{$this->test_obj->getId()}.xml";
76 $this->qti_filename =
"{$date}__{$this->inst_id}__qti_{$this->test_obj->getId()}.xml";
92 $clone->result_exporting_enabled = $enable;
99 $clone->subdir = basename($export_dir);
100 $clone->filename = $clone->subdir .
'.xml';
101 $path_array = explode(
'__', $clone->subdir);
102 $clone->resultsfile =
"{$path_array[0]}__{$path_array[1]}__results_{$this->test_obj->getId()}.xml";
103 $clone->qti_filename =
"{$path_array[0]}__{$path_array[1]}__qti_{$this->test_obj->getId()}.xml";
109 $this->bench->start(
'TestExport',
'write');
113 $this->xml = new \ilXmlWriter();
116 $this->xml->xmlSetDtdDef(
'<!DOCTYPE Test SYSTEM "http://www.ilias.uni-koeln.de/download/dtd/ilias_co.dtd">');
119 $this->xml->xmlSetGenCmt(
'Export of ILIAS Test ' 120 .
"{$this->test_obj->getId()} of installation {$this->inst_id}");
123 $this->xml->xmlHeader();
125 $this->xml->xmlStartTag(
'ContentObject', [
'Type' =>
'Test']);
128 $this->test_obj->createExportDirectory();
132 $exp_log = new \ilLog(
133 $this->test_obj->getExportDirectory(),
137 $exp_log->setLogFormat(
'');
138 $exp_log->write(date(
'[y-m-d H:i:s] ') .
'Start Export');
141 $qti_file = fopen($this->export_dir .
'/' . $this->subdir .
'/' . $this->qti_filename,
'wb');
146 $this->bench->start(
'TestExport',
'write_getXML');
147 $this->test_obj->exportPagesXML(
150 $this->export_dir .
'/' . $this->subdir,
153 $this->bench->stop(
'TestExport',
'write_getXML');
161 $this->xml->xmlEndTag(
'ContentObject');
163 $this->bench->start(
'TestExport',
'write_dumpToFile');
164 $this->xml->xmlDumpFile($this->export_dir .
'/' . $this->subdir .
'/' . $this->filename,
false);
165 $this->bench->stop(
'TestExport',
'write_dumpToFile');
168 $resultwriter = new \ilTestResultsToXML(
169 $this->test_obj->getTestId(),
172 $this->export_dir .
"/" . $this->subdir .
"/objects",
173 $this->test_obj->getAnonymity()
175 $resultwriter->setIncludeRandomTestQuestionsEnabled($this->test_obj->isRandomTest());
176 $this->bench->start(
'TestExport',
'write_results');
177 $resultwriter->xmlDumpFile($this->export_dir .
'/' . $this->subdir .
'/' . $this->resultsfile,
false);
178 $this->bench->stop(
'TestExport',
'write_results');
182 $this->bench->start(
'QuestionpoolExport',
'write_saveAdditionalMobs');
184 $this->bench->stop(
'QuestionpoolExport',
'write_saveAdditionalMobs');
187 $this->bench->start(
'TestExport',
'write_zipFile');
189 $this->export_dir .
'/' . $this->subdir,
190 $this->export_dir .
'/' . $this->subdir .
'.zip' 192 $this->bench->stop(
'TestExport',
'write_zipFile');
197 $exp_log->write(date(
'[y-m-d H:i:s] ') .
'Finished Export');
198 $this->bench->stop(
'TestExport',
'write');
200 unlink($this->export_dir .
'/' . $this->subdir .
'.zip');
202 return $this->export_dir .
'/' . $this->subdir .
'.zip';
210 $this->file_delivery->legacyDelivery()->attached(
220 $tst_qti_xml = $this->test_obj->toXML();
223 if (strpos($tst_qti_xml,
'</section>') !==
false) {
224 $qti_xml = str_replace(
'</section>',
"{$qst_qti_xml}</section>", $tst_qti_xml);
226 $qti_xml = str_replace(
"<section ident=\"1\"/>",
"<section ident=\"1\">\n{$qst_qti_xml}</section>", $tst_qti_xml);
235 $xml = $question_obj->toXML(
false);
238 $xml = preg_replace(
'/<questestinterop>/',
'', $xml);
239 $xml = preg_replace(
'/<\/questestinterop>/',
'', $xml);
248 foreach ($mobs as $mob) {
250 $mob_obj = new \ilObjMediaObject($mob);
251 $mob_obj->exportFiles($a_export_dir);
257 foreach ($mobs as $mob) {
259 $mob_obj = new \ilObjMediaObject($mob);
260 $mob_obj->exportFiles($a_export_dir);
272 $skill_question_assignment_exporter = new \ilAssQuestionSkillAssignmentExporter();
273 $skill_question_assignment_exporter->setXmlWriter($a_xml_writer);
274 $skill_question_assignment_exporter->setQuestionIds($questions);
275 $skill_question_assignment_exporter->setAssignmentList($assignment_list);
276 $skill_question_assignment_exporter->export();
283 $threshold_list = new \ilTestSkillLevelThresholdList($this->db);
284 $threshold_list->setTestId($this->test_obj->getTestId());
285 $threshold_list->loadFromDb();
287 $skill_level_threshold_exporter = new \ilTestSkillLevelThresholdExporter();
288 $skill_level_threshold_exporter->setXmlWriter($a_xml_writer);
289 $skill_level_threshold_exporter->setAssignmentList($assignment_list);
290 $skill_level_threshold_exporter->setThresholdList($threshold_list);
291 $skill_level_threshold_exporter->export();
296 $assignment_list = new \ilAssQuestionSkillAssignmentList($this->db);
297 $assignment_list->setParentObjId($this->test_obj->getId());
298 $assignment_list->loadFromDb();
299 $assignment_list->loadAdditionalSkillData();
301 return $assignment_list;
getQuestionQtiXml(int $question_id)
Readable part of repository interface to ilComponentDataDB.
buildQuestionSkillAssignmentList()
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
populateSkillLevelThresholdsXml(\ilXmlWriter $a_xml_writer, \ilAssQuestionSkillAssignmentList $assignment_list)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
withResultExportingEnabled(bool $enable)
__construct(protected readonly Language $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)
populateQuestionSkillAssignmentsXml(\ilXmlWriter $a_xml_writer, \ilAssQuestionSkillAssignmentList $assignment_list, array $questions)
bool $result_exporting_enabled
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
ilTestParticipantList $forced_access_filtered_participant_list
static instantiateQuestion(int $question_id)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
isResultExportingEnabled()
withExportDirInfo(string $export_dir)
exportXHTMLMediaObjects($a_export_dir)
static zip(string $a_dir, string $a_file, bool $compress_content=false)
populateQuestionSetConfigXml(\ilXmlWriter $xmlWriter)
static makeDir(string $a_dir)
creates a new directory and inherits all filesystem permissions of the parent directory You may pass ...