4 include_once
"./Modules/Test/classes/inc.AssessmentConstants.php";
33 public function __construct($a_qpl_obj, $a_mode =
"xml", $array_questions = null)
37 $this->qpl_obj =& $a_qpl_obj;
38 if (!is_array($array_questions))
40 $array_questions =& $a_qpl_obj->getAllQuestionIds();
46 $this->mode = $a_mode;
49 $settings = $this->
ilias->getAllSettings();
50 $this->inst_id = IL_INST_ID;
51 $this->questions = $array_questions;
53 $this->qpl_obj->createExportDirectory();
57 $this->export_dir = $this->qpl_obj->getExportDirectory(
'xml');
58 $this->subdir = $date.
"__".$this->inst_id.
"__".
59 "qpl".
"_".$this->qpl_obj->getId();
60 $this->filename = $this->subdir.
".xml";
61 $this->qti_filename = $date.
"__".$this->inst_id.
"__".
62 "qti".
"_".$this->qpl_obj->getId().
".xml";
65 $this->export_dir = $this->qpl_obj->getExportDirectory(
'xls');
66 $this->filename = $date.
"__".$this->inst_id.
"__".
67 "qpl".
"_".$this->qpl_obj->getId() .
".xlsx";
68 $this->zipfilename = $date.
"__".$this->inst_id.
"__".
69 "qpl".
"_".$this->qpl_obj->getId() .
".zip";
72 $this->export_dir = $this->qpl_obj->getExportDirectory(
'zip');
73 $this->subdir = $date.
"__".$this->inst_id.
"__".
74 "qpl".
"_".$this->qpl_obj->getId();
75 $this->filename = $this->subdir.
".xml";
76 $this->qti_filename = $date.
"__".$this->inst_id.
"__".
77 "qti".
"_".$this->qpl_obj->getId().
".xml";
115 $ilBench->start(
"QuestionpoolExport",
"buildExportFile");
117 include_once(
"./Services/Xml/classes/class.ilXmlWriter.php");
121 $this->xml->
xmlSetDtdDef(
"<!DOCTYPE Test SYSTEM \"http://www.ilias.uni-koeln.de/download/dtd/ilias_co.dtd\">");
124 $this->xml->xmlSetGenCmt(
"Export of ILIAS Test Questionpool ".
125 $this->qpl_obj->getId().
" of installation ".$this->inst.
".");
128 $this->xml->xmlHeader();
131 include_once
"./Services/Utilities/classes/class.ilUtil.php";
136 $expDir = $this->qpl_obj->getExportDirectory();
139 include_once
"./Services/Logging/classes/class.ilLog.php";
140 $expLog =
new ilLog($expDir,
"export.log");
142 $expLog->setLogFormat(
"");
143 $expLog->write(
date(
"[y-m-d H:i:s] ").
"Start Export");
146 $qti_file = fopen($this->export_dir.
"/".$this->subdir.
"/".$this->qti_filename,
"w");
147 fwrite($qti_file, $this->qpl_obj->questionsToXML($this->questions));
151 $ilBench->start(
"QuestionpoolExport",
"buildExportFile_getXML");
152 $this->qpl_obj->objectToXmlWriter($this->xml, $this->inst_id,
153 $this->export_dir.
"/".$this->subdir, $expLog, $this->questions);
154 $ilBench->stop(
"QuestionpoolExport",
"buildExportFile_getXML");
164 $ilBench->start(
"QuestionpoolExport",
"buildExportFile_dumpToFile");
165 $this->xml->xmlDumpFile($this->export_dir.
"/".$this->subdir.
"/".$this->filename
167 $ilBench->stop(
"QuestionpoolExport",
"buildExportFile_dumpToFile");
170 $ilBench->start(
"QuestionpoolExport",
"buildExportFile_saveAdditionalMobs");
172 $ilBench->stop(
"QuestionpoolExport",
"buildExportFile_saveAdditionalMobs");
175 $ilBench->start(
"QuestionpoolExport",
"buildExportFile_zipFile");
176 ilUtil::zip($this->export_dir.
"/".$this->subdir, $this->export_dir.
"/".$this->subdir.
".zip");
177 if (@is_dir($this->export_dir.
"/".$this->subdir))
180 #ilUtil::delDir($this->export_dir."/".$this->subdir); 183 $ilBench->stop(
"QuestionpoolExport",
"buildExportFile_zipFile");
186 $this->xml->_XmlWriter;
188 $expLog->write(
date(
"[y-m-d H:i:s] ").
"Finished Export");
189 $ilBench->stop(
"QuestionpoolExport",
"buildExportFile");
191 return $this->export_dir.
"/".$this->subdir.
".zip";
196 include_once(
"./Services/MediaObjects/classes/class.ilObjMediaObject.php");
198 foreach ($this->questions as $question_id)
201 foreach (
$mobs as $mob)
206 $mob_obj->exportFiles($a_export_dir);
218 require_once
'Modules/TestQuestionPool/classes/class.ilAssExcelFormatHelper.php';
219 require_once
'Modules/TestQuestionPool/classes/class.assQuestion.php';
235 $questions = $this->qpl_obj->getQuestionList();
236 foreach ($questions as $question)
240 $worksheet->setCell(
$row, $col++, $this->lng->txt($question[
"type_tag"]));
252 ilUtil::zip($excelfile , $this->export_dir .
"/" . $this->zipfilename);
253 if (@file_exists($this->export_dir .
"/" . $this->filename)) @unlink($this->export_dir .
"/" . $this->filename);
static makeDirParents($a_dir)
Create a new directory and all parent directories.
xmlSetDtdDef($dtdDef)
Sets dtd definition.
Export class for questionpools.
buildExportFileXLS()
build xml export file
buildExportFile()
build export file (complete zip file)
date( 'd-M-Y', $objPHPExcel->getProperties() ->getCreated())
buildExportFileXML()
build xml export file
redirection script todo: (a better solution should control the processing via a xml file) ...
static zip($a_dir, $a_file, $compress_content=false)
zips given directory/file into given zip.file
static makeDir($a_dir)
creates a new directory and inherits all filesystem permissions of the parent directory You may pass ...
exportXHTMLMediaObjects($a_export_dir)
__construct($a_qpl_obj, $a_mode="xml", $array_questions=null)
Constructor public.
Add data(end) time
Method that wraps PHPs time in order to allow simulations with the workflow.