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

Class ilSCORM2004Asset. More...

+ Inheritance diagram for ilSCORM2004Asset:
+ Collaboration diagram for ilSCORM2004Asset:

Public Member Functions

 __construct ($a_slm_object, $a_id=0)
 Constructor.
 delete ($a_delete_meta_data=true)
 Delete a SCO.
 create ($a_upload=false, $a_template=false)
 Create asset.
 copy ($a_target_slm)
 Copy sco.
 exportScorm ($a_inst, $a_target_dir, $ver, &$expLog)
 exportHTML ($a_inst, $a_target_dir, &$expLog, $a_asset_type="sco", $a_one_file="")
 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, $a_asset_type="sco", $a_one_file="", $a_sco_tpl=null)
 Export HTML pages of SCO.
 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 ()

Static Public Member Functions

static renderNavigation ($a_tpl, $a_spacer_img="", $a_lang="")
 Render navigation.
static renderMetaPage ($a_tpl, $a_sco, $a_asset_type="", $mode="")
 Render meta page (description/objectives at beginning)
static convertLists ($a_text)
 Convert * and # to lists.
- 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 insertAssetClip ($a_slm_obj, $a_type="ass")
 Insert assets 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, $a_from_clipboard=true)
 Paste item (tree) from clipboard or other learning module to target scorm learning module.

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)

Detailed Description

Class ilSCORM2004Asset.

Asset 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 16 of file class.ilSCORM2004Asset.php.

Constructor & Destructor Documentation

ilSCORM2004Asset::__construct (   $a_slm_object,
  $a_id = 0 
)

Constructor.

Reimplemented in ilSCORM2004Sco.

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

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

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

+ Here is the call graph for this function:

Member Function Documentation

static ilSCORM2004Asset::convertLists (   $a_text)
static

Convert * and # to lists.

Parameters
string$a_texttext
Returns
string text

Definition at line 661 of file class.ilSCORM2004Asset.php.

References ilPCParagraph\input2xmlReplaceLists().

Referenced by ilObjectivesAlignmentTableGUI\fillRow().

{
include_once("./Services/COPage/classes/class.ilPCParagraph.php");
$a_text = nl2br($a_text);
$a_text = str_replace(array("\n", "\r"), "", $a_text);
$a_text = str_replace("<br>", "<br />", $a_text);
$a_text = str_replace(
array("<SimpleBulletList>", "</SimpleBulletList>",
"<SimpleListItem>", "</SimpleListItem>",
"<SimpleNumberedList>", "</SimpleNumberedList>"
),
array("<ul class='ilc_list_u_BulletedList'>", "</ul>",
"<li class='ilc_list_item_StandardListItem'>", "</li>",
"<ol class='ilc_list_o_NumberedList'>", "</ol>"
),
$a_text);
return $a_text;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilSCORM2004Asset::copy (   $a_target_slm)

Copy sco.

Reimplemented in ilSCORM2004Sco.

Definition at line 78 of file class.ilSCORM2004Asset.php.

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

Referenced by exportFileItems(), exportHTMLPageObjects(), exportPDF(), and exportScorm().

{
$ass = new ilSCORM2004Asset($a_target_slm);
$ass->setTitle($this->getTitle());
if ($this->getSLMId() != $a_target_slm->getId())
{
$ass->setImportId("il__ass_".$this->getId());
}
$ass->setSLMId($a_target_slm->getId());
$ass->setType($this->getType());
$ass->setDescription($this->getDescription());
$ass->create(true);
$a_copied_nodes[$this->getId()] = $ass->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(), $ass->getId(), $this->getType());
return $ass;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

Create asset.

Reimplemented in ilSCORM2004Sco.

Definition at line 43 of file class.ilSCORM2004Asset.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();
}
}

+ Here is the call graph for this function:

ilSCORM2004Asset::delete (   $a_delete_meta_data = true)

Delete a SCO.

Definition at line 32 of file class.ilSCORM2004Asset.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:

ilSCORM2004Asset::delete_rec (   $a_delete_meta_data = true)
private

Delete Nested Page Objects.

Definition at line 57 of file class.ilSCORM2004Asset.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:

ilSCORM2004Asset::exportFileItems (   $a_target_dir,
$expLog 
)

export files of file itmes

Definition at line 800 of file class.ilSCORM2004Asset.php.

References ilObject\_exists(), ilObject\_lookupType(), 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);
if (ilObject::_lookupType($file_id) == "file")
{
$file_obj = new ilObjFile($file_id, false);
$file_obj->export($a_target_dir);
unset($file_obj);
}
else
{
$expLog->write(date("[y-m-d H:i:s] ")."File Item not found, ID: ".$file_id);
}
}
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:

ilSCORM2004Asset::exportHTML (   $a_inst,
  $a_target_dir,
$expLog,
  $a_asset_type = "sco",
  $a_one_file = "" 
)

Definition at line 172 of file class.ilSCORM2004Asset.php.

References exportHTMLPageObjects().

Referenced by ilSCORM2004EntryAsset\exportScorm(), ilSCORM2004FinalAsset\exportScorm(), and exportScorm().

{
$this->slm_object->prepareHTMLExporter($a_target_dir);
$this->exportHTMLPageObjects($a_inst, $a_target_dir, $expLog, 'full',
$a_asset_type, $a_one_file);
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

Definition at line 183 of file class.ilSCORM2004Asset.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:

ilSCORM2004Asset::exportHTMLPageObjects (   $a_inst,
  $a_target_dir,
$expLog,
  $mode,
  $a_asset_type = "sco",
  $a_one_file = "",
  $a_sco_tpl = null 
)

Export HTML pages of SCO.

Definition at line 267 of file class.ilSCORM2004Asset.php.

References $ilBench, $ilCtrl, $ilLog, $lng, $tpl, ilInternalLink\_extractObjIdOfTarget(), assQuestionGUI\_getQuestionGUI(), ilPageObject\_getQuestionIdsForPage(), copy(), exportFileItems(), ilObjSAHSLearningModule\getAffectiveLocalization(), ilGlossaryDefinition\getDefinitionList(), ilQuestionExporter\getFiles(), ilSCORM2004PageGUI\getGlossaryHTML(), ilSCORM2004ScoGUI\getGlossaryOverviewId(), getGlossaryTermIds(), ilSCORM2004Node\getId(), ilPageObjectGUI\getJSTextInitCode(), ilQuestionExporter\getMobs(), ilSCORM2004Node\getTitle(), ilSCORM2004Node\getType(), IL_PAGE_OFFLINE, ilQuestionExporter\indicateNewSco(), ilSCORM2004PageGUI\initExport(), ilQuestionExporter\questionsJS(), renderMetaPage(), renderNavigation(), and ilPageObjectGUI\setPresentationTitle().

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");
// @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
//
// if ($a_one_file == "")
// {
$sco_tpl = new ilTemplate("tpl.sco.html", true, true, "Modules/Scorm2004");
// }
// else
// {
// $sco_tpl = $a_sco_tpl;
// }
if ($mode != 'pdf' && $a_one_file == "")
{
include_once("./Services/COPage/classes/class.ilCOPageHTMLExport.php");
$pg_exp = new ilCOPageHTMLExport($a_target_dir);
$pg_exp->getPreparedMainTemplate($sco_tpl);
// init and question lang vars
$sco_tpl->setCurrentBlock("init");
$sco_tpl->setVariable("TXT_INIT_CODE",
$sco_tpl->parseCurrentBlock();
// (additional) style sheets needed
$styles = array("./css/yahoo/container.css",
"./css/question_handling.css");
foreach ($styles as $style)
{
$sco_tpl->setCurrentBlock("css_file");
$sco_tpl->setVariable("CSS_FILE", $style);
$sco_tpl->parseCurrentBlock();
}
// (additional) scripts needed
$scripts = array("./js/scorm.js",
"./js/pager.js", "./js/pure.js",
"./js/questions_".$this->getId().".js");
foreach ($scripts as $script)
{
$sco_tpl->setCurrentBlock("js_file");
$sco_tpl->setVariable("JS_FILE", $script);
$sco_tpl->parseCurrentBlock();
}
if ($a_asset_type != "entry_asset" && $a_asset_type != "final_asset")
{
self::renderNavigation($sco_tpl, "./images/spacer.png", $lk);
}
$sco_tpl->touchBlock("finish");
}
// render head
$sco_tpl->setCurrentBlock("head");
$sco_tpl->setVariable("SCO_TITLE", $this->getTitle());
$sco_tpl->parseCurrentBlock();
$sco_tpl->touchBlock("tail");
// meta page (meta info at SCO beginning)
self::renderMetaPage($sco_tpl, $this, $a_asset_type, $mode);
if ($a_one_file != "")
{
fputs($a_one_file, "<a name='sco".$this->getId()."'></a>");
fputs($a_one_file, $sco_tpl->get("meta_page"));
}
//notify Question Exporter of new SCO
require_once './Modules/Scorm2004/classes/class.ilQuestionExporter.php';
// init export (this initialises glossary template)
$terms = array();
$terms = $this->getGlossaryTermIds();
include_once("./Modules/Scorm2004/classes/class.ilSCORM2004ScoGUI.php");
$pages = $tree->getSubTree($tree->getNodeData($this->getId()),true,'page');
$sco_q_ids = array();
foreach($pages as $page)
{
//echo(print_r($page));
$page_obj = new ilSCORM2004PageGUI($this->getType(), $page["obj_id"], 0,
$this->slm_object->getId());
$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(
}
$page_output = $page_obj->showPage("export");
// collect media objects
$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());
}
// 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
$file_ids = $page_obj->getSCORM2004Page()->collectFileItems();
foreach($file_ids as $file_id)
{
$this->file_ids[$file_id] = $file_id;
}
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);
$page_output = preg_replace("/{{{{{Question;il__qst_".$q_id."}}}}}/i",$html,$page_output);
}
$sco_tpl->touchBlock("pdf_pg_break");
}
$sco_tpl->setCurrentBlock("page");
$sco_tpl->setVariable("PAGE", $page_output);
$sco_tpl->parseCurrentBlock();
// get all question ids of the sco
if ($a_one_file != "")
{
$q_ids = ilSCORM2004Page::_getQuestionIdsForPage("sahs", $page["obj_id"]);
foreach ($q_ids as $i)
{
if (!in_array($i, $sco_q_ids))
{
$sco_q_ids[] = $i;
}
}
}
}
// glossary
if ($mode!='pdf')
{
$sco_tpl->setVariable("GLOSSARY_HTML",
}
if ($a_one_file == "")
{
$output = $sco_tpl->get();
}
else
{
$output = $sco_tpl->get("page");
}
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("/\.\/".str_replace("/", "\/", ilPlayerUtil::getFlashVideoPlayerDirectory())."/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);
copy("./Modules/Scorm2004/templates/default/question_handling.css",
$a_target_dir.'/css/question_handling.css');
// hack to get the question js into the file and to display the correct answers
if ($a_one_file != "")
{
$output = '<script type="text/javascript">'.ilQuestionExporter::questionsJS().'</script>'.$output;
if (count($sco_q_ids) > 0)
{
$output.= '<script type="text/javascript">';
foreach ($sco_q_ids as $i)
{
if ($i > 0)
{
$output.= "ilias.questions.showCorrectAnswers(".$i."); \n";
}
}
$output.= '</script>';
}
}
foreach(ilQuestionExporter::getMobs() as $mob_id)
{
$this->mob_ids[$mob_id] = $mob_id;
}
}
$this->q_media = ilQuestionExporter::getFiles();
//questions export end
if ($a_one_file != "")
{
fputs($a_one_file, $output);
}
else
{
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:

ilSCORM2004Asset::exportPDF (   $a_inst,
  $a_target_dir,
$expLog 
)

Definition at line 191 of file class.ilSCORM2004Asset.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:

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

Definition at line 227 of file class.ilSCORM2004Asset.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:

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

Definition at line 102 of file class.ilSCORM2004Asset.php.

References $data, $ilBench, copy(), exportHTML(), exportXMLMediaObjects(), exportXMLMetaData(), exportXMLPageObjects(), ilSCORM2004Node\getId(), ilSCORM2004Node\getObjectives(), ilSCORM2004Node\getType(), 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
if ($this->getType() == "sco")
{
$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:

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

Definition at line 752 of file class.ilSCORM2004Asset.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:

ilSCORM2004Asset::exportXMLMetaData ( $a_xml_writer)

Definition at line 865 of file class.ilSCORM2004Asset.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:

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

Definition at line 700 of file class.ilSCORM2004Asset.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");
$pages = $tree->getSubTree($tree->getNodeData($this->getId()),true,'page');
foreach($pages as $page)
{
$expLog->write(date("[y-m-d H:i:s] ")."Page Object ".$page["obj_id"]);
// export xml to writer object
$page_obj = new ilSCORM2004Page($page["obj_id"]);
$page_obj->exportXML($a_xml_writer, "normal", $a_inst);
//collect media objects
$mob_ids = $page_obj->getMediaObjectIds();
foreach($mob_ids as $mob_id)
{
$this->mob_ids[$mob_id] = $mob_id;
}
// collect all file items
$file_ids = $page_obj->getFileItemIds();
foreach($file_ids as $file_id)
{
$this->file_ids[$file_id] = $file_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);
}
}
unset($page_obj);
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilSCORM2004Asset::fixFullscreeenLink (   $matches)
private

Definition at line 681 of file class.ilSCORM2004Asset.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()."\"";
}
}
ilSCORM2004Asset::getExportFiles ( )

Definition at line 874 of file class.ilSCORM2004Asset.php.

References $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:

ilSCORM2004Asset::getGlossaryTermIds ( )

Get glossary term ids in sco.

Parameters
@return

Definition at line 924 of file class.ilSCORM2004Asset.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:

ilSCORM2004Asset::insertQuestion (   $matches)
private

Definition at line 692 of file class.ilSCORM2004Asset.php.

References $ret.

{
$q_exporter = new ilQuestionExporter();
$ret = $q_exporter->exportQuestion($matches[2], "./objects/");
return $ret;
}
static ilSCORM2004Asset::renderMetaPage (   $a_tpl,
  $a_sco,
  $a_asset_type = "",
  $mode = "" 
)
static

Render meta page (description/objectives at beginning)

Parameters
object$a_tpltemplate
object$a_scoSCO
string$a_asset_typeasset type
string$a_modemode

Definition at line 588 of file class.ilSCORM2004Asset.php.

References $lng, and ilMD\getGeneral().

Referenced by exportHTMLPageObjects(), and ilSCORM2004ScoGUI\sco_preview().

{
global $lng;
if ($a_sco->getType() != "sco" || $a_sco->getHideObjectivePage())
{
return;
}
if ($a_asset_type != "entry_asset" && $a_asset_type != "final_asset")
{
$meta = new ilMD($a_sco->getSLMId(), $a_sco->getId(), $a_sco->getType());
$desc_ids = $meta->getGeneral()->getDescriptionIds();
$sco_description = $meta->getGeneral()->getDescription($desc_ids[0])->getDescription();
}
if ($mode != 'pdf')
{
// title
if ($a_asset_type != "entry_asset" && $a_asset_type != "final_asset")
{
$a_tpl->setCurrentBlock("title");
$a_tpl->setVariable("SCO_TITLE", $a_sco->getTitle());
$a_tpl->parseCurrentBlock();
}
}
else
{
// title
$a_tpl->setCurrentBlock("pdf_title");
$a_tpl->setVariable("SCO_TITLE", $a_sco->getTitle());
$a_tpl->parseCurrentBlock();
$a_tpl->touchBlock("pdf_break");
}
// sco description
if (trim($sco_description) != "")
{
$a_tpl->setCurrentBlock("sco_desc");
$a_tpl->setVariable("TXT_DESC", $lng->txt("description"));
include_once("./Services/COPage/classes/class.ilPCParagraph.php");
$a_tpl->setVariable("VAL_DESC", self::convertLists($sco_description));
$a_tpl->parseCurrentBlock();
}
if ($a_asset_type == "sco")
{
// sco objective(s)
$objs = $a_sco->getObjectives();
if (count($objs) > 0)
{
foreach ($objs as $objective)
{
$a_tpl->setCurrentBlock("sco_obj");
$a_tpl->setVariable("VAL_OBJECTIVE", self::convertLists($objective->getObjectiveID()));
$a_tpl->parseCurrentBlock();
}
$a_tpl->setCurrentBlock("sco_objs");
$a_tpl->setVariable("TXT_OBJECTIVES", $lng->txt("sahs_objectives"));
$a_tpl->parseCurrentBlock();
}
}
$a_tpl->setCurrentBlock("meta_page");
$a_tpl->parseCurrentBlock();
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static ilSCORM2004Asset::renderNavigation (   $a_tpl,
  $a_spacer_img = "",
  $a_lang = "" 
)
static

Render navigation.

Parameters
object$a_tpltemplate
string$a_spacer_imgpath to spacer image

Definition at line 555 of file class.ilSCORM2004Asset.php.

References $lng, and ilUtil\getImagePath().

Referenced by exportHTMLPageObjects(), and ilSCORM2004ScoGUI\sco_preview().

{
global $lng;
if ($a_spacer_img == "")
{
$a_spacer_img = ilUtil::getImagePath("spacer.png");
}
if ($a_lang == "")
{
$a_lang = $lng->getLangKey();
}
// previous/next navigation
$a_tpl->setCurrentBlock("ilLMNavigation");
$a_tpl->setVariable("TXT_PREVIOUS", $lng->txtlng("content", 'scplayer_previous', $a_lang));
$a_tpl->setVariable("SRC_SPACER", $a_spacer_img);
$a_tpl->setVariable("TXT_NEXT", $lng->txtlng("content", 'scplayer_next', $a_lang));
$a_tpl->parseCurrentBlock();
$a_tpl->setCurrentBlock("ilLMNavigation2");
$a_tpl->setVariable("TXT_PREVIOUS", $lng->txtlng("content", 'scplayer_previous', $a_lang));
$a_tpl->setVariable("SRC_SPACER", $a_spacer_img);
$a_tpl->setVariable("TXT_NEXT", $lng->txtlng("content", 'scplayer_next', $a_lang));
$a_tpl->parseCurrentBlock();
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Field Documentation

ilSCORM2004Asset::$q_media = null

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


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