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

Export class for content objects. More...

+ Collaboration diagram for ilGlossaryExport:

Public Member Functions

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

 $err
 
 $db
 
 $glo_obj
 
 $inst_id
 

Protected Attributes

 $settings
 

Detailed Description

Export class for content objects.

Author
Alex Killing alex..nosp@m.kill.nosp@m.ing@g.nosp@m.mx.d.nosp@m.e

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

Constructor & Destructor Documentation

◆ __construct()

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

Constructor @access public.

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

28 {
29 global $DIC;
30
31 $this->settings = $DIC->settings();
32 $ilErr = $DIC["ilErr"];
33 $ilDB = $DIC->database();
34 $ilSetting = $DIC->settings();
35
36 $this->glo_obj = $a_glo_obj;
37
38 $this->err = $ilErr;
39 $this->db = $ilDB;
40 $this->mode = $a_mode;
41
42 $settings = $ilSetting->getAll();
43 // The default '0' is required for the directory structure (smeyer)
44 $this->inst_id = $settings["inst_id"] ? $settings['inst_id'] : 0;
45
46 $date = time();
47 switch ($this->mode) {
48 case "xml":
49 $this->export_dir = $this->glo_obj->getExportDirectory();
50 $this->subdir = $date . "__" . $this->inst_id . "__" .
51 $this->glo_obj->getType() . "_" . $this->glo_obj->getId();
52 $this->filename = $this->subdir . ".xml";
53 break;
54
55 case "html":
56 $this->export_dir = $this->glo_obj->getExportDirectory("html");
57 $this->subdir = $this->glo_obj->getType() . "_" . $this->glo_obj->getId();
58 $this->filename = $this->subdir . ".zip";
59 break;
60
61 }
62 }
global $DIC
Definition: goto.php:24
global $ilSetting
Definition: privfeed.php:17
$ilErr
Definition: raiseError.php:18
settings()
Definition: settings.php:2
global $ilDB

References $DIC, $ilDB, $ilErr, $ilSetting, $settings, and settings().

+ Here is the call graph for this function:

Member Function Documentation

◆ buildExportFile()

ilGlossaryExport::buildExportFile ( )

build export file (complete zip file)

@access public

Returns

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

76 {
77 switch ($this->mode) {
78 case "html":
79 return $this->buildExportFileHTML();
80 break;
81
82 default:
83 return $this->buildExportFileXML();
84 break;
85 }
86 }
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 147 of file class.ilGlossaryExport.php.

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

Referenced by buildExportFile().

+ Here is the caller graph for this function:

◆ buildExportFileXML()

ilGlossaryExport::buildExportFileXML ( )

build export file (complete zip file)

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

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

References ilUtil\makeDir(), ilXmlWriter\xmlSetDtdDef(), and ilUtil\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 64 of file class.ilGlossaryExport.php.

References $inst_id.

Field Documentation

◆ $db

ilGlossaryExport::$db

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

◆ $err

ilGlossaryExport::$err

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

◆ $glo_obj

ilGlossaryExport::$glo_obj

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

◆ $inst_id

ilGlossaryExport::$inst_id

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

Referenced by getInstId().

◆ $settings

ilGlossaryExport::$settings
protected

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

Referenced by __construct().


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