Go to the documentation of this file.00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 include_once "./survey/classes/inc.SurveyConstants.php";
00025
00033 class ilSurveyExport
00034 {
00035 var $err;
00036 var $db;
00037 var $ilias;
00038 var $survey_obj;
00039 var $inst_id;
00040 var $mode;
00041
00046 function ilSurveyExport(&$a_survey_obj, $a_mode = "xml")
00047 {
00048 global $ilErr, $ilDB, $ilias;
00049
00050 $this->survey_obj =& $a_survey_obj;
00051
00052 $this->err =& $ilErr;
00053 $this->ilias =& $ilias;
00054 $this->db =& $ilDB;
00055 $this->mode = $a_mode;
00056
00057 $settings = $this->ilias->getAllSettings();
00058
00059 $this->inst_id = IL_INST_ID;
00060
00061 $date = time();
00062 switch($this->mode)
00063 {
00064 default:
00065 $this->export_dir = $this->survey_obj->getExportDirectory();
00066 $this->subdir = $date."__".$this->inst_id."__".
00067 "survey"."__".$this->survey_obj->getId();
00068 $this->filename = $this->subdir.".xml";
00069 break;
00070 }
00071 }
00072
00073 function getInstId()
00074 {
00075 return $this->inst_id;
00076 }
00077
00078
00085 function buildExportFile()
00086 {
00087 switch ($this->mode)
00088 {
00089 default:
00090 return $this->buildExportFileXML();
00091 break;
00092 }
00093 }
00094
00098 function buildExportFileXML()
00099 {
00100 global $ilBench;
00101
00102 $ilBench->start("SurveyExport", "buildExportFile");
00103
00104
00105 $this->survey_obj->createExportDirectory();
00106
00107
00108 $expDir = $this->survey_obj->getExportDirectory();
00109 include_once "./classes/class.ilLog.php";
00110 $expLog = new ilLog($expDir, "export.log");
00111 $expLog->delete();
00112 $expLog->setLogFormat("");
00113 $expLog->write(date("[y-m-d H:i:s] ")."Start Export");
00114
00115 $qti_file = fopen($expDir . "/" . $this->filename, "w");
00116 fwrite($qti_file, $this->survey_obj->to_xml());
00117 fclose($qti_file);
00118
00119
00120 $this->xml->_XmlWriter;
00121
00122 $expLog->write(date("[y-m-d H:i:s] ")."Finished Export");
00123 $ilBench->stop("SurveyExport", "buildExportFile");
00124
00125 return $this->filename;
00126 }
00127
00128
00129 }
00130
00131 ?>