19 declare(strict_types=1);
60 protected readonly \
ilTree $tree,
67 $this->export_dir = $test_obj->getExportDirectory();
70 $this->export_dir = $test_obj->getExportDirectory();
71 $this->subdir =
"{$date}__{$this->inst_id}__tst_{$this->test_obj->getId()}";
72 $this->filename = $this->subdir .
'.xml';
73 $this->resultsfile =
"{$date}__{$this->inst_id}__results_{$this->test_obj->getId()}.xml";
74 $this->qti_filename =
"{$date}__{$this->inst_id}__qti_{$this->test_obj->getId()}.xml";
90 $clone->result_exporting_enabled = $enable;
97 $clone->subdir = basename($export_dir);
98 $clone->filename = $clone->subdir .
'.xml';
99 $path_array = explode(
'__', $clone->subdir);
100 $clone->resultsfile =
"{$path_array[0]}__{$path_array[1]}__results_{$this->test_obj->getId()}.xml";
101 $clone->qti_filename =
"{$path_array[0]}__{$path_array[1]}__qti_{$this->test_obj->getId()}.xml";
107 $this->bench->start(
'TestExport',
'write');
111 $this->xml = new \ilXmlWriter();
114 $this->xml->xmlSetDtdDef(
'<!DOCTYPE Test SYSTEM "http://www.ilias.uni-koeln.de/download/dtd/ilias_co.dtd">');
117 $this->xml->xmlSetGenCmt(
'Export of ILIAS Test ' 118 .
"{$this->test_obj->getId()} of installation {$this->inst_id}");
121 $this->xml->xmlHeader();
123 $this->xml->xmlStartTag(
'ContentObject', [
'Type' =>
'Test']);
126 $this->test_obj->createExportDirectory();
130 $exp_log = new \ilLog(
131 $this->test_obj->getExportDirectory(),
135 $exp_log->setLogFormat(
'');
136 $exp_log->write(date(
'[y-m-d H:i:s] ') .
'Start Export');
139 $qti_file = fopen($this->export_dir .
'/' . $this->subdir .
'/' . $this->qti_filename,
'wb');
144 $this->bench->start(
'TestExport',
'write_getXML');
145 $this->test_obj->exportPagesXML(
148 $this->export_dir .
'/' . $this->subdir,
151 $this->bench->stop(
'TestExport',
'write_getXML');
159 $this->xml->xmlEndTag(
'ContentObject');
161 $this->bench->start(
'TestExport',
'write_dumpToFile');
162 $this->xml->xmlDumpFile($this->export_dir .
'/' . $this->subdir .
'/' . $this->filename,
false);
163 $this->bench->stop(
'TestExport',
'write_dumpToFile');
166 $resultwriter = new \ilTestResultsToXML($this->test_obj->getTestId(),
$this->db, $this->test_obj->getAnonymity());
167 $resultwriter->setIncludeRandomTestQuestionsEnabled($this->test_obj->isRandomTest());
168 $this->bench->start(
'TestExport',
'write_results');
169 $resultwriter->xmlDumpFile($this->export_dir .
'/' . $this->subdir .
'/' . $this->resultsfile,
false);
170 $this->bench->stop(
'TestExport',
'write_results');
174 $this->bench->start(
'QuestionpoolExport',
'write_saveAdditionalMobs');
176 $this->bench->stop(
'QuestionpoolExport',
'write_saveAdditionalMobs');
179 $this->bench->start(
'TestExport',
'write_zipFile');
181 $this->export_dir .
'/' . $this->subdir,
182 $this->export_dir .
'/' . $this->subdir .
'.zip' 184 $this->bench->stop(
'TestExport',
'write_zipFile');
189 $exp_log->write(date(
'[y-m-d H:i:s] ') .
'Finished Export');
190 $this->bench->stop(
'TestExport',
'write');
192 unlink($this->export_dir .
'/' . $this->subdir .
'.zip');
194 return $this->export_dir .
'/' . $this->subdir .
'.zip';
202 $this->file_delivery->legacyDelivery()->attached(
212 $tst_qti_xml = $this->test_obj->toXML();
215 if (strpos($tst_qti_xml,
'</section>') !==
false) {
216 $qti_xml = str_replace(
'</section>',
"{$qst_qti_xml}</section>", $tst_qti_xml);
218 $qti_xml = str_replace(
"<section ident=\"1\"/>",
"<section ident=\"1\">\n{$qst_qti_xml}</section>", $tst_qti_xml);
227 $xml = $question_obj->toXML(
false);
230 $xml = preg_replace(
'/<questestinterop>/',
'', $xml);
231 $xml = preg_replace(
'/<\/questestinterop>/',
'', $xml);
240 foreach ($mobs as $mob) {
242 $mob_obj = new \ilObjMediaObject($mob);
243 $mob_obj->exportFiles($a_export_dir);
249 foreach ($mobs as $mob) {
251 $mob_obj = new \ilObjMediaObject($mob);
252 $mob_obj->exportFiles($a_export_dir);
264 $skill_question_assignment_exporter = new \ilAssQuestionSkillAssignmentExporter();
265 $skill_question_assignment_exporter->setXmlWriter($a_xml_writer);
266 $skill_question_assignment_exporter->setQuestionIds($questions);
267 $skill_question_assignment_exporter->setAssignmentList($assignment_list);
268 $skill_question_assignment_exporter->export();
275 $threshold_list = new \ilTestSkillLevelThresholdList($this->db);
276 $threshold_list->setTestId($this->test_obj->getTestId());
277 $threshold_list->loadFromDb();
279 $skill_level_threshold_exporter = new \ilTestSkillLevelThresholdExporter();
280 $skill_level_threshold_exporter->setXmlWriter($a_xml_writer);
281 $skill_level_threshold_exporter->setAssignmentList($assignment_list);
282 $skill_level_threshold_exporter->setThresholdList($threshold_list);
283 $skill_level_threshold_exporter->export();
288 $assignment_list = new \ilAssQuestionSkillAssignmentList($this->db);
289 $assignment_list->setParentObjId($this->test_obj->getId());
290 $assignment_list->loadFromDb();
291 $assignment_list->loadAdditionalSkillData();
293 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)
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)
__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)
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 ...