Public Member Functions | |
| ilTestExport (&$a_test_obj, $a_mode="xml") | |
| Constructor public. | |
| getExtension () | |
| getInstId () | |
| buildExportFile () | |
| build export file (complete zip file) | |
| buildExportResultFile () | |
| build xml export file | |
| buildExportFileXML () | |
| build xml export file | |
Data Fields | |
| $err | |
| $db | |
| $ilias | |
| $test_obj | |
| $inst_id | |
| $mode | |
Definition at line 34 of file class.ilTestExport.php.
| ilTestExport::buildExportFile | ( | ) |
build export file (complete zip file)
public
Definition at line 102 of file class.ilTestExport.php.
References buildExportFileXML(), and buildExportResultFile().
{
switch ($this->mode)
{
case "results":
return $this->buildExportResultFile();
break;
default:
return $this->buildExportFileXML();
break;
}
}
Here is the call graph for this function:| ilTestExport::buildExportFileXML | ( | ) |
build xml export file
Definition at line 152 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::buildExportResultFile | ( | ) |
build xml export file
Definition at line 118 of file class.ilTestExport.php.
References $data, $file, $ilBench, $log, $row, and ilUtil::makeDir().
Referenced by buildExportFile().
{
global $ilBench;
global $log;
//get Log File
$expDir = $this->test_obj->getExportDirectory();
$expLog = &$log;
$expLog->delete();
$expLog->setLogFormat("");
$expLog->write(date("[y-m-d H:i:s] ")."Start Export Of Results");
// make_directories
$this->test_obj->createExportDirectory();
ilUtil::makeDir($this->export_dir);
//get data
$data = $this->test_obj->getAllTestResults();
$file = fopen($this->export_dir."/".$this->filename, "w");
foreach ($data as $row) {
fwrite($file, join (";",$row)."\n");
}
fclose($file);
// end
$expLog->write(date("[y-m-d H:i:s] ")."Finished Export of Results");
return $this->export_dir."/".$this->filename;
}
Here is the call graph for this function:
Here is the caller graph for this function:| ilTestExport::getExtension | ( | ) |
Definition at line 81 of file class.ilTestExport.php.
Referenced by ilTestExport().
{
switch ($this->mode) {
case "results":
return "csv"; break;
default:
return "xml"; break;
}
}
Here is the caller graph for this function:| ilTestExport::getInstId | ( | ) |
Definition at line 90 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, $settings, and getExtension().
{
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();
$this->export_dir = $this->test_obj->getExportDirectory();
switch($this->mode)
{
case "results":
$this->subdir = $date."__".$this->inst_id."__".
"test__results__".$this->test_obj->getId();
break;
default:
$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;
}
$this->filename = $this->subdir.".".$this->getExtension();
}
Here is the call graph for this function:| 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.
1.7.1