ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
ilGlossaryExport Class Reference

Export class for content objects. More...

+ Collaboration diagram for ilGlossaryExport:

Public Member Functions

 ilGlossaryExport (&$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
 
 $ilias
 
 $glo_obj
 
 $inst_id
 

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
Version
$Id$

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

Member Function Documentation

◆ buildExportFile()

ilGlossaryExport::buildExportFile ( )

build export file (complete zip file)

@access public

Returns

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

94 {
95 switch ($this->mode)
96 {
97 case "html":
98 return $this->buildExportFileHTML();
99 break;
100
101 default:
102 return $this->buildExportFileXML();
103 break;
104 }
105 }
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 182 of file class.ilGlossaryExport.php.

183 {
184 global $ilBench;
185
186 // create directories
187 $this->glo_obj->createExportDirectory("html");
188
189 // get Log File
190 $expDir = $this->glo_obj->getExportDirectory();
191
192 // get xml content
193 $this->glo_obj->exportHTML($this->export_dir."/".$this->subdir, $expLog);
194 }
global $ilBench
Definition: ilias.php:18

References $ilBench.

Referenced by buildExportFile().

+ Here is the caller graph for this function:

◆ buildExportFileXML()

ilGlossaryExport::buildExportFileXML ( )

build export file (complete zip file)

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

111 {
112 global $ilBench;
113
114 $ilBench->start("GlossaryExport", "buildExportFile");
115
116 require_once("./Services/Xml/classes/class.ilXmlWriter.php");
117
118 $this->xml = new ilXmlWriter;
119
120 // set dtd definition
121 $this->xml->xmlSetDtdDef("<!DOCTYPE ContentObject SYSTEM \"http://www.ilias.uni-koeln.de/download/dtd/ilias_co_3_7.dtd\">");
122
123 // set generated comment
124 $this->xml->xmlSetGenCmt("Export of ILIAS Glossary ".
125 $this->glo_obj->getId()." of installation ".$this->inst.".");
126
127 // set xml header
128 $this->xml->xmlHeader();
129
130 // create directories
131 $this->glo_obj->createExportDirectory();
132 ilUtil::makeDir($this->export_dir."/".$this->subdir);
133 ilUtil::makeDir($this->export_dir."/".$this->subdir."/objects");
134
135 // get Log File
136 $expDir = $this->glo_obj->getExportDirectory();
137 include_once './Services/Logging/classes/class.ilLog.php';
138 $expLog = new ilLog($expDir, "export.log");
139 $expLog->delete();
140 $expLog->setLogFormat("");
141 $expLog->write(date("[y-m-d H:i:s] ")."Start Export");
142
143 // get xml content
144//echo "ContObjExport:".$this->inst_id.":<br>";
145 $ilBench->start("GlossaryExport", "buildExportFile_getXML");
146 $this->glo_obj->exportXML($this->xml, $this->inst_id,
147 $this->export_dir."/".$this->subdir, $expLog);
148 $ilBench->stop("GlossaryExport", "buildExportFile_getXML");
149
150 // dump xml document to screen (only for debugging reasons)
151 /*
152 echo "<PRE>";
153 echo htmlentities($this->xml->xmlDumpMem($format));
154 echo "</PRE>";
155 */
156
157
158 // dump xml document to file
159 $ilBench->start("GlossaryExport", "buildExportFile_dumpToFile");
160 $this->xml->xmlDumpFile($this->export_dir."/".$this->subdir."/".$this->filename
161 , false);
162 $ilBench->stop("GlossaryExport", "buildExportFile_dumpToFile");
163
164 // zip the file
165 $ilBench->start("GlossaryExport", "buildExportFile_zipFile");
166 ilUtil::zip($this->export_dir."/".$this->subdir,
167 $this->export_dir."/".$this->subdir.".zip");
168 $ilBench->stop("GlossaryExport", "buildExportFile_zipFile");
169
170 // destroy writer object
171 $this->xml->_XmlWriter;
172
173 $expLog->write(date("[y-m-d H:i:s] ")."Finished Export");
174 $ilBench->stop("GlossaryExport", "buildExportFile");
175
176 return $this->export_dir."/".$this->subdir.".zip";
177 }
logging
Definition: class.ilLog.php:19
static zip($a_dir, $a_file, $compress_content=false)
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 $ilBench, 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 82 of file class.ilGlossaryExport.php.

References $inst_id.

◆ ilGlossaryExport()

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

Constructor @access public.

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

48 {
49 global $ilErr, $ilDB, $ilias;
50
51 $this->glo_obj =& $a_glo_obj;
52
53 $this->err =& $ilErr;
54 $this->ilias =& $ilias;
55 $this->db =& $ilDB;
56 $this->mode = $a_mode;
57
58 $settings = $this->ilias->getAllSettings();
59 // The default '0' is required for the directory structure (smeyer)
60 $this->inst_id = $settings["inst_id"] ? $settings['inst_id'] : 0;
61
62 $date = time();
63 switch($this->mode)
64 {
65 case "xml":
66 $this->export_dir = $this->glo_obj->getExportDirectory();
67 $this->subdir = $date."__".$this->inst_id."__".
68 $this->glo_obj->getType()."_".$this->glo_obj->getId();
69 $this->filename = $this->subdir.".xml";
70 break;
71
72 case "html":
73 $this->export_dir = $this->glo_obj->getExportDirectory("html");
74 $this->subdir = $this->glo_obj->getType()."_".$this->glo_obj->getId();
75 $this->filename = $this->subdir.".zip";
76 break;
77
78 }
79
80 }
redirection script todo: (a better solution should control the processing via a xml file)
global $ilDB

References $ilDB, $ilErr, and $ilias.

Field Documentation

◆ $db

ilGlossaryExport::$db

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

◆ $err

ilGlossaryExport::$err

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

◆ $glo_obj

ilGlossaryExport::$glo_obj

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

◆ $ilias

ilGlossaryExport::$ilias

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

Referenced by ilGlossaryExport().

◆ $inst_id

ilGlossaryExport::$inst_id

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

Referenced by getInstId().


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