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

Export class for content objects. More...

+ Collaboration diagram for ilContObjectExport:

Public Member Functions

 ilContObjectExport (&$a_cont_obj, $a_mode="xml", $a_lang="")
 Constructor @access public. More...
 
 getInstId ()
 
 buildExportFile ($a_master_only=false)
 build export file (complete zip file) More...
 
 buildExportFileXML ($a_master_only=false)
 build xml export file More...
 
 buildExportFilePDF ()
 build pdf offline file More...
 
 buildExportFileHTML ()
 build html package More...
 
 buildExportFileSCORM ()
 build scorm package More...
 

Data Fields

 $err
 
 $db
 
 $ilias
 
 $cont_obj
 
 $inst_id
 
 $mode
 

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
Databay AG ay@da.nosp@m.taba.nosp@m.y.de
Version
$Id$

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

Member Function Documentation

◆ buildExportFile()

ilContObjectExport::buildExportFile (   $a_master_only = false)

build export file (complete zip file)

@access public

Returns

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

92 {
93 switch ($this->mode)
94 {
95 case "html":
96 $this->buildExportFileHTML();
97 break;
98
99 case "scorm":
100 $this->buildExportFileSCORM();
101 break;
102
103 case "pdf":
104 $this->buildExportFilePDF();
105 break;
106
107 default:
108 return $this->buildExportFileXML($a_master_only);
109 break;
110 }
111 }
buildExportFileXML($a_master_only=false)
build xml export file
buildExportFilePDF()
build pdf offline file
buildExportFileSCORM()
build scorm package
buildExportFileHTML()
build html package

References buildExportFileHTML(), buildExportFilePDF(), buildExportFileSCORM(), and buildExportFileXML().

+ Here is the call graph for this function:

◆ buildExportFileHTML()

ilContObjectExport::buildExportFileHTML ( )

build html package

Definition at line 224 of file class.ilContObjectExport.php.

225 {
226 global $ilBench;
227
228 // create directories
229 if ($this->lang == "")
230 {
231 $this->cont_obj->createExportDirectory("html");
232 }
233 else
234 {
235 $this->cont_obj->createExportDirectory("html_".$this->lang);
236 }
237
238
239 // get html content
240 $this->cont_obj->exportHTML($this->export_dir."/".$this->subdir, $expLog, true, "html", $this->lang);
241 }
global $ilBench
Definition: ilias.php:18

References $ilBench.

Referenced by buildExportFile().

+ Here is the caller graph for this function:

◆ buildExportFilePDF()

ilContObjectExport::buildExportFilePDF ( )

build pdf offline file

Definition at line 216 of file class.ilContObjectExport.php.

217 {
218 die("deprecated.");
219 }

Referenced by buildExportFile().

+ Here is the caller graph for this function:

◆ buildExportFileSCORM()

ilContObjectExport::buildExportFileSCORM ( )

build scorm package

Definition at line 246 of file class.ilContObjectExport.php.

247 {
248 global $ilBench;
249
250 $ilBench->start("ContentObjectExport", "buildSCORMPackage");
251
252 // create directories
253 $this->cont_obj->createExportDirectory("scorm");
254
255 // get html content
256 $ilBench->start("ContentObjectExport", "buildSCORMPackage_getSCORM");
257 $this->cont_obj->exportSCORM($this->export_dir."/".$this->subdir, $expLog);
258 $ilBench->stop("ContentObjectExport", "buildSCORMPackage_getSCORM");
259
260 //$expLog->write(date("[y-m-d H:i:s] ")."Finished Export");
261 $ilBench->stop("ContentObjectExport", "buildSCORMPackage");
262 }

References $ilBench.

Referenced by buildExportFile().

+ Here is the caller graph for this function:

◆ buildExportFileXML()

ilContObjectExport::buildExportFileXML (   $a_master_only = false)

build xml export file

Definition at line 116 of file class.ilContObjectExport.php.

117 {
118 global $ilBench;
119
120 if ($a_master_only)
121 {
122 include_once("./Services/Export/classes/class.ilExport.php");
123 $exp = new ilExport();
124 $conf = $exp->getConfig("Modules/LearningModule");
125 $conf->setMasterLanguageOnly(true);
126 $exp->exportObject($this->cont_obj->getType(),$this->cont_obj->getId(), "5.1.0");
127 return;
128 }
129
130 $ilBench->start("ContentObjectExport", "buildExportFile");
131
132 require_once("./Services/Xml/classes/class.ilXmlWriter.php");
133
134 $this->xml = new ilXmlWriter;
135
136 // set dtd definition
137 $this->xml->xmlSetDtdDef("<!DOCTYPE ContentObject SYSTEM \"http://www.ilias.de/download/dtd/ilias_co_3_7.dtd\">");
138
139 // set generated comment
140 $this->xml->xmlSetGenCmt("Export of ILIAS Content Module ".
141 $this->cont_obj->getId()." of installation ".$this->inst.".");
142
143 // set xml header
144 $this->xml->xmlHeader();
145
146 // create directories
147 $this->cont_obj->createExportDirectory();
148 ilUtil::makeDir($this->export_dir."/".$this->subdir);
149 ilUtil::makeDir($this->export_dir."/".$this->subdir."/objects");
150
151 // get Log File
152 $expDir = $this->cont_obj->getExportDirectory();
153 include_once './Services/Logging/classes/class.ilLog.php';
154 $expLog = new ilLog($expDir, "export.log");
155 $expLog->delete();
156 $expLog->setLogFormat("");
157 $expLog->write(date("[y-m-d H:i:s] ")."Start Export");
158
159 // get xml content
160//echo "ContObjExport:".$this->inst_id.":<br>";
161 $ilBench->start("ContentObjectExport", "buildExportFile_getXML");
162 $this->cont_obj->exportXML($this->xml, $this->inst_id,
163 $this->export_dir."/".$this->subdir, $expLog);
164 $ilBench->stop("ContentObjectExport", "buildExportFile_getXML");
165
166 // export style
167 if ($this->cont_obj->getStyleSheetId() > 0)
168 {
169 include_once("./Services/Style/classes/class.ilObjStyleSheet.php");
170 $style_obj = new ilObjStyleSheet($this->cont_obj->getStyleSheetId(), false);
171 //$style_obj->exportXML($this->export_dir."/".$this->subdir);
172 $style_obj->setExportSubDir("style");
173 $style_file = $style_obj->export();
174 if (is_file($style_file))
175 {
176 copy($style_file, $this->export_dir."/".$this->subdir."/style.zip");
177 }
178 }
179
180 // dump xml document to screen (only for debugging reasons)
181 /*
182 echo "<PRE>";
183 echo htmlentities($this->xml->xmlDumpMem($format));
184 echo "</PRE>";
185 */
186
187 // dump xml document to file
188 $this->xml->xmlDumpFile($this->export_dir."/".$this->subdir."/".$this->filename
189 , false);
190
191 // help export (workaround to use ref id here)
193 {
194 include_once("./Services/Export/classes/class.ilExport.php");
195 $exp = new ilExport();
196 $exp->exportEntity("help", $this->cont_obj->getId(), "4.3.0", "Services/Help",
197 "OnlineHelp", $this->export_dir."/".$this->subdir);
198 }
199
200 // zip the file
201 ilUtil::zip($this->export_dir."/".$this->subdir,
202 $this->export_dir."/".$this->subdir.".zip");
203
204 // destroy writer object
205 $this->xml->_XmlWriter;
206
207 $expLog->write(date("[y-m-d H:i:s] ")."Finished Export");
208 $ilBench->stop("ContentObjectExport", "buildExportFile");
209
210 return $this->export_dir."/".$this->subdir.".zip";
211 }
$_GET["client_id"]
logging
Definition: class.ilLog.php:19
static isOnlineHelpModule($a_id, $a_as_obj_id=false)
Is module an online module.
Class ilObjStyleSheet.
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 $_GET, $ilBench, ilObjContentObject\isOnlineHelpModule(), 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()

ilContObjectExport::getInstId ( )

Definition at line 80 of file class.ilContObjectExport.php.

References $inst_id.

◆ ilContObjectExport()

ilContObjectExport::ilContObjectExport ( $a_cont_obj,
  $a_mode = "xml",
  $a_lang = "" 
)

Constructor @access public.

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

30 {
31 global $ilErr, $ilDB, $ilias;
32
33 $this->cont_obj = $a_cont_obj;
34
35 $this->err = $ilErr;
36 $this->db = $ilDB;
37 $this->mode = $a_mode;
38 $this->lang = $a_lang;
39
40 $this->inst_id = IL_INST_ID;
41
42 $date = time();
43 switch($this->mode)
44 {
45 case "html":
46 if ($this->lang == "")
47 {
48 $this->export_dir = $this->cont_obj->getExportDirectory("html");
49 }
50 else
51 {
52 $this->export_dir = $this->cont_obj->getExportDirectory("html_".$this->lang);
53 }
54 $this->subdir = $this->cont_obj->getType()."_".$this->cont_obj->getId();
55 $this->filename = $this->subdir.".zip";
56 break;
57
58 case "scorm":
59 $this->export_dir = $this->cont_obj->getExportDirectory("scorm");
60 $this->subdir = $this->cont_obj->getType()."_".$this->cont_obj->getId();
61 $this->filename = $this->subdir.".zip";
62 break;
63
64 case "pdf":
65 $this->export_dir = $this->cont_obj->getOfflineDirectory();
66 $this->subdir = $date."__".$this->inst_id."__".
67 $this->cont_obj->getType()."_".$this->cont_obj->getId();
68 $this->filename = $this->subdir.".fo";
69 break;
70
71 default:
72 $this->export_dir = $this->cont_obj->getExportDirectory();
73 $this->subdir = $date."__".$this->inst_id."__".
74 $this->cont_obj->getType()."_".$this->cont_obj->getId();
75 $this->filename = $this->subdir.".xml";
76 break;
77 }
78 }
global $ilDB

References $ilDB, $ilErr, and $ilias.

Field Documentation

◆ $cont_obj

ilContObjectExport::$cont_obj

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

◆ $db

ilContObjectExport::$db

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

◆ $err

ilContObjectExport::$err

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

◆ $ilias

ilContObjectExport::$ilias

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

Referenced by ilContObjectExport().

◆ $inst_id

ilContObjectExport::$inst_id

Definition at line 22 of file class.ilContObjectExport.php.

Referenced by getInstId().

◆ $mode

ilContObjectExport::$mode

Definition at line 23 of file class.ilContObjectExport.php.


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