ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f870
ilSurveyQuestionpoolExport Class Reference

Export class for survey questionpools. More...

+ Collaboration diagram for ilSurveyQuestionpoolExport:

Public Member Functions

 ilSurveyQuestionpoolExport (&$a_spl_obj, $a_mode="xml")
 Constructor public. More...
 
 getInstId ()
 
 buildExportFile ($questions=null)
 build export file (complete zip file) More...
 
 buildExportFileXML ($questions=null)
 build xml export file More...
 

Data Fields

 $err
 
 $db
 
 $ilias
 
 $spl_obj
 
 $inst_id
 
 $mode
 

Detailed Description

Export class for survey questionpools.

Author
Helmut Schottmüller helmu.nosp@m.t.sc.nosp@m.hottm.nosp@m.uell.nosp@m.er@ma.nosp@m.c.co.nosp@m.m
Version
$Id$

Definition at line 31 of file class.ilSurveyQuestionpoolExport.php.

Member Function Documentation

◆ buildExportFile()

ilSurveyQuestionpoolExport::buildExportFile (   $questions = null)

build export file (complete zip file)

public

Returns

Definition at line 82 of file class.ilSurveyQuestionpoolExport.php.

References buildExportFileXML().

83  {
84  switch ($this->mode)
85  {
86  default:
87  return $this->buildExportFileXML($questions);
88  break;
89  }
90  }
buildExportFileXML($questions=null)
build xml export file
+ Here is the call graph for this function:

◆ buildExportFileXML()

ilSurveyQuestionpoolExport::buildExportFileXML (   $questions = null)

build xml export file

Definition at line 95 of file class.ilSurveyQuestionpoolExport.php.

References $ilBench, ilLog\delete(), ilUtil\makeDir(), and ilUtil\zip().

Referenced by buildExportFile().

96  {
97  global $ilBench;
98 
99  $ilBench->start("SurveyQuestionpoolExport", "buildExportFile");
100 
101  // create directories
102  $this->spl_obj->createExportDirectory();
103  include_once "./Services/Utilities/classes/class.ilUtil.php";
104  ilUtil::makeDir($this->export_dir."/".$this->subdir);
105 
106  // get Log File
107  include_once "./Services/Logging/classes/class.ilLog.php";
108  $expLog = new ilLog($this->spl_obj->getExportDirectory(), "export.log");
109  $expLog->delete();
110  $expLog->setLogFormat("");
111  $expLog->write(date("[y-m-d H:i:s] ")."Start Export");
112  // write qti file
113  $qti_file = fopen($this->export_dir."/".$this->subdir."/". $this->filename, "w");
114  fwrite($qti_file, $this->spl_obj->toXML($questions));
115  fclose($qti_file);
116  // destroy writer object
117  $this->xml->_XmlWriter;
118 
119  ilUtil::zip($this->export_dir."/".$this->subdir,
120  $this->export_dir."/".$this->subdir.".zip");
121 
122  $expLog->write(date("[y-m-d H:i:s] ")."Finished Export");
123  $ilBench->stop("SurveyQuestionpoolExport", "buildExportFile");
124 
125  return $this->export_dir."/".$this->subdir.".zip";
126  }
delete()
delete logfile
logging
Definition: class.ilLog.php:18
static zip($a_dir, $a_file, $compress_content=false)
zips given directory/file into given zip.file
static makeDir($a_dir)
creates a new directory and inherits all filesystem permissions of the parent directory You may pass ...
global $ilBench
Definition: ilias.php:18
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getInstId()

ilSurveyQuestionpoolExport::getInstId ( )

Definition at line 70 of file class.ilSurveyQuestionpoolExport.php.

References $inst_id.

◆ ilSurveyQuestionpoolExport()

ilSurveyQuestionpoolExport::ilSurveyQuestionpoolExport ( $a_spl_obj,
  $a_mode = "xml" 
)

Constructor public.

Definition at line 44 of file class.ilSurveyQuestionpoolExport.php.

References $ilDB, $ilErr, and $ilias.

45  {
46  global $ilErr, $ilDB, $ilias;
47 
48  $this->spl_obj =& $a_spl_obj;
49 
50  $this->err =& $ilErr;
51  $this->ilias =& $ilias;
52  $this->db =& $ilDB;
53  $this->mode = $a_mode;
54 
55  $settings = $this->ilias->getAllSettings();
56  $this->inst_id = IL_INST_ID;
57 
58  $date = time();
59  switch($this->mode)
60  {
61  default:
62  $this->export_dir = $this->spl_obj->getExportDirectory();
63  $this->subdir = $date."__".$this->inst_id."__".
64  "spl"."_".$this->spl_obj->getId();
65  $this->filename = $this->subdir.".xml";
66  break;
67  }
68  }
redirection script todo: (a better solution should control the processing via a xml file) ...
global $ilDB

Field Documentation

◆ $db

ilSurveyQuestionpoolExport::$db

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

◆ $err

ilSurveyQuestionpoolExport::$err

Definition at line 33 of file class.ilSurveyQuestionpoolExport.php.

◆ $ilias

ilSurveyQuestionpoolExport::$ilias

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

Referenced by ilSurveyQuestionpoolExport().

◆ $inst_id

ilSurveyQuestionpoolExport::$inst_id

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

Referenced by getInstId().

◆ $mode

ilSurveyQuestionpoolExport::$mode

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

◆ $spl_obj

ilSurveyQuestionpoolExport::$spl_obj

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


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