ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f870
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 181 of file class.ilGlossaryExport.php.

182 {
183 global $ilBench;
184
185 // create directories
186 $this->glo_obj->createExportDirectory("html");
187
188 // get Log File
189 $expDir = $this->glo_obj->getExportDirectory();
190
191 // get xml content
192 $this->glo_obj->exportHTML($this->export_dir."/".$this->subdir, $expLog);
193 }
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 $expLog = new ilLog($expDir, "export.log");
138 $expLog->delete();
139 $expLog->setLogFormat("");
140 $expLog->write(date("[y-m-d H:i:s] ")."Start Export");
141
142 // get xml content
143//echo "ContObjExport:".$this->inst_id.":<br>";
144 $ilBench->start("GlossaryExport", "buildExportFile_getXML");
145 $this->glo_obj->exportXML($this->xml, $this->inst_id,
146 $this->export_dir."/".$this->subdir, $expLog);
147 $ilBench->stop("GlossaryExport", "buildExportFile_getXML");
148
149 // dump xml document to screen (only for debugging reasons)
150 /*
151 echo "<PRE>";
152 echo htmlentities($this->xml->xmlDumpMem($format));
153 echo "</PRE>";
154 */
155
156
157 // dump xml document to file
158 $ilBench->start("GlossaryExport", "buildExportFile_dumpToFile");
159 $this->xml->xmlDumpFile($this->export_dir."/".$this->subdir."/".$this->filename
160 , false);
161 $ilBench->stop("GlossaryExport", "buildExportFile_dumpToFile");
162
163 // zip the file
164 $ilBench->start("GlossaryExport", "buildExportFile_zipFile");
165 ilUtil::zip($this->export_dir."/".$this->subdir,
166 $this->export_dir."/".$this->subdir.".zip");
167 $ilBench->stop("GlossaryExport", "buildExportFile_zipFile");
168
169 // destroy writer object
170 $this->xml->_XmlWriter;
171
172 $expLog->write(date("[y-m-d H:i:s] ")."Finished Export");
173 $ilBench->stop("GlossaryExport", "buildExportFile");
174
175 return $this->export_dir."/".$this->subdir.".zip";
176 }
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: