19 declare(strict_types=1);
23 require_once
'./Modules/Test/classes/inc.AssessmentConstants.php';
61 public string $mode =
"xml" 64 $this->err = $DIC[
'ilErr'];
65 $this->
ilias = $DIC[
'ilias'];
66 $this->db = $DIC[
'ilDB'];
67 $this->
lng = $DIC[
'lng'];
68 $this->bench = $DIC[
'ilBench'];
69 $this->irss = $DIC[
'resource_storage'];
74 $this->export_dir = $this->test_obj->getExportDirectory();
76 switch ($this->mode) {
78 $this->subdir = $date .
"__" . $this->inst_id .
"__" .
79 "tst__results_" . $this->test_obj->getId();
82 $this->subdir = $date .
"__" . $this->inst_id .
"__" .
83 "test__aggregated__results_" . $this->test_obj->getId();
86 $this->subdir = $date .
"__" . $this->inst_id .
"__" .
87 "tst" .
"_" . $this->test_obj->getId();
88 $this->filename = $this->subdir .
".xml";
89 $this->resultsfile = $date .
"__" . $this->inst_id .
"__" .
90 "results" .
"_" . $this->test_obj->getId() .
".xml";
91 $this->qti_filename = $date .
"__" . $this->inst_id .
"__" .
92 "qti" .
"_" . $this->test_obj->getId() .
".xml";
95 $this->filename = $this->subdir .
"." . $this->
getExtension();
105 $this->resultExportingEnabledForTestExport = $resultExprtingEnabledForTestExport;
124 return $this->test_obj->buildStatisticsAccessFilteredParticipantList();
129 switch ($this->mode) {
146 switch ($this->mode) {
159 $expDir = $this->test_obj->getExportDirectory();
162 $this->test_obj->createExportDirectory();
165 $expLog =
new ilLog($expDir,
"export.log");
167 $expLog->setLogFormat(
"");
168 $expLog->write(date(
"[y-m-d H:i:s] ") .
"Start Export Of Results");
171 $file = fopen($this->export_dir .
"/" . $this->filename,
"wb");
172 fwrite($file,
$data);
179 $worksheet->writeToFile($this->export_dir .
"/" . str_replace($this->
getExtension(),
"xlsx", $this->filename));
181 $expLog->write(date(
"[y-m-d H:i:s] ") .
"Finished Export of Results");
192 $this->bench->start(
"TestExport",
"buildExportFile");
199 $this->xml->xmlSetDtdDef(
"<!DOCTYPE Test SYSTEM \"http://www.ilias.uni-koeln.de/download/dtd/ilias_co.dtd\">");
202 $this->xml->xmlSetGenCmt(
"Export of ILIAS Test " .
203 $this->test_obj->getId() .
" of installation " . $this->inst_id .
".");
206 $this->xml->xmlHeader();
208 $this->xml->xmlStartTag(
"ContentObject", array(
'Type' =>
'Test'));
211 $this->test_obj->createExportDirectory();
216 $expDir = $this->test_obj->getExportDirectory();
217 $expLog =
new ilLog($expDir,
"export.log");
219 $expLog->setLogFormat(
"");
220 $expLog->write(date(
"[y-m-d H:i:s] ") .
"Start Export");
223 $qti_file = fopen($this->export_dir .
"/" . $this->subdir .
"/" . $this->qti_filename,
"wb");
228 $this->bench->start(
"TestExport",
"buildExportFile_getXML");
229 $this->test_obj->exportPagesXML(
232 $this->export_dir .
"/" . $this->subdir,
235 $this->bench->stop(
"TestExport",
"buildExportFile_getXML");
243 $this->xml->xmlEndTag(
"ContentObject");
245 $this->bench->start(
"TestExport",
"buildExportFile_dumpToFile");
246 $this->xml->xmlDumpFile($this->export_dir .
"/" . $this->subdir .
"/" . $this->filename,
false);
247 $this->bench->stop(
"TestExport",
"buildExportFile_dumpToFile");
251 $this->test_obj->getTestId(),
254 $this->export_dir .
"/" . $this->subdir .
"/objects",
255 $this->test_obj->getAnonymity()
258 $this->bench->start(
"TestExport",
"buildExportFile_results");
259 $resultwriter->xmlDumpFile($this->export_dir .
"/" . $this->subdir .
"/" . $this->resultsfile,
false);
260 $this->bench->stop(
"TestExport",
"buildExportFile_results");
264 $this->bench->start(
"QuestionpoolExport",
"buildExportFile_saveAdditionalMobs");
266 $this->bench->stop(
"QuestionpoolExport",
"buildExportFile_saveAdditionalMobs");
269 $this->bench->start(
"TestExport",
"buildExportFile_zipFile");
271 $this->export_dir .
"/" . $this->subdir,
272 $this->export_dir .
"/" . $this->subdir .
".zip" 274 $this->bench->stop(
"TestExport",
"buildExportFile_zipFile");
279 $expLog->write(date(
"[y-m-d H:i:s] ") .
"Finished Export");
280 $this->bench->stop(
"TestExport",
"buildExportFile");
282 return $this->export_dir .
"/" . $this->subdir .
".zip";
289 $tstQtiXml = $this->test_obj->toXML();
292 if (strpos($tstQtiXml,
"</section>") !==
false) {
293 $qtiXml = str_replace(
"</section>",
"$qstQtiXml</section>", $tstQtiXml);
295 $qtiXml = str_replace(
"<section ident=\"1\"/>",
"<section ident=\"1\">\n$qstQtiXml</section>", $tstQtiXml);
306 $xml = $questionOBJ->toXML(
false);
309 $xml = preg_replace(
"/<questestinterop>/",
"", $xml);
310 $xml = preg_replace(
"/<\/questestinterop>/",
"", $xml);
319 foreach ($mobs as $mob) {
322 $mob_obj->exportFiles($a_export_dir);
328 foreach ($mobs as $mob) {
331 $mob_obj->exportFiles($a_export_dir);
344 $skillQuestionAssignmentExporter->setXmlWriter($a_xml_writer);
345 $skillQuestionAssignmentExporter->setQuestionIds($questions);
346 $skillQuestionAssignmentExporter->setAssignmentList($assignmentList);
347 $skillQuestionAssignmentExporter->export();
355 $thresholdList->setTestId($this->test_obj->getTestId());
356 $thresholdList->loadFromDb();
359 $skillLevelThresholdExporter->setXmlWriter($a_xml_writer);
360 $skillLevelThresholdExporter->setAssignmentList($assignmentList);
361 $skillLevelThresholdExporter->setThresholdList($thresholdList);
362 $skillLevelThresholdExporter->export();
368 $assignmentList->setParentObjId($this->test_obj->getId());
369 $assignmentList->loadFromDb();
370 $assignmentList->loadAdditionalSkillData();
372 return $assignmentList;
buildQuestionSkillAssignmentList()
Class ChatMainBarProvider .
getQuestionQtiXml($questionId)
ilTestParticipantList $forcedAccessFilteredParticipantList
setResultExportingEnabledForTestExport(bool $resultExprtingEnabledForTestExport)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
__construct(public ilObjTest $test_obj, public string $mode="xml")
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
bool $resultExportingEnabledForTestExport
isResultExportingEnabledForTestExport()
setForcedAccessFilteredParticipantList(ilTestParticipantList $forcedAccessFilteredParticipantList)
getAccessFilteredParticipantList()
static instantiateQuestion(int $question_id)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setIncludeRandomTestQuestionsEnabled(bool $include_random_test_questions_enabled)
exportXHTMLMediaObjects($a_export_dir)
header include for all ilias files.
populateQuestionSkillAssignmentsXml(ilXmlWriter $a_xml_writer, ilAssQuestionSkillAssignmentList $assignmentList, array $questions)
populateSkillLevelThresholdsXml(ilXmlWriter $a_xml_writer, ilAssQuestionSkillAssignmentList $assignmentList)
Error Handling & global info handling.
static zip(string $a_dir, string $a_file, bool $compress_content=false)
getForcedAccessFilteredParticipantList()
static makeDir(string $a_dir)
creates a new directory and inherits all filesystem permissions of the parent directory You may pass ...
populateQuestionSetConfigXml(ilXmlWriter $xmlWriter)