ILIAS  release_4-4 Revision
All Data Structures Namespaces Files Functions Variables Modules Pages
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 public. More...
 
 getInstId ()
 
 buildExportFile ()
 build export file (complete zip file) More...
 
 buildExportFileXML ()
 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 ( )

build export file (complete zip file)

public

Returns

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

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

95  {
96  switch ($this->mode)
97  {
98  case "html":
99  $this->buildExportFileHTML();
100  break;
101 
102  case "scorm":
103  $this->buildExportFileSCORM();
104  break;
105 
106  case "pdf":
107  $this->buildExportFilePDF();
108  break;
109 
110  default:
111  return $this->buildExportFileXML();
112  break;
113  }
114  }
buildExportFileXML()
build xml export file
buildExportFilePDF()
build pdf offline file
buildExportFileHTML()
build html package
buildExportFileSCORM()
build scorm package
+ Here is the call graph for this function:

◆ buildExportFileHTML()

ilContObjectExport::buildExportFileHTML ( )

build html package

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

References $ilBench.

Referenced by buildExportFile().

217  {
218  global $ilBench;
219 
220  // create directories
221  if ($this->lang == "")
222  {
223  $this->cont_obj->createExportDirectory("html");
224  }
225  else
226  {
227  $this->cont_obj->createExportDirectory("html_".$this->lang);
228  }
229 
230 
231  // get html content
232  $this->cont_obj->exportHTML($this->export_dir."/".$this->subdir, $expLog, true, "html", $this->lang);
233  }
global $ilBench
Definition: ilias.php:18
+ Here is the caller graph for this function:

◆ buildExportFilePDF()

ilContObjectExport::buildExportFilePDF ( )

build pdf offline file

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

Referenced by buildExportFile().

209  {
210  die("deprecated.");
211  }
+ Here is the caller graph for this function:

◆ buildExportFileSCORM()

ilContObjectExport::buildExportFileSCORM ( )

build scorm package

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

References $ilBench.

Referenced by buildExportFile().

239  {
240  global $ilBench;
241 
242  $ilBench->start("ContentObjectExport", "buildSCORMPackage");
243 
244  // create directories
245  $this->cont_obj->createExportDirectory("scorm");
246 
247  // get html content
248  $ilBench->start("ContentObjectExport", "buildSCORMPackage_getSCORM");
249  $this->cont_obj->exportSCORM($this->export_dir."/".$this->subdir, $expLog);
250  $ilBench->stop("ContentObjectExport", "buildSCORMPackage_getSCORM");
251 
252  //$expLog->write(date("[y-m-d H:i:s] ")."Finished Export");
253  $ilBench->stop("ContentObjectExport", "buildSCORMPackage");
254  }
global $ilBench
Definition: ilias.php:18
+ Here is the caller graph for this function:

◆ buildExportFileXML()

ilContObjectExport::buildExportFileXML ( )

build xml export file

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

References $_GET, $ilBench, ilObjContentObject\isOnlineHelpModule(), ilUtil\makeDir(), ilObjStyleSheet\setExportSubDir(), ilXmlWriter\xmlSetDtdDef(), and ilUtil\zip().

Referenced by buildExportFile().

120  {
121  global $ilBench;
122 
123  $ilBench->start("ContentObjectExport", "buildExportFile");
124 
125  require_once("./Services/Xml/classes/class.ilXmlWriter.php");
126 
127  $this->xml = new ilXmlWriter;
128 
129  // set dtd definition
130  $this->xml->xmlSetDtdDef("<!DOCTYPE ContentObject SYSTEM \"http://www.ilias.de/download/dtd/ilias_co_3_7.dtd\">");
131 
132  // set generated comment
133  $this->xml->xmlSetGenCmt("Export of ILIAS Content Module ".
134  $this->cont_obj->getId()." of installation ".$this->inst.".");
135 
136  // set xml header
137  $this->xml->xmlHeader();
138 
139  // create directories
140  $this->cont_obj->createExportDirectory();
141  ilUtil::makeDir($this->export_dir."/".$this->subdir);
142  ilUtil::makeDir($this->export_dir."/".$this->subdir."/objects");
143 
144  // get Log File
145  $expDir = $this->cont_obj->getExportDirectory();
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 //echo "ContObjExport:".$this->inst_id.":<br>";
153  $ilBench->start("ContentObjectExport", "buildExportFile_getXML");
154  $this->cont_obj->exportXML($this->xml, $this->inst_id,
155  $this->export_dir."/".$this->subdir, $expLog);
156  $ilBench->stop("ContentObjectExport", "buildExportFile_getXML");
157 
158  // export style
159  if ($this->cont_obj->getStyleSheetId() > 0)
160  {
161  include_once("./Services/Style/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  {
168  copy($style_file, $this->export_dir."/".$this->subdir."/style.zip");
169  }
170  }
171 
172  // dump xml document to screen (only for debugging reasons)
173  /*
174  echo "<PRE>";
175  echo htmlentities($this->xml->xmlDumpMem($format));
176  echo "</PRE>";
177  */
178 
179  // dump xml document to file
180  $this->xml->xmlDumpFile($this->export_dir."/".$this->subdir."/".$this->filename
181  , false);
182 
183  // help export (workaround to use ref id here)
184  if (ilObjContentObject::isOnlineHelpModule((int) $_GET["ref_id"]))
185  {
186  include_once("./Services/Export/classes/class.ilExport.php");
187  $exp = new ilExport();
188  $exp->exportEntity("help", $this->cont_obj->getId(), "4.3.0", "Services/Help",
189  "OnlineHelp", $this->export_dir."/".$this->subdir);
190  }
191 
192  // zip the file
193  ilUtil::zip($this->export_dir."/".$this->subdir,
194  $this->export_dir."/".$this->subdir.".zip");
195 
196  // destroy writer object
197  $this->xml->_XmlWriter;
198 
199  $expLog->write(date("[y-m-d H:i:s] ")."Finished Export");
200  $ilBench->stop("ContentObjectExport", "buildExportFile");
201 
202  return $this->export_dir."/".$this->subdir.".zip";
203  }
xmlSetDtdDef($dtdDef)
Sets dtd definition.
$_GET["client_id"]
setExportSubDir($a_dir)
Set local directory, that will be included within the zip file.
XML writer class.
logging
Definition: class.ilLog.php:18
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 ...
static isOnlineHelpModule($a_id, $a_as_obj_id=false)
Is module an online module.
global $ilBench
Definition: ilias.php:18
Class ilObjStyleSheet.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getInstId()

ilContObjectExport::getInstId ( )

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

References $inst_id.

84  {
85  return $this->inst_id;
86  }

◆ ilContObjectExport()

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

Constructor public.

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

References $ilErr, and $ilias.

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

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: