36 $this->export_types = array(
"SCORM 2004 3rd",
"SCORM 2004 4th",
"SCORM 1.2",
"HTML",
"ISO",
"PDF",
39 if(!in_array($a_mode,$this->export_types))
40 die(
"Unsupported format");
42 $this->cont_obj =& $a_cont_obj;
47 $this->mode = $a_mode;
49 $settings = $this->ilias->getAllSettings();
51 $this->inst_id = IL_INST_ID;
53 switch ($this->cont_obj->getType())
56 $this->module_id = $this->cont_obj->getId();
57 $this->cont_obj_id = $this->cont_obj->getId();
60 $this->module_id = $this->cont_obj->slm_id;
61 $this->cont_obj_id = $this->cont_obj->getId();
86 case "SCORM 2004 3rd":
87 return $ret.
"_scorm2004";
88 case "SCORM 2004 4th":
89 return $ret.
"_scorm2004_4th";
93 return $ret.
"_html_one";
95 return $ret.
"_scorm12";
102 return $this->date.
"__".$this->inst_id.
"__".$this->cont_obj->getType().
"_".
$this->cont_obj_id;
110 return $this->subdir.
".iso";
112 return $this->subdir.
".pdf";
114 return $this->subdir.
".zip";
138 case "SCORM 2004 3rd":
140 case "SCORM 2004 4th":
162 $ilBench->start(
"ContentObjectExport",
"buildExportFile");
164 require_once(
"./Services/Xml/classes/class.ilXmlWriter.php");
172 $expLog =
new ilLog($expDir,
"export.log");
174 $expLog->setLogFormat(
"");
175 $expLog->write(date(
"[y-m-d H:i:s] ").
"Start Export");
179 $ilBench->start(
"ContentObjectExport",
"buildExportFile_getXML");
180 $this->cont_obj->exportScorm($this->inst_id, $this->export_dir.
"/".$this->subdir, $ver, $expLog);
181 $ilBench->stop(
"ContentObjectExport",
"buildExportFile_getXML");
184 $ilBench->start(
"ContentObjectExport",
"buildExportFile_zipFile");
185 ilUtil::zip($this->export_dir.
"/".$this->subdir, $this->export_dir.
"/".$this->subdir.
".zip",
true);
186 $ilBench->stop(
"ContentObjectExport",
"buildExportFile_zipFile");
190 $expLog->write(date(
"[y-m-d H:i:s] ").
"Finished Export");
191 $ilBench->stop(
"ContentObjectExport",
"buildExportFile");
193 return $this->export_dir.
"/".$this->subdir.
".zip";
201 require_once(
"./Services/Xml/classes/class.ilXmlWriter.php");
209 $expLog =
new ilLog($expDir,
"export.log");
211 $expLog->setLogFormat(
"");
212 $expLog->write(date(
"[y-m-d H:i:s] ").
"Start Export");
215 $this->cont_obj->exportHTML($this->inst_id, $this->export_dir.
"/".$this->subdir, $expLog);
218 ilUtil::zip($this->export_dir.
"/".$this->subdir, $this->export_dir.
"/".$this->subdir.
".zip",
true);
222 $expLog->write(date(
"[y-m-d H:i:s] ").
"Finished Export");
224 return $this->export_dir.
"/".$this->subdir.
".zip";
232 require_once(
"./Services/Xml/classes/class.ilXmlWriter.php");
240 $expLog =
new ilLog($expDir,
"export.log");
242 $expLog->setLogFormat(
"");
243 $expLog->write(date(
"[y-m-d H:i:s] ").
"Start Export");
246 $this->cont_obj->exportHTMLOne($this->inst_id, $this->export_dir.
"/".$this->subdir, $expLog);
249 ilUtil::zip($this->export_dir.
"/".$this->subdir, $this->export_dir.
"/".$this->subdir.
".zip",
true);
253 $expLog->write(date(
"[y-m-d H:i:s] ").
"Finished Export");
255 return $this->export_dir.
"/".$this->subdir.
".zip";
262 $ilBench->start(
"ContentObjectExport",
"buildExportFile");
264 require_once(
"./Services/Xml/classes/class.ilXmlWriter.php");
272 $expLog =
new ilLog($expDir,
"export.log");
274 $expLog->setLogFormat(
"");
275 $expLog->write(date(
"[y-m-d H:i:s] ").
"Start Export");
279 $ilBench->start(
"ContentObjectExport",
"buildExportFile_getXML");
280 $this->cont_obj->exportHTML($this->inst_id, $this->export_dir.
"/".$this->subdir, $expLog);
281 $ilBench->stop(
"ContentObjectExport",
"buildExportFile_getXML");
284 $ilBench->start(
"ContentObjectExport",
"buildExportFile_zipFile");
287 $result = $this->export_dir.
"/".$this->subdir.
".iso";
289 $ilBench->stop(
"ContentObjectExport",
"buildExportFile_zipFile");
293 $expLog->write(date(
"[y-m-d H:i:s] ").
"Finished Export");
294 $ilBench->stop(
"ContentObjectExport",
"buildExportFile");
310 $ilBench->start(
"ContentObjectExport",
"buildExportFile");
312 require_once(
"./Services/Xml/classes/class.ilXmlWriter.php");
320 $expLog =
new ilLog($expDir,
"export.log");
322 $expLog->setLogFormat(
"");
323 $expLog->write(date(
"[y-m-d H:i:s] ").
"Start Export");
325 $ilBench->start(
"ContentObjectExport",
"buildExportFile_getXML");
326 $fo_string = $this->cont_obj->exportPDF($this->inst_id, $this->export_dir.
"/".$this->subdir, $expLog);
328 $ilBench->stop(
"ContentObjectExport",
"buildExportFile_getXML");
330 $ilBench->start(
"ContentObjectExport",
"buildExportFile_pdfFile");
331 fputs(fopen($this->export_dir.
"/".$this->subdir.
'/temp.fo',
'w+'),$fo_string);
334 include_once
'./Services/WebServices/RPC/classes/class.ilRpcClientFactory.php';
339 fputs(fopen($this->export_dir.
'/'.$this->subdir.
'.pdf',
'w+'),$pdf_base64->scalar);
351 $ilBench->stop(
"ContentObjectExport",
"buildExportFile_pdfFile");
355 $expLog->write(date(
"[y-m-d H:i:s] ").
"Finished Export");
356 $ilBench->stop(
"ContentObjectExport",
"buildExportFile");
358 return $this->export_dir.
"/".$this->subdir.
".pdf";
364 if(!is_writable($lm_data_dir))
366 $this->ilias->raiseError(
"Content object Data Directory (".$lm_data_dir.
") not writeable.",$this->ilias->error_obj->FATAL);
371 if(!@is_dir($lm_dir))
373 $this->ilias->raiseError(
"Creation of Learning Module Directory failed.",$this->ilias->error_obj->FATAL);
379 if(!@is_dir($this->export_dir))
381 $this->ilias->raiseError(
"Creation of Export Directory failed.",$this->ilias->error_obj->FATAL);