ILIAS  release_4-3 Revision
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilScorm2004Export Class Reference

Export class for SCORM 2004 object. More...

+ Collaboration diagram for ilScorm2004Export:

Public Member Functions

 ilScorm2004Export (&$a_cont_obj, $a_mode="SCORM 2004 3rd")
 Constructor public.
 getExportDirectory ()
 getExportDirectoryForType ($type)
 getExportSubDirectory ()
 getExportFileName ()
 getSupportedExportTypes ()
 getInstId ()
 buildExportFile ()
 build export file (complete zip file)
 buildExportFileSCORM ($ver)
 build xml export file
 buildExportFileHTML ()
 build xml export file
 buildExportFileHTMLOne ()
 build xml export file
 buildExportFileISO ()
 buildExportFilePDF ()
 createExportDirectory ()

Private Attributes

 $err
 $db
 $ilias
 $cont_obj
 $cont_obj_id
 $inst_id
 $mode
 $export_types
 $module_id
 $date
 $settings
 $export_dir
 $subdir
 $filename

Detailed Description

Export class for SCORM 2004 object.

Definition at line 10 of file class.ilSCORM2004Export.php.

Member Function Documentation

ilScorm2004Export::buildExportFile ( )

build export file (complete zip file)

public

Returns

Definition at line 134 of file class.ilSCORM2004Export.php.

References buildExportFileHTML(), buildExportFileHTMLOne(), buildExportFileISO(), buildExportFilePDF(), and buildExportFileSCORM().

{
switch ($this->mode)
{
case "SCORM 2004 3rd":
return $this->buildExportFileSCORM("2004 3rd");
case "SCORM 2004 4th":
return $this->buildExportFileSCORM("2004 4th");
case "SCORM 1.2":
return $this->buildExportFileSCORM("12");
case "HTML":
return $this->buildExportFileHTML();
case "HTMLOne":
return $this->buildExportFileHTMLOne();
case "ISO":
return $this->buildExportFileISO();
case "PDF":
return $this->buildExportFilePDF();
}
}

+ Here is the call graph for this function:

ilScorm2004Export::buildExportFileHTML ( )

build xml export file

Definition at line 199 of file class.ilSCORM2004Export.php.

References $export_dir, createExportDirectory(), ilUtil\delDir(), ilUtil\makeDir(), and ilUtil\zip().

Referenced by buildExportFile().

{
require_once("./Services/Xml/classes/class.ilXmlWriter.php");
// create directories
ilUtil::makeDir($this->export_dir."/".$this->subdir);
// get Log File
$expDir = $this->export_dir;
$expLog = new ilLog($expDir, "export.log");
$expLog->delete();
$expLog->setLogFormat("");
$expLog->write(date("[y-m-d H:i:s] ")."Start Export");
// get xml content
$this->cont_obj->exportHTML($this->inst_id, $this->export_dir."/".$this->subdir, $expLog);
// zip the file
ilUtil::zip($this->export_dir."/".$this->subdir, $this->export_dir."/".$this->subdir.".zip", true);
ilUtil::delDir($this->export_dir."/".$this->subdir);
$expLog->write(date("[y-m-d H:i:s] ")."Finished Export");
return $this->export_dir."/".$this->subdir.".zip";
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilScorm2004Export::buildExportFileHTMLOne ( )

build xml export file

Definition at line 230 of file class.ilSCORM2004Export.php.

References $export_dir, createExportDirectory(), ilUtil\delDir(), ilUtil\makeDir(), and ilUtil\zip().

Referenced by buildExportFile().

{
require_once("./Services/Xml/classes/class.ilXmlWriter.php");
// create directories
ilUtil::makeDir($this->export_dir."/".$this->subdir);
// get Log File
$expDir = $this->export_dir;
$expLog = new ilLog($expDir, "export.log");
$expLog->delete();
$expLog->setLogFormat("");
$expLog->write(date("[y-m-d H:i:s] ")."Start Export");
// get xml content
$this->cont_obj->exportHTMLOne($this->inst_id, $this->export_dir."/".$this->subdir, $expLog);
// zip the file
ilUtil::zip($this->export_dir."/".$this->subdir, $this->export_dir."/".$this->subdir.".zip", true);
ilUtil::delDir($this->export_dir."/".$this->subdir);
$expLog->write(date("[y-m-d H:i:s] ")."Finished Export");
return $this->export_dir."/".$this->subdir.".zip";
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilScorm2004Export::buildExportFileISO ( )

Definition at line 258 of file class.ilSCORM2004Export.php.

References $export_dir, $ilBench, $result, createExportDirectory(), ilUtil\CreateIsoFromFolder(), ilUtil\delDir(), and ilUtil\makeDir().

Referenced by buildExportFile().

{
global $ilBench;
$result = "";
$ilBench->start("ContentObjectExport", "buildExportFile");
require_once("./Services/Xml/classes/class.ilXmlWriter.php");
// create directories
ilUtil::makeDir($this->export_dir."/".$this->subdir);
// get Log File
$expDir = $this->export_dir;
$expLog = new ilLog($expDir, "export.log");
$expLog->delete();
$expLog->setLogFormat("");
$expLog->write(date("[y-m-d H:i:s] ")."Start Export");
// get xml content
$ilBench->start("ContentObjectExport", "buildExportFile_getXML");
$this->cont_obj->exportHTML($this->inst_id, $this->export_dir."/".$this->subdir, $expLog);
$ilBench->stop("ContentObjectExport", "buildExportFile_getXML");
// zip the file
$ilBench->start("ContentObjectExport", "buildExportFile_zipFile");
if(ilUtil::CreateIsoFromFolder($this->export_dir."/".$this->subdir, $this->export_dir."/".$this->subdir.".iso"))
{
$result = $this->export_dir."/".$this->subdir.".iso";
}
$ilBench->stop("ContentObjectExport", "buildExportFile_zipFile");
ilUtil::delDir($this->export_dir."/".$this->subdir);
$expLog->write(date("[y-m-d H:i:s] ")."Finished Export");
$ilBench->stop("ContentObjectExport", "buildExportFile");
return $result;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilScorm2004Export::buildExportFilePDF ( )

Definition at line 299 of file class.ilSCORM2004Export.php.

References $export_dir, $ilBench, $ilLog, createExportDirectory(), ilUtil\delDir(), ilRpcClientFactory\factory(), ilUtil\makeDir(), and ilUtil\sendFailure().

Referenced by buildExportFile().

{
global $ilBench;
/*include_once('./Services/WebServices/RPC/classes/class.ilRPCServerSettings.php');
$pp = ilRPCServerSettings::getInstance();
if(!$pp->isEnabled()||!$pp->pingServer())
{
$this->ilias->raiseError("Xml Rpc Server is not running. Check Administration/Webservices/Java-Server settings", $this->ilias->error_obj->MESSAGE);
return;
}*/
$ilBench->start("ContentObjectExport", "buildExportFile");
require_once("./Services/Xml/classes/class.ilXmlWriter.php");
// create directories
ilUtil::makeDir($this->export_dir."/".$this->subdir);
// get Log File
$expDir = $this->export_dir;
$expLog = new ilLog($expDir, "export.log");
$expLog->delete();
$expLog->setLogFormat("");
$expLog->write(date("[y-m-d H:i:s] ")."Start Export");
$ilBench->start("ContentObjectExport", "buildExportFile_getXML");
$fo_string = $this->cont_obj->exportPDF($this->inst_id, $this->export_dir."/".$this->subdir, $expLog);
$ilBench->stop("ContentObjectExport", "buildExportFile_getXML");
$ilBench->start("ContentObjectExport", "buildExportFile_pdfFile");
fputs(fopen($this->export_dir."/".$this->subdir.'/temp.fo','w+'),$fo_string);
global $ilLog;
include_once './Services/WebServices/RPC/classes/class.ilRpcClientFactory.php';
try
{
$pdf_base64 = ilRpcClientFactory::factory('RPCTransformationHandler')->ilFO2PDF($fo_string);
//ilUtil::deliverData($pdf_base64->scalar,'learning_progress.pdf','application/pdf');
fputs(fopen($this->export_dir.'/'.$this->subdir.'.pdf','w+'),$pdf_base64->scalar);
}
{
ilUtil::sendFailure($e->getMessage(),true);
return false;
}
catch(Exception $e)
{
ilUtil::sendFailure($e->getMessage(),true);
return false;
}
$ilBench->stop("ContentObjectExport", "buildExportFile_pdfFile");
ilUtil::delDir($this->export_dir."/".$this->subdir);
$expLog->write(date("[y-m-d H:i:s] ")."Finished Export");
$ilBench->stop("ContentObjectExport", "buildExportFile");
return $this->export_dir."/".$this->subdir.".pdf";
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilScorm2004Export::buildExportFileSCORM (   $ver)

build xml export file

Definition at line 158 of file class.ilSCORM2004Export.php.

References $export_dir, $ilBench, createExportDirectory(), ilUtil\delDir(), ilUtil\makeDir(), and ilUtil\zip().

Referenced by buildExportFile().

{
global $ilBench;
$ilBench->start("ContentObjectExport", "buildExportFile");
require_once("./Services/Xml/classes/class.ilXmlWriter.php");
// create directories
ilUtil::makeDir($this->export_dir."/".$this->subdir);
// get Log File
$expDir = $this->export_dir;
$expLog = new ilLog($expDir, "export.log");
$expLog->delete();
$expLog->setLogFormat("");
$expLog->write(date("[y-m-d H:i:s] ")."Start Export");
// get xml content
$ilBench->start("ContentObjectExport", "buildExportFile_getXML");
$this->cont_obj->exportScorm($this->inst_id, $this->export_dir."/".$this->subdir, $ver, $expLog);
$ilBench->stop("ContentObjectExport", "buildExportFile_getXML");
// zip the file
$ilBench->start("ContentObjectExport", "buildExportFile_zipFile");
ilUtil::zip($this->export_dir."/".$this->subdir, $this->export_dir."/".$this->subdir.".zip", true);
$ilBench->stop("ContentObjectExport", "buildExportFile_zipFile");
ilUtil::delDir($this->export_dir."/".$this->subdir);
$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:

ilScorm2004Export::createExportDirectory ( )

Definition at line 361 of file class.ilSCORM2004Export.php.

References $module_id, ilUtil\getDataDir(), and ilUtil\makeDir().

Referenced by buildExportFileHTML(), buildExportFileHTMLOne(), buildExportFileISO(), buildExportFilePDF(), and buildExportFileSCORM().

{
$lm_data_dir = ilUtil::getDataDir()."/lm_data";
if(!is_writable($lm_data_dir))
{
$this->ilias->raiseError("Content object Data Directory (".$lm_data_dir.") not writeable.",$this->ilias->error_obj->FATAL);
}
// create learning module directory (data_dir/lm_data/lm_<id>)
$lm_dir = $lm_data_dir."/lm_".$this->module_id;
ilUtil::makeDir($lm_dir);
if(!@is_dir($lm_dir))
{
$this->ilias->raiseError("Creation of Learning Module Directory failed.",$this->ilias->error_obj->FATAL);
}
//$export_dir = $lm_dir."/export_".$this->mode;
ilUtil::makeDir($this->export_dir);
if(!@is_dir($this->export_dir))
{
$this->ilias->raiseError("Creation of Export Directory failed.",$this->ilias->error_obj->FATAL);
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilScorm2004Export::getExportDirectory ( )

Definition at line 72 of file class.ilSCORM2004Export.php.

References getExportDirectoryForType().

Referenced by ilScorm2004Export().

{
return $this->getExportDirectoryForType($this->mode);
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilScorm2004Export::getExportDirectoryForType (   $type)

Definition at line 77 of file class.ilSCORM2004Export.php.

References $ret, and ilUtil\getDataDir().

Referenced by getExportDirectory().

{
$ret = ilUtil::getDataDir()."/lm_data"."/lm_".$this->module_id."/export_";
switch($type)
{
case "ISO":
return $ret."_iso";
case "PDF":
return $ret."_pdf";
case "SCORM 2004 3rd":
return $ret."_scorm2004";
case "SCORM 2004 4th":
return $ret."_scorm2004_4th";
case "HTML":
return $ret."_html";
case "HTMLOne":
return $ret."_html_one";
case "SCORM 1.2":
return $ret."_scorm12";
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilScorm2004Export::getExportFileName ( )

Definition at line 105 of file class.ilSCORM2004Export.php.

Referenced by ilScorm2004Export().

{
switch($this->mode)
{
case "ISO":
return $this->subdir.".iso";
case "PDF":
return $this->subdir.".pdf";
default:
return $this->subdir.".zip";
}
}

+ Here is the caller graph for this function:

ilScorm2004Export::getExportSubDirectory ( )

Definition at line 100 of file class.ilSCORM2004Export.php.

References $cont_obj_id.

Referenced by ilScorm2004Export().

{
return $this->date."__".$this->inst_id."__".$this->cont_obj->getType()."_".$this->cont_obj_id;
}

+ Here is the caller graph for this function:

ilScorm2004Export::getInstId ( )

Definition at line 123 of file class.ilSCORM2004Export.php.

References $inst_id.

{
}
ilScorm2004Export::getSupportedExportTypes ( )

Definition at line 118 of file class.ilSCORM2004Export.php.

References $export_types.

{
}
ilScorm2004Export::ilScorm2004Export ( $a_cont_obj,
  $a_mode = "SCORM 2004 3rd" 
)

Constructor public.

Definition at line 32 of file class.ilSCORM2004Export.php.

References $ilErr, $ilias, $settings, getExportDirectory(), getExportFileName(), and getExportSubDirectory().

{
global $ilErr, $ilDB, $ilias;
$this->export_types = array("SCORM 2004 3rd","SCORM 2004 4th","SCORM 1.2","HTML","ISO","PDF",
"HTMLOne");
if(!in_array($a_mode,$this->export_types))
die("Unsupported format");
$this->cont_obj =& $a_cont_obj;
$this->err =& $ilErr;
$this->ilias =& $ilias;
$this->db =& $ilDB;
$this->mode = $a_mode;
$settings = $this->ilias->getAllSettings();
$this->inst_id = IL_INST_ID;
switch ($this->cont_obj->getType())
{
case 'sahs':
$this->module_id = $this->cont_obj->getId();
$this->cont_obj_id = $this->cont_obj->getId();
break;
case 'sco':
$this->module_id = $this->cont_obj->slm_id;
$this->cont_obj_id = $this->cont_obj->getId();
break;
}
$this->date = time();
$this->export_dir = $this->getExportDirectory();
$this->subdir = $this->getExportSubDirectory();
$this->filename = $this->getExportFileName();
}

+ Here is the call graph for this function:

Field Documentation

ilScorm2004Export::$cont_obj
private

Definition at line 15 of file class.ilSCORM2004Export.php.

ilScorm2004Export::$cont_obj_id
private

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

Referenced by getExportSubDirectory().

ilScorm2004Export::$date
private

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

ilScorm2004Export::$db
private

Definition at line 13 of file class.ilSCORM2004Export.php.

ilScorm2004Export::$err
private

Definition at line 12 of file class.ilSCORM2004Export.php.

ilScorm2004Export::$export_dir
private
ilScorm2004Export::$export_types
private

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

Referenced by getSupportedExportTypes().

ilScorm2004Export::$filename
private

Definition at line 26 of file class.ilSCORM2004Export.php.

ilScorm2004Export::$ilias
private

Definition at line 14 of file class.ilSCORM2004Export.php.

Referenced by ilScorm2004Export().

ilScorm2004Export::$inst_id
private

Definition at line 17 of file class.ilSCORM2004Export.php.

Referenced by getInstId().

ilScorm2004Export::$mode
private

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

ilScorm2004Export::$module_id
private

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

Referenced by createExportDirectory().

ilScorm2004Export::$settings
private

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

Referenced by ilScorm2004Export().

ilScorm2004Export::$subdir
private

Definition at line 25 of file class.ilSCORM2004Export.php.


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