ILIAS  Release_4_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilSCORM2004Sco Class Reference

Class ilSCORM2004Sco. More...

+ Inheritance diagram for ilSCORM2004Sco:
+ Collaboration diagram for ilSCORM2004Sco:

Public Member Functions

 ilSCORM2004Sco ($a_slm_object, $a_id=0)
 Constructor public.
 delete ($a_delete_meta_data=true)
 Delete a SCO.
 create ($a_upload=false, $a_template=false)
 overwritten method
 copy ($a_target_slm)
 Copy sco.
 exportScorm ($a_inst, $a_target_dir, $ver, &$expLog)
 exportHTML ($a_inst, $a_target_dir, &$expLog)
 exportHTML4PDF ($a_inst, $a_target_dir, &$expLog)
 exportHTMLPageObjects ($a_inst, $a_target_dir, &$expLog, $mode)
 exportXMLPageObjects ($a_target_dir, &$a_xml_writer, $a_inst, &$expLog)
 exportXMLMediaObjects (&$a_xml_writer, $a_inst, $a_target_dir, &$expLog)
 exportFileItems ($a_target_dir, &$expLog)
 export files of file itmes
 exportXMLMetaData (&$a_xml_writer)
 getExportFiles ()
- Public Member Functions inherited from ilSCORM2004Node
 ilSCORM2004Node ($a_slm_object, $a_id=0)
 setTitle ($a_title)
 Set title.
 getTitle ()
 Get title.
 setDescription ($a_description)
 Set description.
 getDescription ()
 Get description.
 setType ($a_type)
 Set type.
 getType ()
 Get type.
 setSLMId ($a_slm_id)
 Set ID of parent Scorm Learning Module Object.
 getSLMId ()
 Get ID of parent Scorm Learning Module Object.
 setSLMObject ($a_slm_obj)
 Set Scorm Learning Module Object.
 getContentObject ()
 Get Scorm Learning Module Object.
 setId ($a_id)
 Set Node ID.
 getId ()
 Get Node ID.
 getImportId ()
 Set Import ID.
 setImportId ($a_id)
 Get Import ID.
 read ()
 Read Data of Node.
 MDUpdateListener ($a_element)
 Meta data update listener.
 createMetaData ()
 create meta data entry
 updateMetaData ()
 update meta data entry
 deleteMetaData ()
 delete meta data entry
 setDataRecord ($a_record)
 this method should only be called by class ilSCORM2004NodeFactory
 create ($a_upload=false)
 Create Node.
 update ()
 Update Node.
 delete ()
 Delete Node.
 _getIdForImportId ($a_import_id)
 Get Node ID for import ID (static)
 _exists ($a_id)
 Checks wether a node exists.
 _deleteAllSLMNodes ($a_slm_object)
 Delete all nodes of Scorm Learning Module.
 _lookupSLMID ($a_id)
 Lookup Scorm Learning Module ID for node id.
 clipboardCut ($a_slm_obj_id, $a_ids)
 Cut and copy a set of chapters/pages into the clipboard.
 insertChapterClip ($a_slm_obj, $a_as_sub=false)
 Insert Chapter from clipboard.
 getObjectives ()
 deleteSeqInfo ()
 parentHasSeqTemplate ()
 exportAsScorm12 ()
 exportAsScorm13 ()

Data Fields

 $q_media = null
- Data Fields inherited from ilSCORM2004Node
 $slm_id
 $type
 $id
 $slm_object

Private Member Functions

 delete_rec ($a_delete_meta_data=true)
 Delete Nested Page Objects.
 fixFullscreeenLink ($matches)
 insertQuestion ($matches)

Additional Inherited Members

- Static Public Member Functions inherited from ilSCORM2004Node
static _lookupTitle ($a_obj_id)
 Lookup Title.
static _lookupType ($a_obj_id)
 Lookup Type.
static _writeTitle ($a_obj_id, $a_title)
 Write Title.
static _writeImportId ($a_id, $a_import_id)
 Write import ID.
static putInTree ($a_obj, $a_parent_id="", $a_target_node_id="")
 put this object into content object tree
static getTree ($a_slm_obj_id)
 Get scorm module editing tree.
static clipboardCopy ($a_slm_obj_id, $a_ids)
 Copy a set of chapters/pages/scos into the clipboard.
static uniqueTypesCheck ($a_items)
 Check for unique types (all pages or all chapters or all scos)
static insertPageClip ($a_slm_obj)
 Insert pages from clipboard.
static insertScoClip ($a_slm_obj)
 Insert scos from clipboard.
static pasteTree ($a_target_slm, $a_item_id, $a_parent_id, $a_target, $a_insert_time, &$a_copied_nodes, $a_as_copy=false)
 Paste item (tree) from clipboard to current scorm learning module.

Detailed Description

Class ilSCORM2004Sco.

SCO class for SCORM 2004 Editing

Author
Alex Killing alex..nosp@m.kill.nosp@m.ing@g.nosp@m.mx.d.nosp@m.e
Version
$Id$

Definition at line 36 of file class.ilSCORM2004Sco.php.

Member Function Documentation

ilSCORM2004Sco::copy (   $a_target_slm)

Copy sco.

Definition at line 104 of file class.ilSCORM2004Sco.php.

References ilSCORM2004Node\getDescription(), ilSCORM2004Node\getId(), ilSCORM2004Node\getSLMId(), ilSCORM2004Node\getTitle(), ilSCORM2004Node\getType(), and ilSCORM2004Sco().

Referenced by exportFileItems(), exportHTML(), and exportScorm().

{
$sco = new ilSCORM2004Sco($a_target_slm);
$sco->setTitle($this->getTitle());
if ($this->getSLMId() != $a_target_slm->getId())
{
$sco->setImportId("il__sco_".$this->getId());
}
$sco->setSLMId($a_target_slm->getId());
$sco->setType($this->getType());
$sco->setDescription($this->getDescription());
$sco->create(true);
$a_copied_nodes[$this->getId()] = $sco->getId();
// copy meta data
include_once("Services/MetaData/classes/class.ilMD.php");
$md = new ilMD($this->getSLMId(), $this->getId(), $this->getType());
$new_md =& $md->cloneMD($a_target_slm->getId(), $sco->getId(), $this->getType());
return $sco;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilSCORM2004Sco::create (   $a_upload = false,
  $a_template = false 
)

overwritten method

Definition at line 65 of file class.ilSCORM2004Sco.php.

References ilSCORM2004Node\getId().

{
include_once("./Modules/Scorm2004/classes/seq_editor/class.ilSCORM2004Item.php");
include_once("./Modules/Scorm2004/classes/seq_editor/class.ilSCORM2004Objective.php");
parent::create($a_upload);
if (!$a_template) {
$seq_item = new ilSCORM2004Item($this->getId());
$seq_item->insert();
$obj = new ilSCORM2004Objective($this->getId());
$obj->setObjectiveID("Objective SCO ".$this->getId());
$obj->setId("local_obj_".$this->getID()."_0");
$obj->update();
}
}

+ Here is the call graph for this function:

ilSCORM2004Sco::delete (   $a_delete_meta_data = true)

Delete a SCO.

Definition at line 54 of file class.ilSCORM2004Sco.php.

References delete_rec(), ilSCORM2004Node\deleteSeqInfo(), and ilSCORM2004Node\getId().

{
$node_data = $this->tree->getNodeData($this->getId());
$this->delete_rec($a_delete_meta_data);
$this->tree->deleteTree($node_data);
}

+ Here is the call graph for this function:

ilSCORM2004Sco::delete_rec (   $a_delete_meta_data = true)
private

Delete Nested Page Objects.

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

References ilSCORM2004Node\delete(), ilSCORM2004Node\getId(), and ilSCORM2004NodeFactory\getInstance().

Referenced by delete().

{
$childs = $this->tree->getChilds($this->getId());
foreach ($childs as $child)
{
$obj =& ilSCORM2004NodeFactory::getInstance($this->slm_object, $child["obj_id"], false);
if (is_object($obj))
{
if ($obj->getType() == "page")
{
$obj->delete($a_delete_meta_data);
}
}
unset($obj);
}
parent::delete($a_delete_meta_data);
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilSCORM2004Sco::exportFileItems (   $a_target_dir,
$expLog 
)

export files of file itmes

Definition at line 576 of file class.ilSCORM2004Sco.php.

References ilObject\_exists(), and copy().

Referenced by exportHTMLPageObjects().

{
include_once("./Modules/File/classes/class.ilObjFile.php");
if(is_array($this->file_ids))
foreach ($this->file_ids as $file_id)
{
$expLog->write(date("[y-m-d H:i:s] ")."File Item ".$file_id);
$file_obj = new ilObjFile($file_id, false);
$file_obj->export($a_target_dir);
unset($file_obj);
}
include_once("./Services/MediaObjects/classes/class.ilObjMediaObject.php");
$linked_mobs = array();
if(is_array($this->mob_ids ))
{
// mobs directly embedded into pages
foreach ($this->mob_ids as $mob_id)
{
if ($mob_id > 0 && ilObject::_exists($mob_id))
{
$expLog->write(date("[y-m-d H:i:s] ")."Media Object ".$mob_id);
$media_obj = new ilObjMediaObject($mob_id);
$media_obj->exportFiles($a_target_dir, $expLog);
$lmobs = $media_obj->getLinkedMediaObjects($this->mob_ids);
$linked_mobs = array_merge($linked_mobs, $lmobs);
unset($media_obj);
}
}
// linked mobs (in map areas)
foreach ($linked_mobs as $mob_id)
{
if ($mob_id > 0 && ilObject::_exists($mob_id))
{
$expLog->write(date("[y-m-d H:i:s] ")."Media Object ".$mob_id);
$media_obj = new ilObjMediaObject($mob_id);
$media_obj->exportFiles($a_target_dir);
unset($media_obj);
}
}
}
//media files in questions
foreach ($this->q_media as $media) {
if ($media !="") {
error_log($media);
copy($media, $a_target_dir."/objects/".basename($media));
}
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilSCORM2004Sco::exportHTML (   $a_inst,
  $a_target_dir,
$expLog 
)

Definition at line 181 of file class.ilSCORM2004Sco.php.

References $files, $ilBench, copy(), exportHTMLPageObjects(), ilObjStyleSheet\getContentStylePath(), ilYuiUtil\getLocalPath(), ilUtil\getStyleSheetLocation(), and ilUtil\makeDir().

Referenced by exportScorm().

{
ilUtil::makeDir($a_target_dir.'/css');
ilUtil::makeDir($a_target_dir.'/objects');
ilUtil::makeDir($a_target_dir.'/images');
ilUtil::makeDir($a_target_dir.'/js');
ilUtil::makeDir($a_target_dir.'/players');
copy('./Services/MediaObjects/flash_flv_player/flvplayer.swf', $a_target_dir.'/players/flvplayer.swf');
copy('./Services/MediaObjects/flash_mp3_player/mp3player.swf', $a_target_dir.'/players/mp3player.swf');
copy('./Modules/Scorm2004/scripts/scorm_2004.js',$a_target_dir.'/js/scorm.js');
copy('./Modules/Scorm2004/scripts/pager.js',$a_target_dir.'/js/pager.js');
copy('./Modules/Scorm2004/scripts/questions/pure.js',$a_target_dir.'/js/pure.js');
copy('./Modules/Scorm2004/scripts/questions/jquery.js',$a_target_dir.'/js/jquery.js');
copy('./Modules/Scorm2004/scripts/questions/jquery-ui-min.js',$a_target_dir.'/js/jquery-ui-min.js');
// accordion stuff
ilUtil::makeDir($a_target_dir.'/js/yahoo');
include_once("./Services/YUI/classes/class.ilYuiUtil.php");
copy(ilYuiUtil::getLocalPath('yahoo/yahoo-min.js'), $a_target_dir.'/js/yahoo/yahoo-min.js');
copy(ilYuiUtil::getLocalPath('yahoo-dom-event/yahoo-dom-event.js'), $a_target_dir.'/js/yahoo/yahoo-dom-event.js');
copy(ilYuiUtil::getLocalPath('animation/animation-min.js'), $a_target_dir.'/js/yahoo/animation-min.js');
copy('./Services/Accordion/js/accordion.js',$a_target_dir.'/js/accordion.js');
copy('./Services/Accordion/css/accordion.css',$a_target_dir.'/css/accordion.css');
copy('./Services/JavaScript/js/Basic.js',$a_target_dir.'/js/Basic.js');
include_once("./Services/Style/classes/class.ilObjStyleSheet.php");
$active_css = ilObjStyleSheet::getContentStylePath($this->slm_object->getStyleSheetId());
$active_css = split(@'\?',$active_css,2);
$css = fread(fopen($active_css[0],'r'),filesize($active_css[0]));
preg_match_all("/url\(([^\)]*)\)/",$css,$files);
$currdir = getcwd();
chdir(dirname($active_css[0]));
foreach (array_unique($files[1]) as $fileref)
{
if (is_file($fileref))
{
copy($fileref,$a_target_dir."/images/".basename($fileref));
}
$css = str_replace($fileref,"../images/".basename($fileref),$css);
}
chdir($currdir);
fwrite(fopen($a_target_dir.'/css/style.css','w'),$css);
// export system style sheet
$css = fread(fopen(ilUtil::getStyleSheetLocation("filesystem"),'r'),filesize(ilUtil::getStyleSheetLocation("filesystem")));
preg_match_all("/url\(([^\)]*)\)/",$css,$files);
$currdir = getcwd();
chdir(dirname(ilUtil::getStyleSheetLocation("filesystem")));
foreach (array_unique($files[1]) as $fileref)
{
if(file_exists($fileref))
{
copy($fileref,$a_target_dir."/images/".basename($fileref));
$css = str_replace($fileref,"../images/".basename($fileref),$css);
}
}
copy('images/spacer.gif',$a_target_dir."/images/spacer.gif");
copy('images/enlarge.gif',$a_target_dir."/images/enlarge.gif");
chdir($currdir);
fwrite(fopen($a_target_dir.'/css/system.css','w'),$css);
//copy(ilUtil::getStyleSheetLocation("filesystem"), $a_target_dir.'/css/system.css');
global $ilBench;
$this->exportHTMLPageObjects($a_inst, $a_target_dir, $expLog, 'full');
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilSCORM2004Sco::exportHTML4PDF (   $a_inst,
  $a_target_dir,
$expLog 
)

Definition at line 251 of file class.ilSCORM2004Sco.php.

References exportHTMLPageObjects(), and ilUtil\makeDir().

{
ilUtil::makeDir($a_target_dir.'/css');
ilUtil::makeDir($a_target_dir.'/objects');
ilUtil::makeDir($a_target_dir.'/images');
$this->exportHTMLPageObjects($a_inst, $a_target_dir, $expLog, 'pdf');
}

+ Here is the call graph for this function:

ilSCORM2004Sco::exportHTMLPageObjects (   $a_inst,
  $a_target_dir,
$expLog,
  $mode 
)

Definition at line 259 of file class.ilSCORM2004Sco.php.

References $ilBench, $ilCtrl, $ilLog, $lng, $tpl, assQuestionGUI\_getQuestionGUI(), ilSCORM2004Page\_getQuestionIdsForPage(), exportFileItems(), ilQuestionExporter\getFiles(), ilSCORM2004Node\getId(), ilQuestionExporter\getMobs(), ilSCORM2004Node\getObjectives(), ilSCORM2004Node\getSLMId(), ilSCORM2004Node\getTitle(), ilSCORM2004Node\getType(), IL_PAGE_OFFLINE, ilQuestionExporter\indicateNewSco(), and ilQuestionExporter\questionsJS().

Referenced by exportHTML(), and exportHTML4PDF().

{
include_once "./Modules/Scorm2004/classes/class.ilSCORM2004PageGUI.php";
include_once "./Modules/Scorm2004/classes/class.ilObjSCORM2004LearningModuleGUI.php";
include_once "./Services/MetaData/classes/class.ilMD.php";
$output = "";
$tree = new ilTree($this->slm_id);
$tree->setTableNames('sahs_sc13_tree', 'sahs_sc13_tree_node');
$tree->setTreeTablePK("slm_id");
$meta = new ilMD($this->getSLMId(), $this->getId(), $this->getType());
$desc_ids = $meta->getGeneral()->getDescriptionIds();
$sco_description = $meta->getGeneral()->getDescription($desc_ids[0])->getDescription();
// @todo
// Why is that much HTML code in an application class?
// Please extract all this HTML to a tpl.<t_name>.html file and use
// placeholders and the template engine to insert data.
//
// There copy/paste code residenting in ilSCORM2004ScoGUI. This
// should be merged.
//
// alex, 4 Apr 09
//
$output = '
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=7" />
<link rel="stylesheet" type="text/css" href="./css/system.css" />
<link rel="stylesheet" type="text/css" href="./css/style.css" />
<link rel="stylesheet" type="text/css" href="./css/accordion.css" />
<script src="./js/scorm.js" type="text/javascript" language="JavaScript1.2"></script>
<script src="./js/jquery.js" type="text/javascript" language="JavaScript1.2"></script>
<script src="./js/jquery-ui-min.js" type="text/javascript" language="JavaScript1.2"></script>
<script src="./js/pager.js" type="text/javascript" language="JavaScript1.2"></script>
<script src="./js/pure.js" type="text/javascript" language="JavaScript1.2"></script>
<script src="./js/yahoo/yahoo-min.js" type="text/javascript" language="JavaScript1.2"></script>
<script src="./js/yahoo/yahoo-dom-event.js" type="text/javascript" language="JavaScript1.2"></script>
<script src="./js/yahoo/animation-min.js" type="text/javascript" language="JavaScript1.2"></script>
<script src="./js/Basic.js" type="text/javascript" language="JavaScript1.2"></script>
<script src="./js/questions_'. $this->getId().'.js" type="text/javascript" language="JavaScript1.2"></script>
<script type="text/javascript" language="JavaScript1.2">
ilAddOnLoad(function () {init(0);});
</script>
<script src="./js/accordion.js" type="text/javascript" language="JavaScript1.2"></script>
<title>'.$this->getTitle().'</title>
</head>
<body onunload="finish();">';
//<body onLoad="init(0);" onunload="finish();">';
// add init(0) per script, see above;
// otherwise accordion.js cannot add another function to the onload event.
if($mode!='pdf')
$output .= '<!-- BEGIN ilLMNavigation -->
<div class="ilc_page_tnav_TopNavigation">
<!-- BEGIN ilLMNavigation_Prev -->
<div class="ilc_page_lnav_LeftNavigation">
<a class="ilc_page_lnavlink_LeftNavigationLink">
<img class="ilc_page_lnavimage_LeftNavigationImage" border="0" src="./images/spacer.gif" alt="" title="" />&nbsp;Prev</a>
</div>
<!-- END ilLMNavigation_Prev -->
<!-- BEGIN ilLMNavigation_Next -->
<div class="ilc_page_rnav_RightNavigation">
<a class="ilc_page_rnavlink_RightNavigationLink">Next&nbsp;<img class="ilc_page_rnavimage_RightNavigationImage" border="0" src="./images/spacer.gif" alt="" title="" /></a>
</div>
<!-- END ilLMNavigation_Next -->
<div style="clear:both;"></div>
</div>
<!-- END ilLMNavigation -->';
$output .='<table class="ilc_page_cont_PageContainer" width="100%" cellspacing="0" cellpadding="0" style="display: table;">
<tbody><tr><td><div class="ilc_page_Page">';
if($mode!='pdf')
$output .='<div class="ilc_sco_title_Title">'.$this->getTitle().'</div>';
else
$output .='<h1>'.$this->getTitle().'</h1>';
// sco description
if (trim($sco_description) != "")
{
$output .='<div class="ilc_sco_desct_DescriptionTop">'.$lng->txt("description").'</div>';
$output .='<div class="ilc_sco_desc_Description">'.$sco_description.'</div>';
}
// sco objective(s)
$objs = $this->getObjectives();
if (count($objs) > 0)
{
$output .='<div class="ilc_sco_objt_ObjectiveTop">'.$lng->txt("sahs_objectives").'</div>';
foreach ($objs as $objective)
{
$output .= '<div class="ilc_sco_obj_Objective">'.nl2br($objective->getObjectiveID()).'</div>';
}
$output .= "</div>";
}
$output .='</td><tr></table>';
//notify Question Exporter of new SCO
require_once './Modules/Scorm2004/classes/class.ilQuestionExporter.php';
if($mode=='pdf') $output .='<!-- PAGE BREAK -->';
foreach($tree->getSubTree($tree->getNodeData($this->getId()),true,'page') as $page)
{
//echo(print_r($page));
$page_obj = new ilSCORM2004PageGUI($this->getType(),$page["obj_id"]);
$page_obj->setPresentationTitle($page["title"]);
$page_obj->setOutputMode(IL_PAGE_OFFLINE);
$page_obj->setStyleId($this->slm_object->getStyleSheetId());
$output .= '<table class="ilc_page_cont_PageContainer" width="100%" cellspacing="0" cellpadding="0" style="display: table;"><tbody><tr><td><div class="ilc_page_Page">'.$page_obj->showPage("export")."</div></td></tr></table>";
if($mode=='pdf') $output .='<!-- PAGE BREAK -->';
// collect media objects
$ilBench->start("ContentObjectExport", "exportPageObject_CollectMedia");
$mob_ids = $page_obj->getSCORM2004Page()->collectMediaObjects(false);
foreach($mob_ids as $mob_id)
{
$this->mob_ids[$mob_id] = $mob_id;
}
$ilBench->stop("ContentObjectExport", "exportPageObject_CollectMedia");
// collect all file items
$ilBench->start("ContentObjectExport", "exportPageObject_CollectFileItems");
$file_ids = $page_obj->getSCORM2004Page()->collectFileItems();
foreach($file_ids as $file_id)
{
$this->file_ids[$file_id] = $file_id;
}
$ilBench->stop("ContentObjectExport", "exportPageObject_CollectFileItems");
if($mode=='pdf')
{
$q_ids = ilSCORM2004Page::_getQuestionIdsForPage("sahs", $page["obj_id"]);
foreach ($q_ids as $q_id)
{
include_once("./Modules/TestQuestionPool/classes/class.assQuestionGUI.php");
$q_gui =& assQuestionGUI::_getQuestionGUI("", $q_id);
$q_gui->outAdditionalOutput();
$html = $q_gui->getPreview(TRUE);
$output = preg_replace("/&#123;&#123;&#123;&#123;&#123;Question;il__qst_".$q_id."&#125;&#125;&#125;&#125;&#125;/i",$html,$output);
}
}
}
if($mode!='pdf')
$output .= '<!-- BEGIN ilLMNavigation2 -->
<div class="ilc_page_bnav_BottomNavigation">
<!-- BEGIN ilLMNavigation_Prev -->
<div class="ilc_page_lnav_LeftNavigation">
<a class="ilc_page_lnavlink_LeftNavigationLink">
<img class="ilc_page_lnavimage_LeftNavigationImage" border="0" src="./images/spacer.gif" alt="" title="" />&nbsp;Prev</a>
</div>
<!-- END ilLMNavigation_Prev -->
<!-- BEGIN ilLMNavigation_Next -->
<div class="ilc_page_rnav_RightNavigation">
<a class="ilc_page_rnavlink_RightNavigationLink">Next&nbsp;<img class="ilc_page_rnavimage_RightNavigationImage" border="0" src="./images/spacer.gif" alt="" title="" /></a>
</div>
<!-- END ilLMNavigation_Next -->
<div style="clear:both;"></div>
</div>
<!-- END ilLMNavigation2 -->';
$output .= '</body></html>';
if($mode=='pdf')
$output = preg_replace("/<div class=\"ilc_page_title_PageTitle\">(.*?)<\/div>/i","<h2>$1</h2>",$output);
$output = preg_replace("/\.\/mobs\/mm_(\d+)\/([^\"]+)/i","./objects/il_".IL_INST_ID."_mob_$1/$2",$output);
$output = preg_replace("/\.\/files\/file_(\d+)\/([^\"]+)/i","./objects/il_".IL_INST_ID."_file_$1/$2",$output);
$output = preg_replace("/\.\/Services\/MediaObjects\/flash_mp3_player/i","./players",$output);
$output = preg_replace("/\.\/Services\/MediaObjects\/flash_flv_player/i","./players",$output);
$output = preg_replace("/file=..\/..\/..\/.\//i","file=../",$output);
if($mode!='pdf')
{
$output = preg_replace_callback("/href=\"&mob_id=(\d+)&pg_id=(\d+)\"/",array(get_class($this), 'fixFullscreeenLink'),$output);
$output = preg_replace_callback("/(Question;)(il__qst_[0-9]+)/",array(get_class($this), 'insertQuestion'),$output);
$output = preg_replace("/&#123;/","",$output);
$output = preg_replace("/&#125;/","",$output);
$q_handling = file_get_contents('./Modules/Scorm2004/scripts/questions/question_handling.js');
fputs(fopen($a_target_dir.'/js/questions_'.$this->getId().'.js','w+'),ilQuestionExporter::questionsJS().$q_handling);
foreach(ilQuestionExporter::getMobs() as $mob_id)
{
$this->mob_ids[$mob_id] = $mob_id;
}
}
$this->q_media = ilQuestionExporter::getFiles();
//questions export end
fputs(fopen($a_target_dir.'/index.html','w+'),$output);
$this->exportFileItems($a_target_dir, $expLog);
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilSCORM2004Sco::exportScorm (   $a_inst,
  $a_target_dir,
  $ver,
$expLog 
)

Definition at line 127 of file class.ilSCORM2004Sco.php.

References $ilBench, copy(), exportHTML(), exportXMLMediaObjects(), exportXMLMetaData(), exportXMLPageObjects(), ilSCORM2004Node\getId(), ilXmlWriter\xmlSetDtdDef(), xslt_create(), xslt_free(), and xslt_process().

{
copy('./xml/ilias_co_3_7.dtd',$a_target_dir.'/ilias_co_3_7.dtd');
copy('./Modules/Scorm2004/templates/xsl/sco.xsl',$a_target_dir.'/sco.xsl');
$a_xml_writer = new ilXmlWriter;
// MetaData
//file_put_contents($a_target_dir.'/indexMD.xml','<lom xmlns="http://ltsc.ieee.org/xsd/LOM"><general/><classification/></lom>');
$this->exportXMLMetaData($a_xml_writer);
$metadata_xml = $a_xml_writer->xmlDumpMem(false);
$a_xml_writer->_XmlWriter;
$xsl = file_get_contents("./Modules/Scorm2004/templates/xsl/metadata.xsl");
$args = array( '/_xml' => $metadata_xml , '/_xsl' => $xsl );
$xh = xslt_create();
$output = xslt_process($xh,"arg:/_xml","arg:/_xsl",NULL,$args,NULL);
xslt_free($xh);
file_put_contents($a_target_dir.'/indexMD.xml',$output);
$a_xml_writer = new ilXmlWriter;
// set dtd definition
$a_xml_writer->xmlSetDtdDef("<!DOCTYPE ContentObject SYSTEM \"http://www.ilias.de/download/dtd/ilias_co_3_7.dtd\">");
// set generated comment
$a_xml_writer->xmlSetGenCmt("Export of ILIAS Content Module ". $this->getId()." of installation ".$a_inst.".");
// set xml header
$a_xml_writer->xmlHeader();
global $ilBench;
$a_xml_writer->xmlStartTag("ContentObject", array("Type"=>"SCORM2004SCO"));
$this->exportXMLMetaData($a_xml_writer);
$this->exportXMLPageObjects($a_target_dir, $a_xml_writer, $a_inst, $expLog);
$this->exportXMLMediaObjects($a_xml_writer, $a_inst, $a_target_dir, $expLog);
$this->exportHTML($a_inst, $a_target_dir, $expLog);
//overwrite scorm.js for scrom 1.2
if ($ver=="12")
copy('./Modules/Scorm2004/scripts/scorm_12.js',$a_target_dir.'/js/scorm.js');
$a_xml_writer->xmlEndTag("ContentObject");
$a_xml_writer->xmlDumpFile($a_target_dir.'/index.xml', false);
$a_xml_writer->_XmlWriter;
}

+ Here is the call graph for this function:

ilSCORM2004Sco::exportXMLMediaObjects ( $a_xml_writer,
  $a_inst,
  $a_target_dir,
$expLog 
)

Definition at line 536 of file class.ilSCORM2004Sco.php.

Referenced by exportScorm().

{
include_once("./Services/MediaObjects/classes/class.ilObjMediaObject.php");
$linked_mobs = array();
if(is_array($this->mob_ids ))
{
// mobs directly embedded into pages
foreach ($this->mob_ids as $mob_id)
{
if ($mob_id > 0)
{
$expLog->write(date("[y-m-d H:i:s] ")."Media Object ".$mob_id);
$media_obj = new ilObjMediaObject($mob_id);
$media_obj->exportXML($a_xml_writer, $a_inst);
$lmobs = $media_obj->getLinkedMediaObjects($this->mob_ids);
$linked_mobs = array_merge($linked_mobs, $lmobs);
unset($media_obj);
}
}
// linked mobs (in map areas)
foreach ($linked_mobs as $mob_id)
{
if ($mob_id > 0)
{
$expLog->write(date("[y-m-d H:i:s] ")."Media Object ".$mob_id);
$media_obj = new ilObjMediaObject($mob_id);
$media_obj->exportXML($a_xml_writer, $a_inst);
unset($media_obj);
}
}
}
}

+ Here is the caller graph for this function:

ilSCORM2004Sco::exportXMLMetaData ( $a_xml_writer)

Definition at line 634 of file class.ilSCORM2004Sco.php.

References ilSCORM2004Node\getId(), ilSCORM2004Node\getSLMId(), and ilSCORM2004Node\getType().

Referenced by exportScorm().

{
include_once("Services/MetaData/classes/class.ilMD2XML.php");
$md2xml = new ilMD2XML($this->getSLMId(), $this->getId(), $this->getType());
$md2xml->setExportMode(true);
$md2xml->startExport();
$a_xml_writer->appendXML($md2xml->getXML());
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilSCORM2004Sco::exportXMLPageObjects (   $a_target_dir,
$a_xml_writer,
  $a_inst,
$expLog 
)

Definition at line 475 of file class.ilSCORM2004Sco.php.

References $ilBench, ilSCORM2004Page\_getQuestionIdsForPage(), and assQuestion\_instanciateQuestion().

Referenced by exportScorm().

{
global $ilBench;
include_once "./Modules/Scorm2004/classes/class.ilSCORM2004PageNode.php";
include_once "./Modules/Scorm2004/classes/class.ilSCORM2004Page.php";
$tree = new ilTree($this->slm_id);
$tree->setTableNames('sahs_sc13_tree', 'sahs_sc13_tree_node');
$tree->setTreeTablePK("slm_id");
foreach($tree->getSubTree($tree->getNodeData($this->getId()),true,'page') as $page)
{
$ilBench->start("ContentObjectExport", "exportPageObject");
$expLog->write(date("[y-m-d H:i:s] ")."Page Object ".$page["obj_id"]);
// export xml to writer object
$ilBench->start("ContentObjectExport", "exportPageObject_getLMPageObject");
$page_obj = new ilSCORM2004Page($page["obj_id"]);
$ilBench->stop("ContentObjectExport", "exportPageObject_getLMPageObject");
$ilBench->start("ContentObjectExport", "exportPageObject_XML");
$page_obj->exportXMLMetaData($a_xml_writer);
$page_obj->exportXML($a_xml_writer, "normal", $a_inst);
$ilBench->stop("ContentObjectExport", "exportPageObject_XML");
//collect media objects
$ilBench->start("ContentObjectExport", "exportPageObject_CollectMedia");
$mob_ids = $page_obj->getMediaObjectIds();
foreach($mob_ids as $mob_id)
{
$this->mob_ids[$mob_id] = $mob_id;
}
$ilBench->stop("ContentObjectExport", "exportPageObject_CollectMedia");
// collect all file items
$ilBench->start("ContentObjectExport", "exportPageObject_CollectFileItems");
$file_ids = $page_obj->getFileItemIds();
foreach($file_ids as $file_id)
{
$this->file_ids[$file_id] = $file_id;
}
$ilBench->stop("ContentObjectExport", "exportPageObject_CollectFileItems");
$q_ids = ilSCORM2004Page::_getQuestionIdsForPage("sahs", $page["obj_id"]);
if (count($q_ids) > 0)
{
include_once("./Modules/TestQuestionPool/classes/class.assQuestion.php");
foreach ($q_ids as $q_id)
{
$qti_file = fopen($a_target_dir."/qti_".$q_id.".xml", "w");
fwrite($qti_file, $q_obj->toXML());
fclose($qti_file);
}
}
unset($page_obj);
$ilBench->stop("ContentObjectExport", "exportPageObject");
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilSCORM2004Sco::fixFullscreeenLink (   $matches)
private

Definition at line 460 of file class.ilSCORM2004Sco.php.

{
$media_obj = new ilObjMediaObject($matches[1]);
if($media_obj->hasFullscreenItem())
{
return "href=\"./objects/il_".IL_INST_ID."_mob_".$matches[1]."/".$media_obj->getMediaItem("Fullscreen")->getLocation()."\"";
}
}
ilSCORM2004Sco::getExportFiles ( )

Definition at line 643 of file class.ilSCORM2004Sco.php.

References $dir, $file, ilSCORM2004Node\$type, ilSCORM2004Node\getId(), and ilSCORM2004Node\getType().

{
$file = array();
require_once("./Modules/Scorm2004/classes/class.ilSCORM2004Export.php");
$export = new ilSCORM2004Export($this);
foreach ($export->getSupportedExportTypes() as $type)
{
$dir = $export->getExportDirectoryForType($type);
// quit if import dir not available
if (!@is_dir($dir) or !is_writeable($dir))
{
continue;
}
// open directory
$cdir = dir($dir);
// get files and save the in the array
while ($entry = $cdir->read())
{
if ($entry != "." and
$entry != ".." and
(
ereg("^[0-9]{10}_{2}[0-9]+_{2}(".$this->getType()."_)".$this->getId()."+\.zip\$", $entry) or
ereg("^[0-9]{10}_{2}[0-9]+_{2}(".$this->getType()."_)".$this->getId()."+\.pdf\$", $entry) or
ereg("^[0-9]{10}_{2}[0-9]+_{2}(".$this->getType()."_)".$this->getId()."+\.iso\$", $entry)
))
{
$file[$entry.$type] = array("type" => $type, "file" => $entry,
"size" => filesize($dir."/".$entry));
}
}
// close import directory
$cdir->close();
}
// sort files
ksort ($file);
reset ($file);
return $file;
}

+ Here is the call graph for this function:

ilSCORM2004Sco::ilSCORM2004Sco (   $a_slm_object,
  $a_id = 0 
)

Constructor public.

Definition at line 45 of file class.ilSCORM2004Sco.php.

References ilSCORM2004Node\ilSCORM2004Node(), and ilSCORM2004Node\setType().

Referenced by copy().

{
parent::ilSCORM2004Node($a_slm_object, $a_id);
$this->setType("sco");
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilSCORM2004Sco::insertQuestion (   $matches)
private

Definition at line 470 of file class.ilSCORM2004Sco.php.

{
$q_exporter = new ilQuestionExporter();
return $q_exporter->exportQuestion($matches[2]);
}

Field Documentation

ilSCORM2004Sco::$q_media = null

Definition at line 39 of file class.ilSCORM2004Sco.php.


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