ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilSurveyQuestionpoolExport Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

+ Collaboration diagram for ilSurveyQuestionpoolExport:

Public Member Functions

 __construct (ilObjSurveyQuestionPool $a_spl_obj, string $a_mode="xml")
 
 getInstId ()
 
 buildExportFile (?array $questions=null)
 build export file (complete zip file) More...
 
 buildExportFileXML (?array $questions=null)
 build xml export file More...
 

Data Fields

ilDBInterface $db
 
ilObjSurveyQuestionPool $spl_obj
 
int $inst_id
 
string $mode
 

Protected Attributes

string $subdir
 
string $filename
 
string $export_dir
 

Detailed Description

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning 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

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

Constructor & Destructor Documentation

◆ __construct()

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

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

37 {
38 global $DIC;
39
40 $ilDB = $DIC->database();
41
42 $this->spl_obj = $a_spl_obj;
43
44 $this->db = $ilDB;
45 $this->mode = $a_mode;
46
47 $this->inst_id = (int) IL_INST_ID;
48
49 $date = time();
50 switch ($this->mode) {
51 default:
52 $this->export_dir = $this->spl_obj->getExportDirectory();
53 $this->subdir = $date . "__" . $this->inst_id . "__" .
54 "spl" . "_" . $this->spl_obj->getId();
55 $this->filename = $this->subdir . ".xml";
56 break;
57 }
58 }
const IL_INST_ID
Definition: constants.php:40
global $DIC
Definition: shib_login.php:26

References $DIC, $ilDB, IL_INST_ID, and ILIAS\Repository\int().

+ Here is the call graph for this function:

Member Function Documentation

◆ buildExportFile()

ilSurveyQuestionpoolExport::buildExportFile ( ?array  $questions = null)

build export file (complete zip file)

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

71 : string {
72 switch ($this->mode) {
73 default:
74 return $this->buildExportFileXML($questions);
75 }
76 }
buildExportFileXML(?array $questions=null)
build xml export file

References buildExportFileXML().

+ Here is the call graph for this function:

◆ buildExportFileXML()

ilSurveyQuestionpoolExport::buildExportFileXML ( ?array  $questions = null)

build xml export file

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

83 : string {
84 // create directories
85 $this->spl_obj->createExportDirectory();
86 ilFileUtils::makeDir($this->export_dir . "/" . $this->subdir);
87
88 // get Log File
89 $expLog = new ilLog($this->spl_obj->getExportDirectory(), "export.log");
90 $expLog->delete();
91 $expLog->setLogFormat("");
92 $expLog->write(date("[y-m-d H:i:s] ") . "Start Export");
93 // write qti file
94 $qti_file = fopen($this->export_dir . "/" . $this->subdir . "/" . $this->filename, 'wb');
95 fwrite($qti_file, $this->spl_obj->toXML($questions));
96 fclose($qti_file);
97
99 $this->export_dir . "/" . $this->subdir,
100 $this->export_dir . "/" . $this->subdir . ".zip"
101 );
102
103 // remove created files
104 unlink($this->export_dir . "/" . $this->subdir . "/" . $this->filename);
105 rmdir($this->export_dir . "/" . $this->subdir);
106
107 $expLog->write(date("[y-m-d H:i:s] ") . "Finished Export");
108
109 return $this->export_dir . "/" . $this->subdir . ".zip";
110 }
static zip(string $a_dir, string $a_file, bool $compress_content=false)
static makeDir(string $a_dir)
creates a new directory and inherits all filesystem permissions of the parent directory You may pass ...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Definition: class.ilLog.php:31

Referenced by buildExportFile().

+ Here is the caller graph for this function:

◆ getInstId()

ilSurveyQuestionpoolExport::getInstId ( )

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

References $inst_id.

Field Documentation

◆ $db

ilDBInterface ilSurveyQuestionpoolExport::$db

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

◆ $export_dir

string ilSurveyQuestionpoolExport::$export_dir
protected

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

◆ $filename

string ilSurveyQuestionpoolExport::$filename
protected

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

◆ $inst_id

int ilSurveyQuestionpoolExport::$inst_id

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

Referenced by getInstId().

◆ $mode

string ilSurveyQuestionpoolExport::$mode

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

◆ $spl_obj

ilObjSurveyQuestionPool ilSurveyQuestionpoolExport::$spl_obj

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

◆ $subdir

string ilSurveyQuestionpoolExport::$subdir
protected

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


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