Public Member Functions | Data Fields

ilTestExport Class Reference

Public Member Functions

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

Data Fields

 $err
 $db
 $ilias
 $test_obj
 $inst_id
 $mode

Detailed Description

Definition at line 34 of file class.ilTestExport.php.


Member Function Documentation

ilTestExport::buildExportFile (  ) 

build export file (complete zip file)

public

Returns:

Definition at line 88 of file class.ilTestExport.php.

References buildExportFileXML().

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

Here is the call graph for this function:

ilTestExport::buildExportFileXML (  ) 

build xml export file

Definition at line 101 of file class.ilTestExport.php.

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

Referenced by buildExportFile().

        {
                global $ilBench;

                $ilBench->start("TestExport", "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 ".
                        $this->test_obj->getId()." of installation ".$this->inst.".");

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

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

                // get Log File
                $expDir = $this->test_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->test_obj->to_xml());
                fclose($qti_file);

                // get xml content
                $ilBench->start("TestExport", "buildExportFile_getXML");
                $this->test_obj->exportPagesXML($this->xml, $this->inst_id,
                        $this->export_dir."/".$this->subdir, $expLog);
                $ilBench->stop("TestExport", "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("TestExport", "buildExportFile_dumpToFile");
                $this->xml->xmlDumpFile($this->export_dir."/".$this->subdir."/".$this->filename
                        , false);
                $ilBench->stop("TestExport", "buildExportFile_dumpToFile");

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

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

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

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

Here is the call graph for this function:

Here is the caller graph for this function:

ilTestExport::getInstId (  ) 

Definition at line 76 of file class.ilTestExport.php.

        {
                return $this->inst_id;
        }

ilTestExport::ilTestExport ( &$  a_test_obj,
a_mode = "xml" 
)

Constructor public.

Definition at line 47 of file class.ilTestExport.php.

References $ilErr, $ilias, and $settings.

        {
                global $ilErr, $ilDB, $ilias;

                $this->test_obj =& $a_test_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;

                $date = time();
                switch($this->mode)
                {
                        default:
                                $this->export_dir = $this->test_obj->getExportDirectory();
                                $this->subdir = $date."__".$this->inst_id."__".
                                        "test"."__".$this->test_obj->getId();
                                $this->filename = $this->subdir.".xml";
                                $this->qti_filename = $date."__".$this->inst_id."__".
                                        "qti"."__".$this->test_obj->getId().".xml";
                                break;
                }
        }


Field Documentation

ilTestExport::$db

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

ilTestExport::$err

Definition at line 36 of file class.ilTestExport.php.

ilTestExport::$ilias

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

Referenced by ilTestExport().

ilTestExport::$inst_id

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

ilTestExport::$mode

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

ilTestExport::$test_obj

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


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