ILIAS  release_8 Revision v8.19-1-g4e8f2f9140c
All Data Structures Namespaces Files Functions Variables Modules Pages
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.

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

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: feed.php:28
+ 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.

References buildExportFileXML().

71  : string {
72  switch ($this->mode) {
73  default:
74  return $this->buildExportFileXML($questions);
75  }
76  }
buildExportFileXML(array $questions=null)
build xml export file
+ 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.

References ilLog\delete(), ilFileUtils\makeDir(), and ilFileUtils\zip().

Referenced by buildExportFile().

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  $expLog->write(date("[y-m-d H:i:s] ") . "Finished Export");
104 
105  return $this->export_dir . "/" . $this->subdir . ".zip";
106  }
delete()
delete logfile
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Definition: class.ilLog.php:30
static zip(string $a_dir, string $a_file, bool $compress_content=false)
zips given directory/file into given zip.file
static makeDir(string $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 60 of file class.ilSurveyQuestionpoolExport.php.

References $inst_id.

60  : int
61  {
62  return $this->inst_id;
63  }

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: