19 require_once
'./Modules/Test/classes/inc.AssessmentConstants.php';
51 protected string $mode =
"xml",
52 protected ?array $questions = null
55 $this->err = $DIC[
'ilErr'];
56 $this->db = $DIC[
'ilDB'];
57 $this->
ilias = $DIC[
'ilias'];
58 $this->
lng = $DIC[
'lng'];
60 if (!is_array($this->questions)) {
61 $this->questions = $this->qpl_obj->getAllQuestionIds();
67 $this->qpl_obj->createExportDirectory();
68 switch ($this->mode) {
70 $this->export_dir = $this->qpl_obj->getExportDirectory(
'xml');
71 $this->subdir = $date .
"__" . $this->inst_id .
"__" .
72 "qpl" .
"_" . $this->qpl_obj->getId();
73 $this->filename = $this->subdir .
".xml";
74 $this->qti_filename = $date .
"__" . $this->inst_id .
"__" .
75 "qti" .
"_" . $this->qpl_obj->getId() .
".xml";
78 $this->export_dir = $this->qpl_obj->getExportDirectory(
'xlsx');
79 $this->filename = $date .
"__" . $this->inst_id .
"__" .
80 "qpl" .
"_" . $this->qpl_obj->getId() .
".xlsx";
81 $this->zipfilename = $date .
"__" . $this->inst_id .
"__" .
82 "qpl" .
"_" . $this->qpl_obj->getId() .
".zip";
85 $this->export_dir = $this->qpl_obj->getExportDirectory(
'zip');
86 $this->subdir = $date .
"__" . $this->inst_id .
"__" .
87 "qpl" .
"_" . $this->qpl_obj->getId();
88 $this->filename = $this->subdir .
".xml";
89 $this->qti_filename = $date .
"__" . $this->inst_id .
"__" .
90 "qti" .
"_" . $this->qpl_obj->getId() .
".xml";
106 switch ($this->mode) {
121 $ilBench = $DIC[
'ilBench'];
123 $ilBench->start(
"QuestionpoolExport",
"buildExportFile");
126 $this->xml->xmlSetDtdDef(
"<!DOCTYPE Test SYSTEM \"http://www.ilias.uni-koeln.de/download/dtd/ilias_co.dtd\">");
127 $this->xml->xmlSetGenCmt(
"Export of ILIAS Test Questionpool " .
129 $this->xml->xmlHeader();
134 $expDir = $this->qpl_obj->getExportDirectory();
137 $expLog =
new ilLog($expDir,
"export.log");
139 $expLog->setLogFormat(
"");
140 $expLog->write(date(
"[y-m-d H:i:s] ") .
"Start Export");
142 $qti_file = fopen($this->export_dir .
"/" . $this->subdir .
"/" . $this->qti_filename,
"w");
143 fwrite($qti_file, $this->qpl_obj->questionsToXML($this->questions));
146 $ilBench->start(
"QuestionpoolExport",
"buildExportFile_getXML");
147 $this->qpl_obj->objectToXmlWriter(
150 $this->export_dir .
"/" . $this->subdir,
154 $ilBench->stop(
"QuestionpoolExport",
"buildExportFile_getXML");
156 $ilBench->start(
"QuestionpoolExport",
"buildExportFile_dumpToFile");
157 $this->xml->xmlDumpFile($this->export_dir .
"/" . $this->subdir .
"/" . $this->filename,
false);
158 $ilBench->stop(
"QuestionpoolExport",
"buildExportFile_dumpToFile");
160 $ilBench->start(
"QuestionpoolExport",
"buildExportFile_saveAdditionalMobs");
162 $ilBench->stop(
"QuestionpoolExport",
"buildExportFile_saveAdditionalMobs");
164 $ilBench->start(
"QuestionpoolExport",
"buildExportFile_zipFile");
165 ilFileUtils::zip($this->export_dir .
"/" . $this->subdir, $this->export_dir .
"/" . $this->subdir .
".zip");
167 $ilBench->stop(
"QuestionpoolExport",
"buildExportFile_zipFile");
169 $expLog->write(date(
"[y-m-d H:i:s] ") .
"Finished Export");
170 $ilBench->stop(
"QuestionpoolExport",
"buildExportFile");
172 return $this->export_dir .
"/" . $this->subdir .
".zip";
177 foreach ($this->questions as $question_id) {
179 foreach ($mobs as $mob) {
182 $mob_obj->exportFiles($a_export_dir);
195 $worksheet->addSheet(
'Sheet 1');
199 $worksheet->setFormattedExcelTitle($worksheet->getColumnCoord($col++) . $row, $this->
lng->txt(
"title"));
200 $worksheet->setFormattedExcelTitle($worksheet->getColumnCoord($col++) . $row, $this->
lng->txt(
"description"));
201 $worksheet->setFormattedExcelTitle($worksheet->getColumnCoord($col++) . $row, $this->
lng->txt(
"question_type"));
202 $worksheet->setFormattedExcelTitle($worksheet->getColumnCoord($col++) . $row, $this->
lng->txt(
"author"));
203 $worksheet->setFormattedExcelTitle($worksheet->getColumnCoord($col++) . $row, $this->
lng->txt(
"create_date"));
204 $worksheet->setFormattedExcelTitle($worksheet->getColumnCoord($col) . $row, $this->
lng->txt(
"last_update"));
208 $questions = $this->qpl_obj->getQuestionList();
209 foreach ($questions as $question) {
210 $worksheet->setCell($row, $col++, $question[
"title"]);
211 $worksheet->setCell($row, $col++, $question[
"description"]);
212 $worksheet->setCell($row, $col++, $this->
lng->txt($question[
"type_tag"]));
213 $worksheet->setCell($row, $col++, $question[
"author"]);
215 $worksheet->setCell($row, $col++,
$created);
217 $worksheet->setCell($row, $col++,
$updated);
223 $worksheet->writeToFile($excelfile);
Class ChatMainBarProvider .
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
__construct(protected ilObjQuestionPool $qpl_obj, protected string $mode="xml", protected ?array $questions=null)
Constructor public.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static makeDirParents(string $a_dir)
Create a new directory and all parent directories.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
buildExportFile()
build export file (complete zip file)
buildExportFileXML()
build xml export file
header include for all ilias files.
buildExportFileXLSX()
build xml export file
exportXHTMLMediaObjects($a_export_dir)
Error Handling & global info handling.
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 ...