Export class for questionpools.
More...
◆ __construct()
ilQuestionpoolExport::__construct |
( |
|
$a_qpl_obj, |
|
|
|
$a_mode = "xml" , |
|
|
|
$array_questions = null |
|
) |
| |
Constructor public.
Definition at line 33 of file class.ilQuestionpoolExport.php.
References $ilDB, $ilErr, $ilias, $lng, and time.
37 $this->qpl_obj =&$a_qpl_obj;
38 if (!is_array($array_questions)) {
39 $array_questions =&$a_qpl_obj->getAllQuestionIds();
45 $this->mode = $a_mode;
48 $settings = $this->
ilias->getAllSettings();
49 $this->inst_id = IL_INST_ID;
50 $this->questions = $array_questions;
52 $this->qpl_obj->createExportDirectory();
53 switch ($this->mode) {
55 $this->export_dir = $this->qpl_obj->getExportDirectory(
'xml');
56 $this->subdir = $date .
"__" . $this->inst_id .
"__" .
57 "qpl" .
"_" . $this->qpl_obj->getId();
58 $this->filename = $this->subdir .
".xml";
59 $this->qti_filename = $date .
"__" . $this->inst_id .
"__" .
60 "qti" .
"_" . $this->qpl_obj->getId() .
".xml";
63 $this->export_dir = $this->qpl_obj->getExportDirectory(
'xls');
64 $this->filename = $date .
"__" . $this->inst_id .
"__" .
65 "qpl" .
"_" . $this->qpl_obj->getId() .
".xlsx";
66 $this->zipfilename = $date .
"__" . $this->inst_id .
"__" .
67 "qpl" .
"_" . $this->qpl_obj->getId() .
".zip";
70 $this->export_dir = $this->qpl_obj->getExportDirectory(
'zip');
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";
redirection script todo: (a better solution should control the processing via a xml file) ...
Add data(end) time
Method that wraps PHPs time in order to allow simulations with the workflow.
◆ buildExportFile()
ilQuestionpoolExport::buildExportFile |
( |
| ) |
|
◆ buildExportFileXLS()
ilQuestionpoolExport::buildExportFileXLS |
( |
| ) |
|
|
protected |
build xml export file
Definition at line 213 of file class.ilQuestionpoolExport.php.
References $filename, $questions, $row, $worksheet, IL_CAL_UNIX, and ilUtil\zip().
Referenced by buildExportFile().
215 require_once
'Modules/TestQuestionPool/classes/class.ilAssExcelFormatHelper.php';
216 require_once
'Modules/TestQuestionPool/classes/class.assQuestion.php';
232 $questions = $this->qpl_obj->getQuestionList();
236 $worksheet->setCell(
$row, $col++, $this->lng->txt($question[
"type_tag"]));
248 ilUtil::zip($excelfile, $this->export_dir .
"/" . $this->zipfilename);
249 if (@file_exists($this->export_dir .
"/" . $this->filename)) {
250 @unlink($this->export_dir .
"/" . $this->filename);
static zip($a_dir, $a_file, $compress_content=false)
zips given directory/file into given zip.file
◆ buildExportFileXML()
ilQuestionpoolExport::buildExportFileXML |
( |
| ) |
|
build xml export file
Definition at line 108 of file class.ilQuestionpoolExport.php.
References $ilBench, date, exportXHTMLMediaObjects(), ilUtil\makeDir(), ilUtil\makeDirParents(), ilXmlWriter\xmlSetDtdDef(), and ilUtil\zip().
Referenced by buildExportFile().
112 $ilBench->start(
"QuestionpoolExport",
"buildExportFile");
114 include_once(
"./Services/Xml/classes/class.ilXmlWriter.php");
118 $this->xml->
xmlSetDtdDef(
"<!DOCTYPE Test SYSTEM \"http://www.ilias.uni-koeln.de/download/dtd/ilias_co.dtd\">");
121 $this->xml->xmlSetGenCmt(
"Export of ILIAS Test Questionpool " .
122 $this->qpl_obj->getId() .
" of installation " . $this->inst .
".");
125 $this->xml->xmlHeader();
128 include_once
"./Services/Utilities/classes/class.ilUtil.php";
133 $expDir = $this->qpl_obj->getExportDirectory();
136 include_once
"./Services/Logging/classes/class.ilLog.php";
137 $expLog =
new ilLog($expDir,
"export.log");
139 $expLog->setLogFormat(
"");
140 $expLog->write(
date(
"[y-m-d H:i:s] ") .
"Start Export");
143 $qti_file = fopen($this->export_dir .
"/" . $this->subdir .
"/" . $this->qti_filename,
"w");
144 fwrite($qti_file, $this->qpl_obj->questionsToXML($this->questions));
148 $ilBench->start(
"QuestionpoolExport",
"buildExportFile_getXML");
149 $this->qpl_obj->objectToXmlWriter(
152 $this->export_dir .
"/" . $this->subdir,
156 $ilBench->stop(
"QuestionpoolExport",
"buildExportFile_getXML");
166 $ilBench->start(
"QuestionpoolExport",
"buildExportFile_dumpToFile");
167 $this->xml->xmlDumpFile($this->export_dir .
"/" . $this->subdir .
"/" . $this->filename,
false);
168 $ilBench->stop(
"QuestionpoolExport",
"buildExportFile_dumpToFile");
171 $ilBench->start(
"QuestionpoolExport",
"buildExportFile_saveAdditionalMobs");
173 $ilBench->stop(
"QuestionpoolExport",
"buildExportFile_saveAdditionalMobs");
176 $ilBench->start(
"QuestionpoolExport",
"buildExportFile_zipFile");
177 ilUtil::zip($this->export_dir .
"/" . $this->subdir, $this->export_dir .
"/" . $this->subdir .
".zip");
178 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";
static makeDirParents($a_dir)
Create a new directory and all parent directories.
xmlSetDtdDef($dtdDef)
Sets dtd definition.
date( 'd-M-Y', $objPHPExcel->getProperties() ->getCreated())
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)
◆ exportXHTMLMediaObjects()
ilQuestionpoolExport::exportXHTMLMediaObjects |
( |
|
$a_export_dir | ) |
|
◆ getInstId()
ilQuestionpoolExport::getInstId |
( |
| ) |
|
◆ $db
ilQuestionpoolExport::$db |
◆ $err
ilQuestionpoolExport::$err |
◆ $ilias
ilQuestionpoolExport::$ilias |
◆ $inst_id
ilQuestionpoolExport::$inst_id |
◆ $lng
ilQuestionpoolExport::$lng |
◆ $mode
ilQuestionpoolExport::$mode |
◆ $qpl_obj
ilQuestionpoolExport::$qpl_obj |
◆ $questions
ilQuestionpoolExport::$questions |
The documentation for this class was generated from the following file: