ILIAS  release_8 Revision v8.24
ilGlossaryExport 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 ilGlossaryExport:

Public Member Functions

 __construct (ilObjGlossary $a_glo_obj, string $a_mode="xml")
 
 getInstId ()
 
 buildExportFile ()
 build export file (complete zip file) More...
 
 buildExportFileXML ()
 build export file (complete zip file) More...
 
 buildExportFileHTML ()
 build html export file More...
 

Data Fields

ilDBInterface $db
 
ilObjGlossary $glo_obj
 
int $inst_id
 

Protected Attributes

ilXmlWriter $xml
 
string $export_dir
 
string $filename
 
string $subdir
 
string $mode
 
ilSetting $settings
 

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 content objects

Author
Alexander Killing killi.nosp@m.ng@l.nosp@m.eifos.nosp@m..de

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

Constructor & Destructor Documentation

◆ __construct()

ilGlossaryExport::__construct ( ilObjGlossary  $a_glo_obj,
string  $a_mode = "xml" 
)

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

39 {
40 global $DIC;
41
42 $this->settings = $DIC->settings();
43 $ilDB = $DIC->database();
44 $ilSetting = $DIC->settings();
45 $this->glo_obj = $a_glo_obj;
46 $this->db = $ilDB;
47 $this->mode = $a_mode;
48
49 $settings = $ilSetting->getAll();
50 // The default '0' is required for the directory structure (smeyer)
51 $this->inst_id = $settings["inst_id"] ? $settings['inst_id'] : 0;
52
53 $date = time();
54 switch ($this->mode) {
55 case "xml":
56 $this->export_dir = $this->glo_obj->getExportDirectory();
57 $this->subdir = $date . "__" . $this->inst_id . "__" .
58 $this->glo_obj->getType() . "_" . $this->glo_obj->getId();
59 $this->filename = $this->subdir . ".xml";
60 break;
61
62 case "html":
63 $this->export_dir = $this->glo_obj->getExportDirectory("html");
64 $this->subdir = $this->glo_obj->getType() . "_" . $this->glo_obj->getId();
65 $this->filename = $this->subdir . ".zip";
66 break;
67
68 }
69 }
global $DIC
Definition: feed.php:28
global $ilSetting
Definition: privfeed.php:17

References $DIC, $ilDB, $ilSetting, $settings, and ILIAS\Repository\settings().

+ Here is the call graph for this function:

Member Function Documentation

◆ buildExportFile()

ilGlossaryExport::buildExportFile ( )

build export file (complete zip file)

Definition at line 79 of file class.ilGlossaryExport.php.

79 : string
80 {
81 switch ($this->mode) {
82 case "html":
83 return $this->buildExportFileHTML();
84
85 default:
86 return $this->buildExportFileXML();
87 }
88 }
buildExportFileHTML()
build html export file
buildExportFileXML()
build export file (complete zip file)

References buildExportFileHTML(), and buildExportFileXML().

+ Here is the call graph for this function:

◆ buildExportFileHTML()

ilGlossaryExport::buildExportFileHTML ( )

build html export file

Definition at line 146 of file class.ilGlossaryExport.php.

146 : string
147 {
148 // create directories
149 $this->glo_obj->createExportDirectory("html");
150
151 // get html content
152 $exp = new \ILIAS\Glossary\Export\GlossaryHtmlExport(
153 $this->glo_obj,
154 $this->export_dir,
155 $this->subdir
156 );
157 return $exp->exportHTML();
158 }

Referenced by buildExportFile().

+ Here is the caller graph for this function:

◆ buildExportFileXML()

ilGlossaryExport::buildExportFileXML ( )

build export file (complete zip file)

Definition at line 93 of file class.ilGlossaryExport.php.

93 : string
94 {
95 $this->xml = new ilXmlWriter();
96
97 // set dtd definition
98 $this->xml->xmlSetDtdDef("<!DOCTYPE ContentObject SYSTEM \"https://www.ilias.uni-koeln.de/download/dtd/ilias_co_3_7.dtd\">");
99
100 // set generated comment
101 $this->xml->xmlSetGenCmt("Export of ILIAS Glossary " .
102 $this->glo_obj->getId() . " of installation " . $this->inst_id . ".");
103
104 // set xml header
105 $this->xml->xmlHeader();
106
107 // create directories
108 $this->glo_obj->createExportDirectory();
109 ilFileUtils::makeDir($this->export_dir . "/" . $this->subdir);
110 ilFileUtils::makeDir($this->export_dir . "/" . $this->subdir . "/objects");
111
112 // get Log File
113 $expDir = $this->glo_obj->getExportDirectory();
114 $expLog = new ilLog($expDir, "export.log");
115 $expLog->delete();
116 $expLog->setLogFormat("");
117 $expLog->write(date("[y-m-d H:i:s] ") . "Start Export");
118
119 // get xml content
120 $this->glo_obj->exportXML(
121 $this->xml,
122 $this->inst_id,
123 $this->export_dir . "/" . $this->subdir,
124 $expLog
125 );
126
127
128
129 // dump xml document to file
130 $this->xml->xmlDumpFile($this->export_dir . "/" . $this->subdir . "/" . $this->filename, false);
131
132 // zip the file
134 $this->export_dir . "/" . $this->subdir,
135 $this->export_dir . "/" . $this->subdir . ".zip"
136 );
137
138 $expLog->write(date("[y-m-d H:i:s] ") . "Finished Export");
139
140 return $this->export_dir . "/" . $this->subdir . ".zip";
141 }
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 ...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Definition: class.ilLog.php:31
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

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

Referenced by buildExportFile().

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

◆ getInstId()

ilGlossaryExport::getInstId ( )

Definition at line 71 of file class.ilGlossaryExport.php.

71 : int
72 {
73 return $this->inst_id;
74 }

References $inst_id.

Field Documentation

◆ $db

ilDBInterface ilGlossaryExport::$db

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

◆ $export_dir

string ilGlossaryExport::$export_dir
protected

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

◆ $filename

string ilGlossaryExport::$filename
protected

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

◆ $glo_obj

ilObjGlossary ilGlossaryExport::$glo_obj

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

◆ $inst_id

int ilGlossaryExport::$inst_id

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

Referenced by getInstId().

◆ $mode

string ilGlossaryExport::$mode
protected

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

◆ $settings

ilSetting ilGlossaryExport::$settings
protected

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

Referenced by __construct().

◆ $subdir

string ilGlossaryExport::$subdir
protected

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

◆ $xml

ilXmlWriter ilGlossaryExport::$xml
protected

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


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