ILIAS  Release_4_4_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups 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.
 getInstId ()
 buildExportFile ()
 build export file (complete zip file)
 buildExportFileXML ()
 build xml export file
 buildExportFilePDF ()
 build pdf offline file
 buildExportFileHTML ()
 build html package
 buildExportFileSCORM ()
 build scorm package

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:
class.ilContObjectExport.php 47755 2014-02-07 09:18:53Z akill

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

Member Function Documentation

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().

{
switch ($this->mode)
{
case "html":
break;
case "scorm":
break;
case "pdf":
break;
default:
return $this->buildExportFileXML();
break;
}
}

+ Here is the call graph for this function:

ilContObjectExport::buildExportFileHTML ( )

build html package

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

References $ilBench.

Referenced by buildExportFile().

{
global $ilBench;
// create directories
if ($this->lang == "")
{
$this->cont_obj->createExportDirectory("html");
}
else
{
$this->cont_obj->createExportDirectory("html_".$this->lang);
}
// get html content
$this->cont_obj->exportHTML($this->export_dir."/".$this->subdir, $expLog, true, "html", $this->lang);
}

+ Here is the caller graph for this function:

ilContObjectExport::buildExportFilePDF ( )

build pdf offline file

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

Referenced by buildExportFile().

{
die("deprecated.");
}

+ Here is the caller graph for this function:

ilContObjectExport::buildExportFileSCORM ( )

build scorm package

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

References $ilBench.

Referenced by buildExportFile().

{
global $ilBench;
$ilBench->start("ContentObjectExport", "buildSCORMPackage");
// create directories
$this->cont_obj->createExportDirectory("scorm");
// get html content
$ilBench->start("ContentObjectExport", "buildSCORMPackage_getSCORM");
$this->cont_obj->exportSCORM($this->export_dir."/".$this->subdir, $expLog);
$ilBench->stop("ContentObjectExport", "buildSCORMPackage_getSCORM");
//$expLog->write(date("[y-m-d H:i:s] ")."Finished Export");
$ilBench->stop("ContentObjectExport", "buildSCORMPackage");
}

+ Here is the caller graph for this function:

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().

{
global $ilBench;
$ilBench->start("ContentObjectExport", "buildExportFile");
require_once("./Services/Xml/classes/class.ilXmlWriter.php");
$this->xml = new ilXmlWriter;
// set dtd definition
$this->xml->xmlSetDtdDef("<!DOCTYPE ContentObject SYSTEM \"http://www.ilias.de/download/dtd/ilias_co_3_7.dtd\">");
// set generated comment
$this->xml->xmlSetGenCmt("Export of ILIAS Content Module ".
$this->cont_obj->getId()." of installation ".$this->inst.".");
// set xml header
$this->xml->xmlHeader();
// create directories
$this->cont_obj->createExportDirectory();
ilUtil::makeDir($this->export_dir."/".$this->subdir);
ilUtil::makeDir($this->export_dir."/".$this->subdir."/objects");
// get Log File
$expDir = $this->cont_obj->getExportDirectory();
$expLog = new ilLog($expDir, "export.log");
$expLog->delete();
$expLog->setLogFormat("");
$expLog->write(date("[y-m-d H:i:s] ")."Start Export");
// get xml content
//echo "ContObjExport:".$this->inst_id.":<br>";
$ilBench->start("ContentObjectExport", "buildExportFile_getXML");
$this->cont_obj->exportXML($this->xml, $this->inst_id,
$this->export_dir."/".$this->subdir, $expLog);
$ilBench->stop("ContentObjectExport", "buildExportFile_getXML");
// export style
if ($this->cont_obj->getStyleSheetId() > 0)
{
include_once("./Services/Style/classes/class.ilObjStyleSheet.php");
$style_obj = new ilObjStyleSheet($this->cont_obj->getStyleSheetId(), false);
//$style_obj->exportXML($this->export_dir."/".$this->subdir);
$style_obj->setExportSubDir("style");
$style_file = $style_obj->export();
if (is_file($style_file))
{
copy($style_file, $this->export_dir."/".$this->subdir."/style.zip");
}
}
// dump xml document to screen (only for debugging reasons)
/*
echo "<PRE>";
echo htmlentities($this->xml->xmlDumpMem($format));
echo "</PRE>";
*/
// dump xml document to file
$this->xml->xmlDumpFile($this->export_dir."/".$this->subdir."/".$this->filename
, false);
// help export (workaround to use ref id here)
{
include_once("./Services/Export/classes/class.ilExport.php");
$exp = new ilExport();
$exp->exportEntity("help", $this->cont_obj->getId(), "4.3.0", "Services/Help",
"OnlineHelp", $this->export_dir."/".$this->subdir);
}
// zip the file
ilUtil::zip($this->export_dir."/".$this->subdir,
$this->export_dir."/".$this->subdir.".zip");
// destroy writer object
$this->xml->_XmlWriter;
$expLog->write(date("[y-m-d H:i:s] ")."Finished Export");
$ilBench->stop("ContentObjectExport", "buildExportFile");
return $this->export_dir."/".$this->subdir.".zip";
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilContObjectExport::getInstId ( )

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

References $inst_id.

{
}
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.

{
global $ilErr, $ilDB, $ilias;
$this->cont_obj =& $a_cont_obj;
$this->err =& $ilErr;
$this->ilias =& $ilias;
$this->db =& $ilDB;
$this->mode = $a_mode;
$this->lang = $a_lang;
$settings = $this->ilias->getAllSettings();
//$this->inst_id = $settings["inst_id"];
$this->inst_id = IL_INST_ID;
$date = time();
switch($this->mode)
{
case "html":
if ($this->lang == "")
{
$this->export_dir = $this->cont_obj->getExportDirectory("html");
}
else
{
$this->export_dir = $this->cont_obj->getExportDirectory("html_".$this->lang);
}
$this->subdir = $this->cont_obj->getType()."_".$this->cont_obj->getId();
$this->filename = $this->subdir.".zip";
break;
case "scorm":
$this->export_dir = $this->cont_obj->getExportDirectory("scorm");
$this->subdir = $this->cont_obj->getType()."_".$this->cont_obj->getId();
$this->filename = $this->subdir.".zip";
break;
case "pdf":
$this->export_dir = $this->cont_obj->getOfflineDirectory();
$this->subdir = $date."__".$this->inst_id."__".
$this->cont_obj->getType()."_".$this->cont_obj->getId();
$this->filename = $this->subdir.".fo";
break;
default:
$this->export_dir = $this->cont_obj->getExportDirectory();
$this->subdir = $date."__".$this->inst_id."__".
$this->cont_obj->getType()."_".$this->cont_obj->getId();
$this->filename = $this->subdir.".xml";
break;
}
}

Field Documentation

ilContObjectExport::$cont_obj

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

ilContObjectExport::$db

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

ilContObjectExport::$err

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

ilContObjectExport::$ilias

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

Referenced by ilContObjectExport().

ilContObjectExport::$inst_id

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

Referenced by getInstId().

ilContObjectExport::$mode

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


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