ILIAS  release_7 Revision v7.30-3-g800a261c036
ilSurveyQuestionpoolExport Class Reference

Export class for survey questionpools. More...

+ Collaboration diagram for ilSurveyQuestionpoolExport:

Public Member Functions

 __construct ($a_spl_obj, $a_mode="xml")
 Constructor @access 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 @access public.

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

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 }
const IL_INST_ID
Definition: constants.php:38
global $DIC
Definition: goto.php:24
global $ilDB

References $DIC, $ilDB, and IL_INST_ID.

Member Function Documentation

◆ buildExportFile()

ilSurveyQuestionpoolExport::buildExportFile (   $questions = null)

build export file (complete zip file)

@access public

Returns

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

79 {
80 switch ($this->mode) {
81 default:
82 return $this->buildExportFileXML($questions);
83 break;
84 }
85 }
buildExportFileXML($questions=null)
build xml export file

References buildExportFileXML().

+ 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.

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

References ilUtil\makeDir(), and ilUtil\zip().

Referenced by buildExportFile().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getInstId()

ilSurveyQuestionpoolExport::getInstId ( )

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: