Public Member Functions | Data Fields

ilQuestionpoolExport Class Reference

Public Member Functions

 ilQuestionpoolExport (&$a_qpl_obj, $a_mode="xml", $array_questions)
 Constructor public.
 getInstId ()
 buildExportFile ()
 build export file (complete zip file)
 buildExportFileXML ()
 build xml export file

Data Fields

 $err
 $db
 $ilias
 $qpl_obj
 $questions
 $inst_id
 $mode

Detailed Description

Definition at line 35 of file class.ilQuestionpoolExport.php.


Member Function Documentation

ilQuestionpoolExport::buildExportFile (  ) 

build export file (complete zip file)

public

Returns:

Definition at line 90 of file class.ilQuestionpoolExport.php.

References buildExportFileXML().

        {
                switch ($this->mode)
                {
                        default:
                                return $this->buildExportFileXML();
                                break;
                }
        }

Here is the call graph for this function:

ilQuestionpoolExport::buildExportFileXML (  ) 

build xml export file

Definition at line 103 of file class.ilQuestionpoolExport.php.

References $ilBench, ilUtil::makeDir(), and ilUtil::zip().

Referenced by buildExportFile().

        {
                global $ilBench;

                $ilBench->start("QuestionpoolExport", "buildExportFile");

                require_once("classes/class.ilXmlWriter.php");

                $this->xml = new ilXmlWriter;

                // set dtd definition
                $this->xml->xmlSetDtdDef("<!DOCTYPE Test SYSTEM \"http://www.ilias.uni-koeln.de/download/dtd/ilias_co.dtd\">");

                // set generated comment
                $this->xml->xmlSetGenCmt("Export of ILIAS Test Questionpool ".
                        $this->qpl_obj->getId()." of installation ".$this->inst.".");

                // set xml header
                $this->xml->xmlHeader();

                // create directories
                $this->qpl_obj->createExportDirectory();
                ilUtil::makeDir($this->export_dir."/".$this->subdir);
                ilUtil::makeDir($this->export_dir."/".$this->subdir."/objects");

                // get Log File
                $expDir = $this->qpl_obj->getExportDirectory();
                $expLog = new ilLog($expDir, "export.log");
                $expLog->delete();
                $expLog->setLogFormat("");
                $expLog->write(date("[y-m-d H:i:s] ")."Start Export");
                
                // write qti file
                $qti_file = fopen($this->export_dir."/".$this->subdir."/".$this->qti_filename, "w");
                fwrite($qti_file, $this->qpl_obj->to_xml($this->questions));
                fclose($qti_file);

                // get xml content
                $ilBench->start("QuestionpoolExport", "buildExportFile_getXML");
                $this->qpl_obj->exportPagesXML($this->xml, $this->inst_id,
                        $this->export_dir."/".$this->subdir, $expLog, $this->questions);
                $ilBench->stop("QuestionpoolExport", "buildExportFile_getXML");

                // dump xml document to screen (only for debugging reasons)
                /*
                echo "<PRE>";
                echo htmlentities($this->xml->xmlDumpMem($format));
                echo "</PRE>";
                */

                // dump xml document to file
                $ilBench->start("QuestionpoolExport", "buildExportFile_dumpToFile");
                $this->xml->xmlDumpFile($this->export_dir."/".$this->subdir."/".$this->filename
                        , false);
                $ilBench->stop("QuestionpoolExport", "buildExportFile_dumpToFile");

                // zip the file
                $ilBench->start("QuestionpoolExport", "buildExportFile_zipFile");
                ilUtil::zip($this->export_dir."/".$this->subdir,
                        $this->export_dir."/".$this->subdir.".zip");
                $ilBench->stop("QuestionpoolExport", "buildExportFile_zipFile");

                // destroy writer object
                $this->xml->_XmlWriter;

                $expLog->write(date("[y-m-d H:i:s] ")."Finished Export");
                $ilBench->stop("QuestionpoolExport", "buildExportFile");

                return $this->export_dir."/".$this->subdir.".zip";
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilQuestionpoolExport::getInstId (  ) 

Definition at line 78 of file class.ilQuestionpoolExport.php.

        {
                return $this->inst_id;
        }

ilQuestionpoolExport::ilQuestionpoolExport ( &$  a_qpl_obj,
a_mode = "xml",
array_questions 
)

Constructor public.

Definition at line 49 of file class.ilQuestionpoolExport.php.

References $ilErr, $ilias, and $settings.

        {
                global $ilErr, $ilDB, $ilias;

                $this->qpl_obj =& $a_qpl_obj;

                $this->err =& $ilErr;
                $this->ilias =& $ilias;
                $this->db =& $ilDB;
                $this->mode = $a_mode;

                $settings = $this->ilias->getAllSettings();
                //$this->inst_id = $settings["inst_id"];
                $this->inst_id = IL_INST_ID;
                $this->questions = $array_questions;
                $date = time();
                switch($this->mode)
                {
                        default:
                                $this->export_dir = $this->qpl_obj->getExportDirectory();
                                $this->subdir = $date."__".$this->inst_id."__".
                                        "qpl"."__".$this->qpl_obj->getId();
                                $this->filename = $this->subdir.".xml";
                                $this->qti_filename = $date."__".$this->inst_id."__".
                                        "qti"."__".$this->qpl_obj->getId().".xml";
                                break;
                }
        }


Field Documentation

ilQuestionpoolExport::$db

Definition at line 38 of file class.ilQuestionpoolExport.php.

ilQuestionpoolExport::$err

Definition at line 37 of file class.ilQuestionpoolExport.php.

ilQuestionpoolExport::$ilias

Definition at line 39 of file class.ilQuestionpoolExport.php.

Referenced by ilQuestionpoolExport().

ilQuestionpoolExport::$inst_id

Definition at line 42 of file class.ilQuestionpoolExport.php.

ilQuestionpoolExport::$mode

Definition at line 43 of file class.ilQuestionpoolExport.php.

ilQuestionpoolExport::$qpl_obj

Definition at line 40 of file class.ilQuestionpoolExport.php.

ilQuestionpoolExport::$questions

Definition at line 41 of file class.ilQuestionpoolExport.php.


The documentation for this class was generated from the following file: