ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
ilSurveyQuestionpoolExport Class Reference

Export class for survey questionpools. More...

+ Collaboration diagram for ilSurveyQuestionpoolExport:

Public Member Functions

 __construct ($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

 $db
 
 $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.

Constructor & Destructor Documentation

◆ __construct()

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

Constructor public.

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

References $ilDB, and time.

43  {
44  global $ilDB;
45 
46  $this->spl_obj = $a_spl_obj;
47 
48  $this->db = $ilDB;
49  $this->mode = $a_mode;
50 
51  $this->inst_id = IL_INST_ID;
52 
53  $date = time();
54  switch($this->mode)
55  {
56  default:
57  $this->export_dir = $this->spl_obj->getExportDirectory();
58  $this->subdir = $date."__".$this->inst_id."__".
59  "spl"."_".$this->spl_obj->getId();
60  $this->filename = $this->subdir.".xml";
61  break;
62  }
63  }
global $ilDB
Add data(end) time
Method that wraps PHPs time in order to allow simulations with the workflow.

Member Function Documentation

◆ buildExportFile()

ilSurveyQuestionpoolExport::buildExportFile (   $questions = null)

build export file (complete zip file)

public

Returns

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

References buildExportFileXML().

78  {
79  switch ($this->mode)
80  {
81  default:
82  return $this->buildExportFileXML($questions);
83  break;
84  }
85  }
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 90 of file class.ilSurveyQuestionpoolExport.php.

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

Referenced by buildExportFile().

91  {
92  global $ilBench;
93 
94  $ilBench->start("SurveyQuestionpoolExport", "buildExportFile");
95 
96  // create directories
97  $this->spl_obj->createExportDirectory();
98  ilUtil::makeDir($this->export_dir."/".$this->subdir);
99 
100  // get Log File
101  include_once "./Services/Logging/classes/class.ilLog.php";
102  $expLog = new ilLog($this->spl_obj->getExportDirectory(), "export.log");
103  $expLog->delete();
104  $expLog->setLogFormat("");
105  $expLog->write(date("[y-m-d H:i:s] ")."Start Export");
106  // write qti file
107  $qti_file = fopen($this->export_dir."/".$this->subdir."/". $this->filename, "w");
108  fwrite($qti_file, $this->spl_obj->toXML($questions));
109  fclose($qti_file);
110  // destroy writer object
111  $this->xml->_XmlWriter;
112 
113  ilUtil::zip($this->export_dir."/".$this->subdir,
114  $this->export_dir."/".$this->subdir.".zip");
115 
116  $expLog->write(date("[y-m-d H:i:s] ")."Finished Export");
117  $ilBench->stop("SurveyQuestionpoolExport", "buildExportFile");
118 
119  return $this->export_dir."/".$this->subdir.".zip";
120  }
delete()
delete logfile
logging
Definition: class.ilLog.php:18
date( 'd-M-Y', $objPHPExcel->getProperties() ->getCreated())
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 65 of file class.ilSurveyQuestionpoolExport.php.

References $inst_id.

Field Documentation

◆ $db

ilSurveyQuestionpoolExport::$db

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

◆ $inst_id

ilSurveyQuestionpoolExport::$inst_id

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

Referenced by getInstId().

◆ $mode

ilSurveyQuestionpoolExport::$mode

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

◆ $spl_obj

ilSurveyQuestionpoolExport::$spl_obj

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


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