24 include_once
"./Modules/Test/classes/inc.AssessmentConstants.php";
54 $this->qpl_obj =& $a_qpl_obj;
55 if (!is_array($array_questions))
57 $array_questions =& $a_qpl_obj->getAllQuestionIds();
63 $this->mode = $a_mode;
66 $settings = $this->ilias->getAllSettings();
67 $this->inst_id = IL_INST_ID;
68 $this->questions = $array_questions;
70 $this->qpl_obj->createExportDirectory();
74 $this->export_dir = $this->qpl_obj->getExportDirectory(
'xls');
75 $this->filename = $date.
"__".$this->inst_id.
"__".
76 "qpl".
"_".$this->qpl_obj->getId() .
".xls";
77 $this->zipfilename = $date.
"__".$this->inst_id.
"__".
78 "qpl".
"_".$this->qpl_obj->getId() .
".zip";
82 $this->export_dir = $this->qpl_obj->getExportDirectory(
'zip');
83 $this->subdir = $date.
"__".$this->inst_id.
"__".
84 "qpl".
"_".$this->qpl_obj->getId();
85 $this->filename = $this->subdir.
".xml";
86 $this->qti_filename = $date.
"__".$this->inst_id.
"__".
87 "qti".
"_".$this->qpl_obj->getId().
".xml";
125 $ilBench->start(
"QuestionpoolExport",
"buildExportFile");
127 include_once(
"./Services/Xml/classes/class.ilXmlWriter.php");
131 $this->xml->
xmlSetDtdDef(
"<!DOCTYPE Test SYSTEM \"http://www.ilias.uni-koeln.de/download/dtd/ilias_co.dtd\">");
134 $this->xml->xmlSetGenCmt(
"Export of ILIAS Test Questionpool ".
135 $this->qpl_obj->getId().
" of installation ".$this->inst.
".");
138 $this->xml->xmlHeader();
141 include_once
"./Services/Utilities/classes/class.ilUtil.php";
146 $expDir = $this->qpl_obj->getExportDirectory();
149 include_once
"./Services/Logging/classes/class.ilLog.php";
150 $expLog =
new ilLog($expDir,
"export.log");
152 $expLog->setLogFormat(
"");
153 $expLog->write(date(
"[y-m-d H:i:s] ").
"Start Export");
156 $qti_file = fopen($this->export_dir.
"/".$this->subdir.
"/".$this->qti_filename,
"w");
157 fwrite($qti_file, $this->qpl_obj->toXML($this->questions));
161 $ilBench->start(
"QuestionpoolExport",
"buildExportFile_getXML");
162 $this->qpl_obj->exportPagesXML($this->xml, $this->inst_id,
163 $this->export_dir.
"/".$this->subdir, $expLog, $this->questions);
164 $ilBench->stop(
"QuestionpoolExport",
"buildExportFile_getXML");
174 $ilBench->start(
"QuestionpoolExport",
"buildExportFile_dumpToFile");
175 $this->xml->xmlDumpFile($this->export_dir.
"/".$this->subdir.
"/".$this->filename
177 $ilBench->stop(
"QuestionpoolExport",
"buildExportFile_dumpToFile");
180 $ilBench->start(
"QuestionpoolExport",
"buildExportFile_saveAdditionalMobs");
182 $ilBench->stop(
"QuestionpoolExport",
"buildExportFile_saveAdditionalMobs");
185 $ilBench->start(
"QuestionpoolExport",
"buildExportFile_zipFile");
186 ilUtil::zip($this->export_dir.
"/".$this->subdir, $this->export_dir.
"/".$this->subdir.
".zip");
187 if (@is_dir($this->export_dir.
"/".$this->subdir))
190 #ilUtil::delDir($this->export_dir."/".$this->subdir);
193 $ilBench->stop(
"QuestionpoolExport",
"buildExportFile_zipFile");
196 $this->xml->_XmlWriter;
198 $expLog->write(date(
"[y-m-d H:i:s] ").
"Finished Export");
199 $ilBench->stop(
"QuestionpoolExport",
"buildExportFile");
201 return $this->export_dir.
"/".$this->subdir.
".zip";
206 include_once(
"./Services/MediaObjects/classes/class.ilObjMediaObject.php");
208 foreach ($this->questions as $question_id)
211 foreach (
$mobs as $mob)
216 $mob_obj->exportFiles($a_export_dir);
230 $ilBench->start(
"QuestionpoolExport",
"buildExportFile");
231 include_once
"./Services/Excel/classes/class.ilExcelWriterAdapter.php";
233 $workbook = $adapter->getWorkbook();
234 $workbook->setVersion(8);
235 $format_bold =& $workbook->addFormat();
236 $format_bold->setBold();
237 $format_percent =& $workbook->addFormat();
238 $format_percent->setNumFormat(
"0.00%");
239 $format_datetime =& $workbook->addFormat();
240 $format_datetime->setNumFormat(
"DD/MM/YYYY hh:mm:ss");
241 $format_title =& $workbook->addFormat();
242 $format_title->setBold();
243 $format_title->setColor(
'black');
244 $format_title->setPattern(1);
245 $format_title->setFgColor(
'silver');
246 $worksheet =& $workbook->addWorksheet();
250 include_once
"./Services/Excel/classes/class.ilExcelUtils.php";
251 include_once
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
265 $questions = $this->qpl_obj->getQuestionList();
285 ilUtil::zip($this->export_dir .
"/" . $this->filename, $this->export_dir .
"/" . $this->zipfilename);
286 if (@file_exists($this->export_dir .
"/" . $this->filename)) @unlink($this->export_dir .
"/" . $this->filename);