ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ilContObjectExport Class Reference

Export class for content objects. More...

+ Collaboration diagram for ilContObjectExport:

Public Member Functions

 __construct (&$a_cont_obj, $a_mode="xml", $a_lang="")
 Constructor @access public. More...
 
 getInstId ()
 
 buildExportFile ($a_mode="")
 build export file (complete zip file) More...
 
 buildExportFileXML ($a_mode="")
 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
 
 $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.

Constructor & Destructor Documentation

◆ __construct()

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

Constructor @access public.

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

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

References $DIC, $ilDB, and $ilErr.

Member Function Documentation

◆ buildExportFile()

ilContObjectExport::buildExportFile (   $a_mode = "")

build export file (complete zip file)

@access public

Returns

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

90 {
91 switch ($this->mode) {
92 case "html":
93 $this->buildExportFileHTML();
94 break;
95
96 case "scorm":
97 $this->buildExportFileSCORM();
98 break;
99
100 case "pdf":
101 $this->buildExportFilePDF();
102 break;
103
104 default:
105 return $this->buildExportFileXML($a_mode);
106 break;
107 }
108 }
buildExportFileXML($a_mode="")
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 220 of file class.ilContObjectExport.php.

221 {
222 // create directories
223 if ($this->lang == "") {
224 $this->cont_obj->createExportDirectory("html");
225 } else {
226 $this->cont_obj->createExportDirectory("html_" . $this->lang);
227 }
228
229
230 // get html content
231 $this->cont_obj->exportHTML($this->export_dir . "/" . $this->subdir, $expLog, true, "html", $this->lang);
232 }

Referenced by buildExportFile().

+ Here is the caller graph for this function:

◆ buildExportFilePDF()

ilContObjectExport::buildExportFilePDF ( )

build pdf offline file

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

213 {
214 die("deprecated.");
215 }

Referenced by buildExportFile().

+ Here is the caller graph for this function:

◆ buildExportFileSCORM()

ilContObjectExport::buildExportFileSCORM ( )

build scorm package

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

238 {
239 // create directories
240 $this->cont_obj->createExportDirectory("scorm");
241
242 // get html content
243 $this->cont_obj->exportSCORM($this->export_dir . "/" . $this->subdir, $expLog);
244 }

Referenced by buildExportFile().

+ Here is the caller graph for this function:

◆ buildExportFileXML()

ilContObjectExport::buildExportFileXML (   $a_mode = "")

build xml export file

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

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

References $inst_id.

Field Documentation

◆ $cont_obj

ilContObjectExport::$cont_obj

Definition at line 20 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.

◆ $inst_id

ilContObjectExport::$inst_id

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

Referenced by getInstId().

◆ $mode

ilContObjectExport::$mode

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


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