ILIAS  Release_4_1_x_branch Revision 61804
 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)
 exportPDF ($a_inst, $a_target_dir, &$expLog)
 exportPDFPrepareXmlNFiles ($a_inst, $a_target_dir, &$expLog, &$a_xml_writer)
 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 ()
 getGlossaryTermIds ()
 Get glossary term ids in sco.
- 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.
 getSLMObject ()
 Get 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 17 of file class.ilSCORM2004Sco.php.

Member Function Documentation

ilSCORM2004Sco::copy (   $a_target_slm)

Copy sco.

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

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

Referenced by exportFileItems(), exportHTML(), exportPDF(), 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 46 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 35 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 64 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 723 of file class.ilSCORM2004Sco.php.

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

Referenced by exportHTMLPageObjects(), and exportPDFPrepareXmlNFiles().

{
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 176 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.'/css/yahoo');
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('container/container_core-min.js'), $a_target_dir.'/js/yahoo/container_core-min.js');
copy(ilYuiUtil::getLocalPath('animation/animation-min.js'), $a_target_dir.'/js/yahoo/animation-min.js');
copy(ilYuiUtil::getLocalPath('container/assets/skins/sam/container.css'), $a_target_dir.'/css/yahoo/container.css');
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');
copy('./Services/UIComponent/Overlay/js/ilOverlay.js',$a_target_dir.'/js/ilOverlay.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 249 of file class.ilSCORM2004Sco.php.

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

Referenced by exportPDFPrepareXmlNFiles().

{
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:

+ Here is the caller graph for this function:

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

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

References $ilBench, $ilCtrl, $ilLog, $lng, $tpl, ilInternalLink\_extractObjIdOfTarget(), assQuestionGUI\_getQuestionGUI(), ilPageObject\_getQuestionIdsForPage(), exportFileItems(), ilGlossaryDefinition\getDefinitionList(), ilQuestionExporter\getFiles(), ilSCORM2004PageGUI\getGlossaryHTML(), ilSCORM2004ScoGUI\getGlossaryOverviewId(), getGlossaryTermIds(), ilSCORM2004Node\getId(), ilQuestionExporter\getMobs(), ilSCORM2004Node\getObjectives(), ilSCORM2004Node\getSLMId(), ilSCORM2004Node\getTitle(), ilSCORM2004Node\getType(), IL_PAGE_OFFLINE, ilQuestionExporter\indicateNewSco(), ilSCORM2004PageGUI\initExport(), 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" />
<link rel="stylesheet" type="text/css" href="./css/yahoo/container.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/container_core-min.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/ilOverlay.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);
ilias.questions.txt.wrong_answers = "'.$lng->txt("cont_wrong_answers").'";
ilias.questions.txt.tries_remaining = "'.$lng->txt("cont_tries_remaining").'";
ilias.questions.txt.please_try_again = "'.$lng->txt("cont_please_try_again").'";
ilias.questions.txt.all_answers_correct = "'.$lng->txt("cont_all_answers_correct").'";
ilias.questions.txt.nr_of_tries_exceeded = "'.$lng->txt("cont_nr_of_tries_exceeded").'";
ilias.questions.txt.correct_answers_shown = "'.$lng->txt("cont_correct_answers_shown").'";
});
</script>
<script src="./js/accordion.js" type="text/javascript" language="JavaScript1.2"></script>
<title>'.$this->getTitle().'</title>
</head>
<body class="yui-skin-sam" 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;'.$lng->txt('scplayer_previous').'</a>
</div>
<!-- END ilLMNavigation_Prev -->
<!-- BEGIN ilLMNavigation_Next -->
<div class="ilc_page_rnav_RightNavigation">
<a class="ilc_page_rnavlink_RightNavigationLink">'.$lng->txt('scplayer_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 -->';
// init export (this initialises glossary template)
$terms = $this->getGlossaryTermIds();
include_once("./Modules/Scorm2004/classes/class.ilSCORM2004ScoGUI.php");
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());
if (count($terms) > 1)
{
$page_obj->setGlossaryOverviewInfo(
}
$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;
$media_obj = new ilObjMediaObject($mob_id);
if($media_obj->hasFullscreenItem())
$media_obj->exportMediaFullscreen($a_target_dir, $page_obj->getPageObject());
}
$ilBench->stop("ContentObjectExport", "exportPageObject_CollectMedia");
// collect glossary items
$int_links = $page_obj->getPageObject()->getInternalLinks(true);
include_once("./Services/COPage/classes/class.ilInternalLink.php");
include_once("./Modules/Glossary/classes/class.ilGlossaryDefinition.php");
include_once("./Services/COPage/classes/class.ilPageObject.php");
if (is_array($int_links))
{
foreach ($int_links as $k => $e)
{
// glossary link
if ($e["Type"] == "GlossaryItem")
{
$karr = explode(":", $k);
foreach ($dids as $did)
{
$def_pg = new ilPageObject("gdf", $did["id"]);
$def_pg->buildDom();
$mob_ids = $def_pg->collectMediaObjects(false);
foreach($mob_ids as $mob_id)
{
$this->mob_ids[$mob_id] = $mob_id;
//echo "<br>-$mob_id-";
$media_obj = new ilObjMediaObject($mob_id);
if($media_obj->hasFullscreenItem())
$media_obj->exportMediaFullscreen($a_target_dir, $def_pg);
}
$file_ids = $def_pg->collectFileItems();
foreach($file_ids as $file_id)
{
$this->file_ids[$file_id] = $file_id;
}
}
}
}
}
//exit;
// 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')
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;'.$lng->txt('scplayer_previous').'</a>
</div>
<!-- END ilLMNavigation_Prev -->
<!-- BEGIN ilLMNavigation_Next -->
<div class="ilc_page_rnav_RightNavigation">
<a class="ilc_page_rnavlink_RightNavigationLink">'.$lng->txt('scplayer_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("/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);
// this one is for fullscreen in glossary entries
$output = preg_replace_callback("/href=\"fullscreen_(\d+)\.html\"/",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::exportPDF (   $a_inst,
  $a_target_dir,
$expLog 
)

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

References $ilCtrl, $lng, $results, $tpl, copy(), exportPDFPrepareXmlNFiles(), ilFileUtils\recursive_dirscan(), and ilXmlWriter\xmlStartTag().

{
global $tpl, $lng, $ilCtrl;
$a_xml_writer = new ilXmlWriter;
$a_xml_writer->xmlStartTag("ContentObject", array("Type"=>"SCORM2004SCO"));
$this->exportPDFPrepareXmlNFiles($a_inst, $a_target_dir, $expLog,$a_xml_writer);
$a_xml_writer->xmlEndTag("ContentObject");
copy('./templates/default/images/icon_attachment_s.png',$a_target_dir."/icon_attachment_s.png");
include_once 'Services/Transformation/classes/class.ilXML2FO.php';
$xml2FO = new ilXML2FO();
$xml2FO->setXSLTLocation('./Modules/Scorm2004/templates/xsl/contentobject2fo.xsl');
$xml2FO->setXMLString($a_xml_writer->xmlDumpMem());
$xml2FO->setXSLTParams(array ('target_dir' => $a_target_dir));
$xml2FO->transform();
$fo_string = $xml2FO->getFOString();
$fo_xml = simplexml_load_string($fo_string);
$fo_ext = $fo_xml->xpath("//fo:declarations");
$fo_ext = $fo_ext[0];
$results = array();
include_once "./Services/Utilities/classes/class.ilFileUtils.php";
ilFileUtils::recursive_dirscan($a_target_dir."/objects", $results);
if (is_array($results["file"]))
{
foreach ($results["file"] as $key => $value)
{
$e = $fo_ext->addChild("fox:embedded-file","","http://xml.apache.org/fop/extensions");
$e->addAttribute("src",$results[path][$key].$value);
$e->addAttribute("name",$value);
$e->addAttribute("desc","");
}
}
$fo_string = $fo_xml->asXML();
$a_xml_writer->_XmlWriter;
return $fo_string;
}

+ Here is the call graph for this function:

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

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

References $ilCtrl, $lng, $tpl, ilPageObject\_getQuestionIdsForPage(), assQuestion\_instanciateQuestion(), exportFileItems(), exportHTML4PDF(), exportXMLMediaObjects(), and exportXMLPageObjects().

Referenced by exportPDF().

{
$this->exportHTML4PDF($a_inst, $a_target_dir, $expLog);
global $tpl, $lng, $ilCtrl;
$this->exportXMLPageObjects($a_target_dir, $a_xml_writer, $a_inst, $expLog);
$this->exportXMLMediaObjects($a_xml_writer, $a_inst, $a_target_dir, $expLog);
$this->exportFileItems($a_target_dir,$expLog);
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)
{
$page_obj = new ilSCORM2004Page($page["obj_id"]);
$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);
$x = file_get_contents($a_target_dir."/qti_".$q_id.".xml");
$x = str_replace('<?xml version="1.0" encoding="utf-8"?>', '', $x);
$a_xml_writer->appendXML($x);
}
}
unset($page_obj);
}
}

+ 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 108 of file class.ilSCORM2004Sco.php.

References $data, $ilBench, copy(), exportHTML(), exportXMLMediaObjects(), exportXMLMetaData(), exportXMLPageObjects(), ilSCORM2004Node\getId(), ilSCORM2004Node\getObjectives(), 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;
// export sco data (currently only objective) to sco.xml
$objectives_text = "";
$a_xml_writer = new ilXmlWriter;
$tr_data = $this->getObjectives();
foreach ($tr_data as $data)
{
$objectives_text.= $data->getObjectiveID();
}
$a_xml_writer->xmlStartTag("sco");
$a_xml_writer->xmlElement("objective", null, $objectives_text);
$a_xml_writer->xmlEndTag("sco");
$a_xml_writer->xmlDumpFile($a_target_dir.'/sco.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 675 of file class.ilSCORM2004Sco.php.

Referenced by exportPDFPrepareXmlNFiles(), and exportScorm().

{
include_once("./Services/MediaObjects/classes/class.ilObjMediaObject.php");
include_once("./Modules/File/classes/class.ilObjFile.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);
}
}
}
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);
}
}

+ Here is the caller graph for this function:

ilSCORM2004Sco::exportXMLMetaData ( $a_xml_writer)

Definition at line 781 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 614 of file class.ilSCORM2004Sco.php.

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

Referenced by exportPDFPrepareXmlNFiles(), and 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 598 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]."/fullscreen.html\"";
//return "href=\"./objects/il_".IL_INST_ID."_mob_".$matches[1]."/".$media_obj->getMediaItem("Fullscreen")->getLocation()."\"";
}
}
ilSCORM2004Sco::getExportFiles ( )

Definition at line 790 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::getGlossaryTermIds ( )

Get glossary term ids in sco.

Parameters
@return

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

References ilInternalLink\_getTargetsOfSource(), ilGlossaryTerm\_lookGlossaryTerm(), and ilSCORM2004Node\getId().

Referenced by exportHTMLPageObjects().

{
include_once("./Modules/Glossary/classes/class.ilGlossaryTerm.php");
$childs = $this->tree->getChilds($this->getId());
$ids = array();
foreach ($childs as $c)
{
$links = ilInternalLink::_getTargetsOfSource("sahs".":pg",
$c["child"]);
foreach ($links as $l)
{
if ($l["type"] == "git" && (int) $l["inst"] == 0 && !isset($ids[$l["id"]]))
{
$ids[$l["id"]] = ilGlossaryTerm::_lookGlossaryTerm($l["id"]);
}
}
}
asort($ids);
return $ids;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

Constructor public.

Definition at line 26 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 609 of file class.ilSCORM2004Sco.php.

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

Field Documentation

ilSCORM2004Sco::$q_media = null

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


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