4include_once 
"./Modules/Test/classes/inc.AssessmentConstants.php";
 
   33    public function __construct($a_qpl_obj, $a_mode = 
"xml", $array_questions = 
null)
 
   41        $this->qpl_obj = &$a_qpl_obj;
 
   42        if (!is_array($array_questions)) {
 
   43            $array_questions = &$a_qpl_obj->getAllQuestionIds();
 
   49        $this->mode = $a_mode;
 
   52        $settings = $this->
ilias->getAllSettings();
 
   53        $this->inst_id = IL_INST_ID;
 
   54        $this->questions = $array_questions;
 
   56        $this->qpl_obj->createExportDirectory();
 
   57        switch ($this->mode) {
 
   59                $this->export_dir = $this->qpl_obj->getExportDirectory(
'xml');
 
   60                $this->subdir = $date . 
"__" . $this->inst_id . 
"__" .
 
   61                    "qpl" . 
"_" . $this->qpl_obj->getId();
 
   62                $this->filename = $this->subdir . 
".xml";
 
   63                $this->qti_filename = $date . 
"__" . $this->inst_id . 
"__" .
 
   64                    "qti" . 
"_" . $this->qpl_obj->getId() . 
".xml";
 
   67                $this->export_dir = $this->qpl_obj->getExportDirectory(
'xls');
 
   68                $this->filename = $date . 
"__" . $this->inst_id . 
"__" .
 
   69                    "qpl" . 
"_" . $this->qpl_obj->getId() . 
".xlsx";
 
   70                $this->zipfilename = $date . 
"__" . $this->inst_id . 
"__" .
 
   71                    "qpl" . 
"_" . $this->qpl_obj->getId() . 
".zip";
 
   74                $this->export_dir = $this->qpl_obj->getExportDirectory(
'zip');
 
   75                $this->subdir = $date . 
"__" . $this->inst_id . 
"__" .
 
   76                    "qpl" . 
"_" . $this->qpl_obj->getId();
 
   77                $this->filename = $this->subdir . 
".xml";
 
   78                $this->qti_filename = $date . 
"__" . $this->inst_id . 
"__" .
 
   79                    "qti" . 
"_" . $this->qpl_obj->getId() . 
".xml";
 
   98        switch ($this->mode) {
 
  117        $ilBench->start(
"QuestionpoolExport", 
"buildExportFile");
 
  119        include_once(
"./Services/Xml/classes/class.ilXmlWriter.php");
 
  123        $this->xml->
xmlSetDtdDef(
"<!DOCTYPE Test SYSTEM \"http://www.ilias.uni-koeln.de/download/dtd/ilias_co.dtd\">");
 
  126        $this->xml->xmlSetGenCmt(
"Export of ILIAS Test Questionpool " .
 
  127            $this->qpl_obj->getId() . 
" of installation " . $this->inst . 
".");
 
  130        $this->xml->xmlHeader();
 
  133        include_once 
"./Services/Utilities/classes/class.ilUtil.php";
 
  138        $expDir = $this->qpl_obj->getExportDirectory();
 
  141        include_once 
"./Services/Logging/classes/class.ilLog.php";
 
  142        $expLog = 
new ilLog($expDir, 
"export.log");
 
  144        $expLog->setLogFormat(
"");
 
  145        $expLog->write(date(
"[y-m-d H:i:s] ") . 
"Start Export");
 
  148        $qti_file = fopen($this->export_dir . 
"/" . $this->subdir . 
"/" . $this->qti_filename, 
"w");
 
  149        fwrite($qti_file, $this->qpl_obj->questionsToXML($this->questions));
 
  153        $ilBench->start(
"QuestionpoolExport", 
"buildExportFile_getXML");
 
  154        $this->qpl_obj->objectToXmlWriter(
 
  157            $this->export_dir . 
"/" . $this->subdir,
 
  161        $ilBench->stop(
"QuestionpoolExport", 
"buildExportFile_getXML");
 
  171        $ilBench->start(
"QuestionpoolExport", 
"buildExportFile_dumpToFile");
 
  172        $this->xml->xmlDumpFile($this->export_dir . 
"/" . $this->subdir . 
"/" . $this->filename, 
false);
 
  173        $ilBench->stop(
"QuestionpoolExport", 
"buildExportFile_dumpToFile");
 
  176        $ilBench->start(
"QuestionpoolExport", 
"buildExportFile_saveAdditionalMobs");
 
  178        $ilBench->stop(
"QuestionpoolExport", 
"buildExportFile_saveAdditionalMobs");
 
  181        $ilBench->start(
"QuestionpoolExport", 
"buildExportFile_zipFile");
 
  182        ilUtil::zip($this->export_dir . 
"/" . $this->subdir, $this->export_dir . 
"/" . $this->subdir . 
".zip");
 
  183        if (@is_dir($this->export_dir . 
"/" . $this->subdir)) {
 
  185            #ilUtil::delDir($this->export_dir."/".$this->subdir);
 
  188        $ilBench->stop(
"QuestionpoolExport", 
"buildExportFile_zipFile");
 
  191        $this->xml->_XmlWriter;
 
  193        $expLog->write(date(
"[y-m-d H:i:s] ") . 
"Finished Export");
 
  194        $ilBench->stop(
"QuestionpoolExport", 
"buildExportFile");
 
  196        return $this->export_dir . 
"/" . $this->subdir . 
".zip";
 
  201        include_once(
"./Services/MediaObjects/classes/class.ilObjMediaObject.php");
 
  203        foreach ($this->questions as $question_id) {
 
  205            foreach (
$mobs as $mob) {
 
  208                    $mob_obj->exportFiles($a_export_dir);
 
  220        require_once 
'Modules/TestQuestionPool/classes/class.ilAssExcelFormatHelper.php';
 
  221        require_once 
'Modules/TestQuestionPool/classes/class.assQuestion.php';
 
  224        $worksheet->addSheet(
'Sheet 1');
 
  228        $worksheet->setFormattedExcelTitle($worksheet->getColumnCoord($col++) . 
$row, $this->lng->txt(
"title"));
 
  229        $worksheet->setFormattedExcelTitle($worksheet->getColumnCoord($col++) . 
$row, $this->lng->txt(
"description"));
 
  230        $worksheet->setFormattedExcelTitle($worksheet->getColumnCoord($col++) . 
$row, $this->lng->txt(
"question_type"));
 
  231        $worksheet->setFormattedExcelTitle($worksheet->getColumnCoord($col++) . 
$row, $this->lng->txt(
"author"));
 
  232        $worksheet->setFormattedExcelTitle($worksheet->getColumnCoord($col++) . 
$row, $this->lng->txt(
"create_date"));
 
  233        $worksheet->setFormattedExcelTitle($worksheet->getColumnCoord($col) . 
$row, $this->lng->txt(
"last_update"));
 
  237        $questions = $this->qpl_obj->getQuestionList();
 
  239            $worksheet->setCell(
$row, $col++, $question[
"title"]);
 
  240            $worksheet->setCell(
$row, $col++, $question[
"description"]);
 
  241            $worksheet->setCell(
$row, $col++, $this->lng->txt($question[
"type_tag"]));
 
  242            $worksheet->setCell(
$row, $col++, $question[
"author"]);
 
  244            $worksheet->setCell(
$row, $col++, $created);
 
  246            $worksheet->setCell(
$row, $col++, $updated);
 
  252        $worksheet->writeToFile($excelfile);
 
  253        ilUtil::zip($excelfile, $this->export_dir . 
"/" . $this->zipfilename);
 
  254        if (@file_exists($this->export_dir . 
"/" . $this->filename)) {
 
  255            @unlink($this->export_dir . 
"/" . $this->filename);
 
An exception for terminatinating execution or to throw for unit testing.
Export class for questionpools.
exportXHTMLMediaObjects($a_export_dir)
buildExportFileXLS()
build xml export file
__construct($a_qpl_obj, $a_mode="xml", $array_questions=null)
Constructor @access public.
buildExportFileXML()
build xml export file
buildExportFile()
build export file (complete zip file)
static zip($a_dir, $a_file, $compress_content=false)
zips given directory/file into given zip.file
static makeDirParents($a_dir)
Create a new directory and all parent directories.
static makeDir($a_dir)
creates a new directory and inherits all filesystem permissions of the parent directory You may pass ...
xmlSetDtdDef($dtdDef)
Sets dtd definition.
redirection script todo: (a better solution should control the processing via a xml file)