ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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 $DIC, $ilDB, and time.

43  {
44  global $DIC;
45 
46  $ilDB = $DIC->database();
47 
48  $this->spl_obj = $a_spl_obj;
49 
50  $this->db = $ilDB;
51  $this->mode = $a_mode;
52 
53  $this->inst_id = IL_INST_ID;
54 
55  $date = time();
56  switch ($this->mode) {
57  default:
58  $this->export_dir = $this->spl_obj->getExportDirectory();
59  $this->subdir = $date . "__" . $this->inst_id . "__" .
60  "spl" . "_" . $this->spl_obj->getId();
61  $this->filename = $this->subdir . ".xml";
62  break;
63  }
64  }
global $DIC
Definition: saml.php:7
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 78 of file class.ilSurveyQuestionpoolExport.php.

References buildExportFileXML().

79  {
80  switch ($this->mode) {
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 date, ilLog\delete(), ilUtil\makeDir(), and ilUtil\zip().

Referenced by buildExportFile().

91  {
92  // create directories
93  $this->spl_obj->createExportDirectory();
94  ilUtil::makeDir($this->export_dir . "/" . $this->subdir);
95 
96  // get Log File
97  include_once "./Services/Logging/classes/class.ilLog.php";
98  $expLog = new ilLog($this->spl_obj->getExportDirectory(), "export.log");
99  $expLog->delete();
100  $expLog->setLogFormat("");
101  $expLog->write(date("[y-m-d H:i:s] ") . "Start Export");
102  // write qti file
103  $qti_file = fopen($this->export_dir . "/" . $this->subdir . "/" . $this->filename, "w");
104  fwrite($qti_file, $this->spl_obj->toXML($questions));
105  fclose($qti_file);
106  // destroy writer object
107  $this->xml->_XmlWriter;
108 
109  ilUtil::zip(
110  $this->export_dir . "/" . $this->subdir,
111  $this->export_dir . "/" . $this->subdir . ".zip"
112  );
113 
114  $expLog->write(date("[y-m-d H:i:s] ") . "Finished Export");
115 
116  return $this->export_dir . "/" . $this->subdir . ".zip";
117  }
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 ...
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getInstId()

ilSurveyQuestionpoolExport::getInstId ( )

Definition at line 66 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: