ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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. More...
 
 delete ($a_delete_meta_data=true)
 Delete a SCO. More...
 
 create ($a_upload=false, $a_template=false)
 Create asset. More...
 
 insertDefaultSequencingItem ()
 Insert default sequencing item. More...
 
 copy ($a_target_slm)
 Copy sco. More...
 
 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. More...
 
 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 More...
 
 exportXMLMetaData (&$a_xml_writer)
 
 getExportFiles ()
 
 getGlossaryTermIds ()
 Get glossary term ids in sco. More...
 
- Public Member Functions inherited from ilSCORM2004Node
 __construct ($a_slm_object, $a_id=0)
 
 setTitle ($a_title)
 Set title. More...
 
 getTitle ()
 Get title. More...
 
 setDescription ($a_description)
 Set description. More...
 
 getDescription ()
 Get description. More...
 
 setType ($a_type)
 Set type. More...
 
 getType ()
 Get type. More...
 
 setSLMId ($a_slm_id)
 Set ID of parent Scorm Learning Module Object. More...
 
 getSLMId ()
 Get ID of parent Scorm Learning Module Object. More...
 
 setSLMObject ($a_slm_obj)
 Set Scorm Learning Module Object. More...
 
 getSLMObject ()
 Get scorm learning module object. More...
 
 getContentObject ()
 Get Scorm Learning Module Object. More...
 
 setId ($a_id)
 Set Node ID. More...
 
 getId ()
 Get Node ID. More...
 
 getImportId ()
 Set Import ID. More...
 
 setImportId ($a_id)
 Get Import ID. More...
 
 read ()
 Read Data of Node. More...
 
 MDUpdateListener ($a_element)
 Meta data update listener. More...
 
 createMetaData ()
 create meta data entry More...
 
 updateMetaData ()
 update meta data entry More...
 
 deleteMetaData ()
 delete meta data entry More...
 
 setDataRecord ($a_record)
 this method should only be called by class ilSCORM2004NodeFactory More...
 
 create ($a_upload=false)
 Create Node. More...
 
 update ()
 Update Node. More...
 
 delete ()
 Delete Node. More...
 
 getObjectives ()
 
 deleteSeqInfo ()
 
 parentHasSeqTemplate ()
 
 exportAsScorm12 ()
 
 exportAsScorm13 ()
 

Static Public Member Functions

static renderNavigation ($a_tpl, $a_spacer_img="", $a_lang="")
 Render navigation. More...
 
static renderMetaPage ($a_tpl, $a_sco, $a_asset_type="", $mode="")
 Render meta page (description/objectives at beginning) More...
 
static convertLists ($a_text)
 Convert * and # to lists. More...
 
- Static Public Member Functions inherited from ilSCORM2004Node
static _lookupTitle ($a_obj_id)
 Lookup Title. More...
 
static _lookupType ($a_obj_id)
 Lookup Type. More...
 
static _writeTitle ($a_obj_id, $a_title)
 Write Title. More...
 
static _writeImportId ($a_id, $a_import_id)
 Write import ID. More...
 
static _getIdForImportId ($a_import_id)
 Get Node ID for import ID (static) More...
 
static _exists ($a_id)
 Checks wether a node exists. More...
 
static _deleteAllSLMNodes ($a_slm_object)
 Delete all nodes of Scorm Learning Module. More...
 
static _lookupSLMID ($a_id)
 Lookup Scorm Learning Module ID for node id. More...
 
static putInTree ($a_obj, $a_parent_id="", $a_target_node_id="")
 put this object into content object tree More...
 
static getTree ($a_slm_obj_id)
 Get scorm module editing tree. More...
 
static clipboardCopy ($a_slm_obj_id, $a_ids)
 Copy a set of chapters/pages/scos into the clipboard. More...
 
static clipboardCut ($a_slm_obj_id, $a_ids)
 Cut and copy a set of chapters/pages into the clipboard. More...
 
static uniqueTypesCheck ($a_items)
 Check for unique types (all pages or all chapters or all scos) More...
 
static insertPageClip ($a_slm_obj)
 Insert pages from clipboard. More...
 
static insertAssetClip ($a_slm_obj, $a_type="ass")
 Insert assets from clipboard. More...
 
static insertScoClip ($a_slm_obj)
 Insert scos from clipboard. More...
 
static insertChapterClip ($a_slm_obj, $a_as_sub=false)
 Insert Chapter from clipboard. More...
 
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, $a_source_parent_type="")
 Paste item (tree) from clipboard or other learning module to target scorm learning module. More...
 

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. More...
 

Static Private Member Functions

static fixFullscreeenLink ($matches)
 
static 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

◆ __construct()

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

Constructor.

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

References ilSCORM2004Node\setType().

24  {
25  parent::__construct($a_slm_object, $a_id);
26  $this->setType("ass");
27  }
setType($a_type)
Set type.
+ Here is the call graph for this function:

Member Function Documentation

◆ convertLists()

static ilSCORM2004Asset::convertLists (   $a_text)
static

Convert * and # to lists.

Parameters
string$a_texttext
Returns
string text

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

References array, and ilPCParagraph\input2xmlReplaceLists().

Referenced by ilObjectivesAlignmentTableGUI\fillRow().

682  {
683  include_once("./Services/COPage/classes/class.ilPCParagraph.php");
684  $a_text = nl2br($a_text);
685  $a_text = str_replace(array("\n", "\r"), "", $a_text);
686  $a_text = str_replace("<br>", "<br />", $a_text);
687  $a_text = ilPCParagraph::input2xmlReplaceLists($a_text);
688  $a_text = str_replace(
689  array("<SimpleBulletList>", "</SimpleBulletList>",
690  "<SimpleListItem>", "</SimpleListItem>",
691  "<SimpleNumberedList>", "</SimpleNumberedList>"
692  ),
693  array("<ul class='ilc_list_u_BulletedList'>", "</ul>",
694  "<li class='ilc_list_item_StandardListItem'>", "</li>",
695  "<ol class='ilc_list_o_NumberedList'>", "</ol>"
696  ),
697  $a_text);
698  return $a_text;
699  }
static input2xmlReplaceLists($a_text)
Converts xml from DB to output in edit textarea.
Create styles array
The data for the language used.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ copy()

ilSCORM2004Asset::copy (   $a_target_slm)

Copy sco.

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

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

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

91  {
92  $ass = new ilSCORM2004Asset($a_target_slm);
93  $ass->setTitle($this->getTitle());
94  if ($this->getSLMId() != $a_target_slm->getId())
95  {
96  $ass->setImportId("il__ass_".$this->getId());
97  }
98  $ass->setSLMId($a_target_slm->getId());
99  $ass->setType($this->getType());
100  $ass->setDescription($this->getDescription());
101  $ass->create(true);
102  $a_copied_nodes[$this->getId()] = $ass->getId();
103 
104  // copy meta data
105  include_once("Services/MetaData/classes/class.ilMD.php");
106  $md = new ilMD($this->getSLMId(), $this->getId(), $this->getType());
107  $new_md = $md->cloneMD($a_target_slm->getId(), $ass->getId(), $this->getType());
108 
109  return $ass;
110  }
getSLMId()
Get ID of parent Scorm Learning Module Object.
getDescription()
Get description.
Class ilSCORM2004Asset.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ create()

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

Create asset.

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

References insertDefaultSequencingItem().

44  {
45  include_once("./Modules/Scorm2004/classes/seq_editor/class.ilSCORM2004Item.php");
46  include_once("./Modules/Scorm2004/classes/seq_editor/class.ilSCORM2004Objective.php");
47  parent::create($a_upload);
48  if (!$a_template) {
50  }
51  }
insertDefaultSequencingItem()
Insert default sequencing item.
+ Here is the call graph for this function:

◆ delete()

ilSCORM2004Asset::delete (   $a_delete_meta_data = true)

Delete a SCO.

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

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

33  {
34  $node_data = $this->tree->getNodeData($this->getId());
35  $this->delete_rec($a_delete_meta_data);
36  $this->tree->deleteTree($node_data);
37  parent::deleteSeqInfo();
38  }
delete_rec($a_delete_meta_data=true)
Delete Nested Page Objects.
+ Here is the call graph for this function:

◆ delete_rec()

ilSCORM2004Asset::delete_rec (   $a_delete_meta_data = true)
private

Delete Nested Page Objects.

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

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

Referenced by delete().

70  {
71  $childs = $this->tree->getChilds($this->getId());
72  foreach ($childs as $child)
73  {
74  $obj = ilSCORM2004NodeFactory::getInstance($this->slm_object, $child["obj_id"], false);
75  if (is_object($obj))
76  {
77  if ($obj->getType() == "page")
78  {
79  $obj->delete($a_delete_meta_data);
80  }
81  }
82  unset($obj);
83  }
84  parent::delete($a_delete_meta_data);
85  }
static getInstance($a_slm_object, $a_id=0, $a_halt=true)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ exportFileItems()

ilSCORM2004Asset::exportFileItems (   $a_target_dir,
$expLog 
)

export files of file itmes

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

References ilObject\_exists(), ilObject\_lookupType(), array, copy(), date, and Monolog\Handler\error_log().

Referenced by exportHTMLPageObjects(), and exportPDFPrepareXmlNFiles().

829  {
830  include_once("./Modules/File/classes/class.ilObjFile.php");
831  if(is_array($this->file_ids))
832  foreach ($this->file_ids as $file_id)
833  {
834  $expLog->write(date("[y-m-d H:i:s] ")."File Item ".$file_id);
835  if (ilObject::_lookupType($file_id) == "file")
836  {
837  $file_obj = new ilObjFile($file_id, false);
838  $file_obj->export($a_target_dir);
839  unset($file_obj);
840  }
841  else
842  {
843  $expLog->write(date("[y-m-d H:i:s] ")."File Item not found, ID: ".$file_id);
844  }
845  }
846 
847  include_once("./Services/MediaObjects/classes/class.ilObjMediaObject.php");
848  $linked_mobs = array();
849  if(is_array($this->mob_ids ))
850  {
851  // mobs directly embedded into pages
852  foreach ($this->mob_ids as $mob_id)
853  {
854  if ($mob_id > 0 && ilObject::_exists($mob_id))
855  {
856  $expLog->write(date("[y-m-d H:i:s] ")."Media Object ".$mob_id);
857  $media_obj = new ilObjMediaObject($mob_id);
858  $media_obj->exportFiles($a_target_dir, $expLog);
859  $lmobs = $media_obj->getLinkedMediaObjects($this->mob_ids);
860  $linked_mobs = array_merge($linked_mobs, $lmobs);
861 
862  unset($media_obj);
863  }
864  }
865 
866  // linked mobs (in map areas)
867  foreach ($linked_mobs as $mob_id)
868  {
869  if ($mob_id > 0 && ilObject::_exists($mob_id))
870  {
871  $expLog->write(date("[y-m-d H:i:s] ")."Media Object ".$mob_id);
872  $media_obj = new ilObjMediaObject($mob_id);
873  $media_obj->exportFiles($a_target_dir);
874  unset($media_obj);
875  }
876  }
877  }
878 
879  //media files in questions
880  foreach ($this->q_media as $media) {
881  if ($media !="") {
882  error_log($media);
883  if (is_file ($media))
884  {
885  copy($media, $a_target_dir."/objects/".basename($media));
886  }
887  }
888  }
889  }
static _exists($a_id, $a_reference=false, $a_type=null)
checks if an object exists in object_data
date( 'd-M-Y', $objPHPExcel->getProperties() ->getCreated())
Class ilObjFile.
Class ilObjMediaObject.
Create styles array
The data for the language used.
static _lookupType($a_id, $a_reference=false)
lookup object type
copy($a_target_slm)
Copy sco.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ exportHTML()

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

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

References exportHTMLPageObjects().

Referenced by exportScorm().

186  {
187 
188  $this->slm_object->prepareHTMLExporter($a_target_dir);
189  $this->exportHTMLPageObjects($a_inst, $a_target_dir, $expLog, 'full',
190  $a_asset_type, $a_one_file);
191 
192  }
exportHTMLPageObjects($a_inst, $a_target_dir, &$expLog, $mode, $a_asset_type="sco", $a_one_file="", $a_sco_tpl=null)
Export HTML pages of SCO.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ exportHTML4PDF()

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

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

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

Referenced by exportPDFPrepareXmlNFiles().

196  {
197  ilUtil::makeDir($a_target_dir.'/css');
198  ilUtil::makeDir($a_target_dir.'/objects');
199  ilUtil::makeDir($a_target_dir.'/images');
200  $this->exportHTMLPageObjects($a_inst, $a_target_dir, $expLog, 'pdf');
201  }
exportHTMLPageObjects($a_inst, $a_target_dir, &$expLog, $mode, $a_asset_type="sco", $a_one_file="", $a_sco_tpl=null)
Export HTML pages of SCO.
static makeDir($a_dir)
creates a new directory and inherits all filesystem permissions of the parent directory You may pass ...
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ exportHTMLPageObjects()

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

References $html, $ilBench, $ilCtrl, $ilLog, $lng, $output, $style, $styles, $tpl, ilInternalLink\_extractObjIdOfTarget(), assQuestionGUI\_getQuestionGUI(), ilPCQuestion\_getQuestionIdsForPage(), array, ilPCFileList\collectFileItems(), copy(), exportFileItems(), ilObjSAHSLearningModule\getAffectiveLocalization(), ilGlossaryDefinition\getDefinitionList(), ilQuestionExporter\getFiles(), ilSCORM2004PageGUI\getGlossaryHTML(), ilSCORM2004ScoGUI\getGlossaryOverviewId(), getGlossaryTermIds(), ilSCORM2004Node\getId(), ilPCQuestion\getJSTextInitCode(), ilQuestionExporter\getMobs(), ilSCORM2004Node\getTitle(), ilSCORM2004Node\getType(), IL_PAGE_OFFLINE, ilQuestionExporter\indicateNewSco(), ilSCORM2004PageGUI\initExport(), ilQuestionExporter\questionsJS(), assQuestionGUI\RENDER_PURPOSE_PREVIEW, and ilPageObjectGUI\setPresentationTitle().

Referenced by exportHTML(), and exportHTML4PDF().

282  {
283  global $tpl, $ilCtrl, $ilBench,$ilLog, $lng;
284 
285  include_once "./Modules/Scorm2004/classes/class.ilSCORM2004PageGUI.php";
286  include_once "./Modules/Scorm2004/classes/class.ilObjSCORM2004LearningModuleGUI.php";
287  include_once "./Services/MetaData/classes/class.ilMD.php";
288 
289  $output = "";
290  $tree = new ilTree($this->slm_id);
291  $tree->setTableNames('sahs_sc13_tree', 'sahs_sc13_tree_node');
292  $tree->setTreeTablePK("slm_id");
293 
294  // @todo
295  // Why is that much HTML code in an application class?
296  // Please extract all this HTML to a tpl.<t_name>.html file and use
297  // placeholders and the template engine to insert data.
298  //
299  // There copy/paste code residenting in ilSCORM2004ScoGUI. This
300  // should be merged.
301  //
302  // alex, 4 Apr 09
303  //
304 
305 // if ($a_one_file == "")
306 // {
307  $sco_tpl = new ilTemplate("tpl.sco.html", true, true, "Modules/Scorm2004");
308 // }
309 // else
310 // {
311 // $sco_tpl = $a_sco_tpl;
312 // }
313 
314  if ($mode != 'pdf' && $a_one_file == "")
315  {
316  include_once("./Services/COPage/classes/class.ilCOPageHTMLExport.php");
317  $pg_exp = new ilCOPageHTMLExport($a_target_dir);
318  $pg_exp->getPreparedMainTemplate($sco_tpl);
319 
320  // init and question lang vars
322  $sco_tpl->setCurrentBlock("init");
323  include_once("./Services/COPage/classes/class.ilPCQuestion.php");
324  $sco_tpl->setVariable("TXT_INIT_CODE",
326  $sco_tpl->parseCurrentBlock();
327 
328  // (additional) style sheets needed
329  $styles = array("./css/yahoo/container.css",
330  "./css/question_handling.css");
331  foreach ($styles as $style)
332  {
333  $sco_tpl->setCurrentBlock("css_file");
334  $sco_tpl->setVariable("CSS_FILE", $style);
335  $sco_tpl->parseCurrentBlock();
336  }
337 
338  // (additional) scripts needed
339  $scripts = array("./js/scorm.js",
340  "./js/pager.js", "./js/pure.js",
341  "./js/questions_".$this->getId().".js");
342  foreach ($scripts as $script)
343  {
344  $sco_tpl->setCurrentBlock("js_file");
345  $sco_tpl->setVariable("JS_FILE", $script);
346  $sco_tpl->parseCurrentBlock();
347  }
348 
349  if ($a_asset_type != "entry_asset" && $a_asset_type != "final_asset")
350  {
351  self::renderNavigation($sco_tpl, "./images/spacer.png", $lk);
352  }
353 
354  $sco_tpl->touchBlock("finish");
355  }
356  // render head
357  $sco_tpl->setCurrentBlock("head");
358  $sco_tpl->setVariable("SCO_TITLE", $this->getTitle());
359  $sco_tpl->parseCurrentBlock();
360  $sco_tpl->touchBlock("tail");
361 
362  // meta page (meta info at SCO beginning)
363  self::renderMetaPage($sco_tpl, $this, $a_asset_type, $mode);
364  if ($a_one_file != "")
365  {
366  fputs($a_one_file, "<a name='sco".$this->getId()."'></a>");
367  fputs($a_one_file, $sco_tpl->get("meta_page"));
368  }
369 
370  //notify Question Exporter of new SCO
371  require_once './Modules/Scorm2004/classes/class.ilQuestionExporter.php';
373 
374  // init export (this initialises glossary template)
376  $terms = array();
377  $terms = $this->getGlossaryTermIds();
378  include_once("./Modules/Scorm2004/classes/class.ilSCORM2004ScoGUI.php");
379  $pages = $tree->getSubTree($tree->getNodeData($this->getId()),true,'page');
380  $sco_q_ids = array();
381  foreach($pages as $page)
382  {
383  //echo(print_r($page));
384  $page_obj = new ilSCORM2004PageGUI($this->getType(), $page["obj_id"], 0,
385  $this->slm_object->getId());
386  $page_obj->setPresentationTitle($page["title"]);
387  $page_obj->setOutputMode(IL_PAGE_OFFLINE);
388  $page_obj->setStyleId($this->slm_object->getStyleSheetId());
389  if (count($terms) > 1)
390  {
391  $page_obj->setGlossaryOverviewInfo(
393  }
394 
395  $page_output = $page_obj->showPage("export");
396 
397  // collect media objects
398  $mob_ids = $page_obj->getSCORM2004Page()->collectMediaObjects(false);
399  foreach($mob_ids as $mob_id)
400  {
401  $this->mob_ids[$mob_id] = $mob_id;
402  $media_obj = new ilObjMediaObject($mob_id);
403  if($media_obj->hasFullscreenItem())
404  $media_obj->exportMediaFullscreen($a_target_dir, $page_obj->getPageObject());
405  }
406 
407  // collect glossary items
408  $int_links = $page_obj->getPageObject()->getInternalLinks(true);
409  include_once("./Services/Link/classes/class.ilInternalLink.php");
410  include_once("./Modules/Glossary/classes/class.ilGlossaryDefinition.php");
411  if (is_array($int_links))
412  {
413  foreach ($int_links as $k => $e)
414  {
415  // glossary link
416  if ($e["Type"] == "GlossaryItem")
417  {
418  $karr = explode(":", $k);
419  $tid = ilInternalLink::_extractObjIdOfTarget($karr[0]);
421  foreach ($dids as $did)
422  {
423  include_once("./Modules/Glossary/classes/class.ilGlossaryDefPage.php");
424  $def_pg = new ilGlossaryDefPage($did["id"]);
425  $def_pg->buildDom();
426  $mob_ids = $def_pg->collectMediaObjects(false);
427  foreach($mob_ids as $mob_id)
428  {
429  $this->mob_ids[$mob_id] = $mob_id;
430 //echo "<br>-$mob_id-";
431  $media_obj = new ilObjMediaObject($mob_id);
432  if($media_obj->hasFullscreenItem())
433  $media_obj->exportMediaFullscreen($a_target_dir, $def_pg);
434  }
435  include_once("./Services/COPage/classes/class.ilPCFileList.php");
436  $file_ids = ilPCFileList::collectFileItems($def_pg, $def_pg->getDomDoc());
437 
438  foreach($file_ids as $file_id)
439  {
440  $this->file_ids[$file_id] = $file_id;
441  }
442  }
443  }
444  }
445  }
446 //exit;
447  // collect all file items
448  include_once("./Services/COPage/classes/class.ilPCFileList.php");
449  $file_ids = ilPCFileList::collectFileItems($page_obj->getSCORM2004Page(), $page_obj->getSCORM2004Page()->getDomDoc());
450  foreach($file_ids as $file_id)
451  {
452  $this->file_ids[$file_id] = $file_id;
453  }
454 
455  if ( $mode == 'pdf')
456  {
457  include_once("./Services/COPage/classes/class.ilPCQuestion.php");
458  $q_ids = ilPCQuestion::_getQuestionIdsForPage("sahs", $page["obj_id"]);
459  foreach ($q_ids as $q_id)
460  {
461  include_once("./Modules/TestQuestionPool/classes/class.assQuestionGUI.php");
462  $q_gui = assQuestionGUI::_getQuestionGUI("", $q_id);
463  $q_gui->setRenderPurpose(assQuestionGUI::RENDER_PURPOSE_PREVIEW);
464  $q_gui->outAdditionalOutput();
465  $html = $q_gui->getPreview(TRUE);
466  $page_output = preg_replace("/{{{{{Question;il__qst_".$q_id."}}}}}/i",$html,$page_output);
467  }
468 
469  $sco_tpl->touchBlock("pdf_pg_break");
470  }
471 
472  $sco_tpl->setCurrentBlock("page");
473  $sco_tpl->setVariable("PAGE", $page_output);
474  $sco_tpl->parseCurrentBlock();
475 
476  // get all question ids of the sco
477  if ($a_one_file != "")
478  {
479  include_once("./Services/COPage/classes/class.ilPCQuestion.php");
480  $q_ids = ilPCQuestion::_getQuestionIdsForPage("sahs", $page["obj_id"]);
481  foreach ($q_ids as $i)
482  {
483  if (!in_array($i, $sco_q_ids))
484  {
485  $sco_q_ids[] = $i;
486  }
487  }
488  }
489  }
490 
491  // glossary
492  if ($mode!='pdf')
493  {
494  $sco_tpl->setVariable("GLOSSARY_HTML",
496  }
497 
498  if ($a_one_file == "")
499  {
500  $output = $sco_tpl->get();
501  }
502  else
503  {
504  $output = $sco_tpl->get("page");
505  }
506 
507  if($mode=='pdf')
508  $output = preg_replace("/<div class=\"ilc_page_title_PageTitle\">(.*?)<\/div>/i","<h2>$1</h2>",$output);
509 
510  //$output = preg_replace("/\.\/mobs\/mm_(\d+)\/([^\"]+)/i","./objects/il_".IL_INST_ID."_mob_$1/$2",$output);
511  $output = preg_replace("/mobs\/mm_(\d+)\/([^\"]+)/i","./objects/il_".IL_INST_ID."_mob_$1/$2",$output);
512  $output = preg_replace("/\.\/files\/file_(\d+)\/([^\"]+)/i","./objects/il_".IL_INST_ID."_file_$1/$2",$output);
513  $output = preg_replace("/\.\/Services\/MediaObjects\/flash_mp3_player/i","./players",$output);
514 // $output = preg_replace("/\.\/".str_replace("/", "\/", ilPlayerUtil::getFlashVideoPlayerDirectory())."/i","./players",$output);
515  $output = preg_replace("/file=..\/..\/..\/.\//i","file=../",$output);
516 
517  if($mode!='pdf')
518  {
519  $output = preg_replace_callback("/href=\"&mob_id=(\d+)&pg_id=(\d+)\"/",array(get_class($this), 'fixFullscreeenLink'),$output);
520  // this one is for fullscreen in glossary entries
521  $output = preg_replace_callback("/href=\"fullscreen_(\d+)\.html\"/",array(get_class($this), 'fixFullscreeenLink'),$output);
522  $output = preg_replace_callback("/{{{{{(Question;)(il__qst_[0-9]+)}}}}}/",array(get_class($this), 'insertQuestion'),$output);
523 // $output = preg_replace("/&#123;/","",$output);
524 // $output = preg_replace("/&#125;/","",$output);
525  $q_handling = file_get_contents('./Modules/Scorm2004/scripts/questions/question_handling.js');
526  fputs(fopen($a_target_dir.'/js/questions_'.$this->getId().'.js','w+'),ilQuestionExporter::questionsJS().$q_handling);
527  copy("./Modules/Scorm2004/templates/default/question_handling.css",
528  $a_target_dir.'/css/question_handling.css');
529 
530  // hack to get the question js into the file and to display the correct answers
531  if ($a_one_file != "")
532  {
533  $output = '<script type="text/javascript">'.ilQuestionExporter::questionsJS().'</script>'.$output;
534  if (count($sco_q_ids) > 0)
535  {
536  $output.= '<script type="text/javascript">';
537  foreach ($sco_q_ids as $i)
538  {
539  if ($i > 0)
540  {
541  $output.= "ilias.questions.showCorrectAnswers(".$i."); \n";
542  }
543  }
544  $output.= '</script>';
545  }
546  }
547 
548  foreach(ilQuestionExporter::getMobs() as $mob_id)
549  {
550  $this->mob_ids[$mob_id] = $mob_id;
551  }
552  }
553  $this->q_media = ilQuestionExporter::getFiles();
554  //questions export end
555 
556  if ($a_one_file != "")
557  {
558  fputs($a_one_file, $output);
559  }
560  else
561  {
562  fputs(fopen($a_target_dir.'/index.html','w+'),$output);
563  }
564 
565  $this->exportFileItems($a_target_dir, $expLog);
566 
567  }
static getJSTextInitCode($a_lang)
Get js txt init code.
static getDefinitionList($a_term_id)
static
$style
Definition: example_012.php:70
static _getQuestionIdsForPage($a_parent_type, $a_page_id, $a_lang="-")
Get all questions of a page.
const IL_PAGE_OFFLINE
HTML export class for pages.
static getGlossaryOverviewId()
Get sco glossary overlay id.
global $tpl
Definition: ilias.php:8
global $ilCtrl
Definition: ilias.php:18
exportFileItems($a_target_dir, &$expLog)
export files of file itmes
if(!is_dir( $entity_dir)) exit("Fatal Error ([A-Za-z0-9]+)\+" &#(? foreach( $entity_files as $file) $output
getGlossaryTermIds()
Get glossary term ids in sco.
static _getQuestionGUI($question_type, $question_id=-1)
Creates a question gui representation and returns the alias to the question gui note: please do not u...
special template class to simplify handling of ITX/PEAR
static collectFileItems($a_page, $a_domdoc)
Get all file items that are used within the page.
setPresentationTitle($a_title="")
Class ilObjMediaObject.
Glossary definition page object.
Tree class data representation in hierachical trees using the Nested Set Model with Gaps by Joe Celco...
Create styles array
The data for the language used.
Class ilSCORM2004Page GUI class.
global $lng
Definition: privfeed.php:17
global $ilBench
Definition: ilias.php:18
static getGlossaryHTML($a_sco)
Get glossary html (only in export mode)
copy($a_target_slm)
Copy sco.
static getAffectiveLocalization($a_id)
Get affective localization.
$html
Definition: example_001.php:87
static questionsJS(array $a_qids=null)
static initExport()
Init export.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ exportPDF()

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

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

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

204  {
205  global $tpl, $lng, $ilCtrl;
206  $a_xml_writer = new ilXmlWriter;
207  $a_xml_writer->xmlStartTag("ContentObject", array("Type"=>"SCORM2004SCO"));
208  $this->exportPDFPrepareXmlNFiles($a_inst, $a_target_dir, $expLog,$a_xml_writer);
209  $a_xml_writer->xmlEndTag("ContentObject");
210  include_once 'Services/Transformation/classes/class.ilXML2FO.php';
211  $xml2FO = new ilXML2FO();
212  $xml2FO->setXSLTLocation('./Modules/Scorm2004/templates/xsl/contentobject2fo.xsl');
213  $xml2FO->setXMLString($a_xml_writer->xmlDumpMem());
214  $xml2FO->setXSLTParams(array ('target_dir' => $a_target_dir));
215  $xml2FO->transform();
216  $fo_string = $xml2FO->getFOString();
217  $fo_xml = simplexml_load_string($fo_string);
218  $fo_ext = $fo_xml->xpath("//fo:declarations");
219  $fo_ext = $fo_ext[0];
220  $results = array();
221  include_once "./Services/Utilities/classes/class.ilFileUtils.php";
222  ilFileUtils::recursive_dirscan($a_target_dir."/objects", $results);
223  if (is_array($results["file"]))
224  {
225  foreach ($results["file"] as $key => $value)
226  {
227  $e = $fo_ext->addChild("fox:embedded-file","","http://xml.apache.org/fop/extensions");
228  $e->addAttribute("src",$results[path][$key].$value);
229  $e->addAttribute("name",$value);
230  $e->addAttribute("desc","");
231  }
232  }
233  $fo_string = $fo_xml->asXML();
234  $a_xml_writer->_XmlWriter;
235  return $fo_string;
236  }
xmlStartTag($tag, $attrs=NULL, $empty=FALSE, $encode=TRUE, $escape=TRUE)
Writes a starttag.
XML writer class.
global $tpl
Definition: ilias.php:8
global $ilCtrl
Definition: ilias.php:18
$results
exportPDFPrepareXmlNFiles($a_inst, $a_target_dir, &$expLog, &$a_xml_writer)
Create styles array
The data for the language used.
global $lng
Definition: privfeed.php:17
static recursive_dirscan($dir, &$arr)
Recursively scans a given directory and writes path and filename into referenced array.
+ Here is the call graph for this function:

◆ exportPDFPrepareXmlNFiles()

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

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

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

Referenced by exportPDF().

239  {
240 
241  $this->exportHTML4PDF($a_inst, $a_target_dir, $expLog);
242  global $tpl, $lng, $ilCtrl;
243  $this->exportXMLPageObjects($a_target_dir, $a_xml_writer, $a_inst, $expLog);
244  $this->exportXMLMediaObjects($a_xml_writer, $a_inst, $a_target_dir, $expLog);
245  $this->exportFileItems($a_target_dir,$expLog);
246 
247  include_once "./Modules/Scorm2004/classes/class.ilSCORM2004PageNode.php";
248  include_once "./Modules/Scorm2004/classes/class.ilSCORM2004Page.php";
249 
250  $tree = new ilTree($this->slm_id);
251  $tree->setTableNames('sahs_sc13_tree', 'sahs_sc13_tree_node');
252  $tree->setTreeTablePK("slm_id");
253  foreach($tree->getSubTree($tree->getNodeData($this->getId()),true,'page') as $page)
254  {
255  $page_obj = new ilSCORM2004Page($page["obj_id"]);
256 
257  include_once("./Services/COPage/classes/class.ilPCQuestion.php");
258  $q_ids = ilPCQuestion::_getQuestionIdsForPage("sahs", $page["obj_id"]);
259  if (count($q_ids) > 0)
260  {
261  include_once("./Modules/TestQuestionPool/classes/class.assQuestion.php");
262  foreach ($q_ids as $q_id)
263  {
264  $q_obj = assQuestion::_instanciateQuestion($q_id);
265  $qti_file = fopen($a_target_dir."/qti_".$q_id.".xml", "w");
266  fwrite($qti_file, $q_obj->toXML());
267  fclose($qti_file);
268  $x = file_get_contents($a_target_dir."/qti_".$q_id.".xml");
269  $x = str_replace('<?xml version="1.0" encoding="utf-8"?>', '', $x);
270  $a_xml_writer->appendXML($x);
271  }
272  }
273  unset($page_obj);
274  }
275  }
static _instanciateQuestion($question_id)
Creates an instance of a question with a given question id.
static _getQuestionIdsForPage($a_parent_type, $a_page_id, $a_lang="-")
Get all questions of a page.
$x
Definition: example_009.php:98
global $tpl
Definition: ilias.php:8
global $ilCtrl
Definition: ilias.php:18
exportFileItems($a_target_dir, &$expLog)
export files of file itmes
Class ilSCORM2004Page.
exportXMLMediaObjects(&$a_xml_writer, $a_inst, $a_target_dir, &$expLog)
Tree class data representation in hierachical trees using the Nested Set Model with Gaps by Joe Celco...
exportHTML4PDF($a_inst, $a_target_dir, &$expLog)
exportXMLPageObjects($a_target_dir, &$a_xml_writer, $a_inst, &$expLog)
global $lng
Definition: privfeed.php:17
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ exportScorm()

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

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

References $data, $ilBench, $output, array, copy(), exportHTML(), exportXMLMediaObjects(), exportXMLMetaData(), exportXMLPageObjects(), ilSCORM2004Node\getId(), ilSCORM2004Node\getObjectives(), ilSCORM2004Node\getType(), ilXmlWriter\xmlSetDtdDef(), xslt_create(), and xslt_free().

115  {
116  copy('./xml/ilias_co_3_7.dtd',$a_target_dir.'/ilias_co_3_7.dtd');
117  copy('./Modules/Scorm2004/templates/xsl/sco.xsl',$a_target_dir.'/sco.xsl');
118 
119  $a_xml_writer = new ilXmlWriter;
120  // MetaData
121  //file_put_contents($a_target_dir.'/indexMD.xml','<lom xmlns="http://ltsc.ieee.org/xsd/LOM"><general/><classification/></lom>');
122  $this->exportXMLMetaData($a_xml_writer);
123  $metadata_xml = $a_xml_writer->xmlDumpMem(false);
124  $a_xml_writer->_XmlWriter;
125  $xsl = file_get_contents("./Modules/Scorm2004/templates/xsl/metadata.xsl");
126  $args = array( '/_xml' => $metadata_xml , '/_xsl' => $xsl );
127  $xh = xslt_create();
128  $output = xslt_process($xh,"arg:/_xml","arg:/_xsl",NULL,$args,NULL);
129  xslt_free($xh);
130  file_put_contents($a_target_dir.'/indexMD.xml',$output);
131 
132  $a_xml_writer = new ilXmlWriter;
133  // set dtd definition
134  $a_xml_writer->xmlSetDtdDef("<!DOCTYPE ContentObject SYSTEM \"http://www.ilias.de/download/dtd/ilias_co_3_7.dtd\">");
135 
136  // set generated comment
137  $a_xml_writer->xmlSetGenCmt("Export of ILIAS Content Module ". $this->getId()." of installation ".$a_inst.".");
138 
139  // set xml header
140  $a_xml_writer->xmlHeader();
141 
142  global $ilBench;
143 
144  $a_xml_writer->xmlStartTag("ContentObject", array("Type"=>"SCORM2004SCO"));
145 
146  $this->exportXMLMetaData($a_xml_writer);
147 
148  $this->exportXMLPageObjects($a_target_dir, $a_xml_writer, $a_inst, $expLog);
149 
150  $this->exportXMLMediaObjects($a_xml_writer, $a_inst, $a_target_dir, $expLog);
151 
152  $this->exportHTML($a_inst, $a_target_dir, $expLog);
153 
154  //overwrite scorm.js for scrom 1.2
155  if ($ver=="12")
156  copy('./Modules/Scorm2004/scripts/scorm_12.js',$a_target_dir.'/js/scorm.js');
157 
158  $a_xml_writer->xmlEndTag("ContentObject");
159 
160  $a_xml_writer->xmlDumpFile($a_target_dir.'/index.xml', false);
161 
162  $a_xml_writer->_XmlWriter;
163 
164  // export sco data (currently only objective) to sco.xml
165  if ($this->getType() == "sco")
166  {
167  $objectives_text = "";
168  $a_xml_writer = new ilXmlWriter;
169 
170  $tr_data = $this->getObjectives();
171  foreach ($tr_data as $data)
172  {
173  $objectives_text.= $data->getObjectiveID();
174  }
175  $a_xml_writer->xmlStartTag("sco");
176  $a_xml_writer->xmlElement("objective", null, $objectives_text);
177  $a_xml_writer->xmlEndTag("sco");
178  $a_xml_writer->xmlDumpFile($a_target_dir.'/sco.xml', false);
179  $a_xml_writer->_XmlWriter;
180  }
181  }
xslt_create()
xmlSetDtdDef($dtdDef)
Sets dtd definition.
xslt_free(&$proc)
XML writer class.
if(!is_dir( $entity_dir)) exit("Fatal Error ([A-Za-z0-9]+)\+" &#(? foreach( $entity_files as $file) $output
exportHTML($a_inst, $a_target_dir, &$expLog, $a_asset_type="sco", $a_one_file="")
exportXMLMediaObjects(&$a_xml_writer, $a_inst, $a_target_dir, &$expLog)
Create styles array
The data for the language used.
exportXMLPageObjects($a_target_dir, &$a_xml_writer, $a_inst, &$expLog)
global $ilBench
Definition: ilias.php:18
copy($a_target_slm)
Copy sco.
exportXMLMetaData(&$a_xml_writer)
+ Here is the call graph for this function:

◆ exportXMLMediaObjects()

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

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

References ilObject\_lookupType(), array, and date.

Referenced by exportPDFPrepareXmlNFiles(), and exportScorm().

778  {
779  include_once("./Services/MediaObjects/classes/class.ilObjMediaObject.php");
780  include_once("./Modules/File/classes/class.ilObjFile.php");
781  $linked_mobs = array();
782  if(is_array($this->mob_ids ))
783  {
784  // mobs directly embedded into pages
785  foreach ($this->mob_ids as $mob_id)
786  {
787  if ($mob_id > 0)
788  {
789  $expLog->write(date("[y-m-d H:i:s] ")."Media Object ".$mob_id);
790  $media_obj = new ilObjMediaObject($mob_id);
791  $media_obj->exportXML($a_xml_writer, $a_inst);
792  $lmobs = $media_obj->getLinkedMediaObjects($this->mob_ids);
793  $linked_mobs = array_merge($linked_mobs, $lmobs);
794  unset($media_obj);
795  }
796  }
797 
798  // linked mobs (in map areas)
799  foreach ($linked_mobs as $mob_id)
800  {
801  if ($mob_id > 0)
802  {
803  $expLog->write(date("[y-m-d H:i:s] ")."Media Object ".$mob_id);
804  $media_obj = new ilObjMediaObject($mob_id);
805  $media_obj->exportXML($a_xml_writer, $a_inst);
806  unset($media_obj);
807  }
808  }
809  }
810  if(is_array($this->file_ids))
811  foreach ($this->file_ids as $file_id)
812  {
813  if (ilObject::_lookupType($file_id) == "file")
814  {
815  $expLog->write(date("[y-m-d H:i:s] ")."File Item ".$file_id);
816  $file_obj = new ilObjFile($file_id, false);
817  $file_obj->export($a_target_dir);
818  unset($file_obj);
819  }
820  }
821 
822  }
date( 'd-M-Y', $objPHPExcel->getProperties() ->getCreated())
Class ilObjFile.
Class ilObjMediaObject.
Create styles array
The data for the language used.
static _lookupType($a_id, $a_reference=false)
lookup object type
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ exportXMLMetaData()

ilSCORM2004Asset::exportXMLMetaData ( $a_xml_writer)

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

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

Referenced by exportScorm().

897  {
898  include_once("Services/MetaData/classes/class.ilMD2XML.php");
899  $md2xml = new ilMD2XML($this->getSLMId(), $this->getId(), $this->getType());
900  $md2xml->setExportMode(true);
901  $md2xml->startExport();
902  $a_xml_writer->appendXML($md2xml->getXML());
903  }
getSLMId()
Get ID of parent Scorm Learning Module Object.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ exportXMLPageObjects()

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

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

References $ilBench, ilPCQuestion\_getQuestionIdsForPage(), assQuestion\_instantiateQuestion(), and date.

Referenced by exportPDFPrepareXmlNFiles(), and exportScorm().

721  {
722  global $ilBench;
723 
724  include_once "./Modules/Scorm2004/classes/class.ilSCORM2004PageNode.php";
725  include_once "./Modules/Scorm2004/classes/class.ilSCORM2004Page.php";
726 
727  $tree = new ilTree($this->slm_id);
728  $tree->setTableNames('sahs_sc13_tree', 'sahs_sc13_tree_node');
729  $tree->setTreeTablePK("slm_id");
730 
731  $pages = $tree->getSubTree($tree->getNodeData($this->getId()),true,'page');
732  foreach($pages as $page)
733  {
734  $expLog->write(date("[y-m-d H:i:s] ")."Page Object ".$page["obj_id"]);
735 
736  // export xml to writer object
737  $page_obj = new ilSCORM2004Page($page["obj_id"]);
738  $page_obj->exportXML($a_xml_writer, "normal", $a_inst);
739 
740  //collect media objects
741  $mob_ids = $page_obj->getMediaObjectIds();
742  foreach($mob_ids as $mob_id)
743  {
744  $this->mob_ids[$mob_id] = $mob_id;
745  }
746 
747  // collect all file items
748  $file_ids = $page_obj->getFileItemIds();
749  foreach($file_ids as $file_id)
750  {
751  $this->file_ids[$file_id] = $file_id;
752  }
753 
754  include_once("./Services/COPage/classes/class.ilPCQuestion.php");
755  $q_ids = ilPCQuestion::_getQuestionIdsForPage("sahs", $page["obj_id"]);
756  if (count($q_ids) > 0)
757  {
758  include_once("./Modules/TestQuestionPool/classes/class.assQuestion.php");
759  foreach ($q_ids as $q_id)
760  {
761  $q_obj = assQuestion::_instantiateQuestion($q_id);
762  // see #16557
763  if (is_object($q_obj))
764  {
765  $qti_file = fopen($a_target_dir."/qti_".$q_id.".xml", "w");
766  fwrite($qti_file, $q_obj->toXML());
767  fclose($qti_file);
768  }
769  }
770  }
771 
772  unset($page_obj);
773 
774  }
775  }
static _getQuestionIdsForPage($a_parent_type, $a_page_id, $a_lang="-")
Get all questions of a page.
Class ilSCORM2004Page.
date( 'd-M-Y', $objPHPExcel->getProperties() ->getCreated())
Tree class data representation in hierachical trees using the Nested Set Model with Gaps by Joe Celco...
static _instantiateQuestion($question_id)
global $ilBench
Definition: ilias.php:18
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fixFullscreeenLink()

static ilSCORM2004Asset::fixFullscreeenLink (   $matches)
staticprivate

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

702  {
703  $media_obj = new ilObjMediaObject($matches[1]);
704  if($media_obj->hasFullscreenItem())
705  {
706  return "href=\"./objects/il_".IL_INST_ID."_mob_".$matches[1]."/fullscreen.html\"";
707  //return "href=\"./objects/il_".IL_INST_ID."_mob_".$matches[1]."/".$media_obj->getMediaItem("Fullscreen")->getLocation()."\"";
708  }
709  }
Class ilObjMediaObject.

◆ getExportFiles()

ilSCORM2004Asset::getExportFiles ( )

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

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

906  {
907  $file = array();
908 
909  require_once("./Modules/Scorm2004/classes/class.ilSCORM2004Export.php");
910 
911  $export = new ilSCORM2004Export($this);
912  foreach ($export->getSupportedExportTypes() as $type)
913  {
914  $dir = $export->getExportDirectoryForType($type);
915  // quit if import dir not available
916  if (!@is_dir($dir) or !is_writeable($dir))
917  {
918  continue;
919  }
920  // open directory
921  $cdir = dir($dir);
922 
923  // get files and save the in the array
924  while ($entry = $cdir->read())
925  {
926  if ($entry != "." and
927  $entry != ".." and
928  (
929  preg_match("~^[0-9]{10}_{2}[0-9]+_{2}(".$this->getType()."_)".$this->getId()."+\.zip\$~", $entry) or
930  preg_match("~^[0-9]{10}_{2}[0-9]+_{2}(".$this->getType()."_)".$this->getId()."+\.pdf\$~", $entry) or
931  preg_match("~^[0-9]{10}_{2}[0-9]+_{2}(".$this->getType()."_)".$this->getId()."+\.iso\$~", $entry)
932  ))
933  {
934  $file[$entry.$type] = array("type" => $type, "file" => $entry,
935  "size" => filesize($dir."/".$entry));
936  }
937  }
938 
939  // close import directory
940  $cdir->close();
941  }
942 
943  // sort files
944  ksort ($file);
945  reset ($file);
946  return $file;
947  }
Create styles array
The data for the language used.
if(!file_exists("$old.txt")) if($old===$new) if(file_exists("$new.txt")) $file
+ Here is the call graph for this function:

◆ getGlossaryTermIds()

ilSCORM2004Asset::getGlossaryTermIds ( )

Get glossary term ids in sco.

Parameters

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

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

Referenced by exportHTMLPageObjects().

956  {
957  include_once("./Modules/Glossary/classes/class.ilGlossaryTerm.php");
958  $childs = $this->tree->getChilds($this->getId());
959  $ids = array();
960  foreach ($childs as $c)
961  {
962  $links = ilInternalLink::_getTargetsOfSource("sahs".":pg",
963  $c["child"]);
964  foreach ($links as $l)
965  {
966  if ($l["type"] == "git" && (int) $l["inst"] == 0 && !isset($ids[$l["id"]]))
967  {
968  $ids[$l["id"]] = ilGlossaryTerm::_lookGlossaryTerm($l["id"]);
969  }
970  }
971 
972  }
973  asort($ids);
974  return $ids;
975  }
Create styles array
The data for the language used.
global $l
Definition: afr.php:30
static _lookGlossaryTerm($term_id)
get glossary term
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ insertDefaultSequencingItem()

ilSCORM2004Asset::insertDefaultSequencingItem ( )

Insert default sequencing item.

Parameters

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

References ilSCORM2004Node\getId().

Referenced by create().

60  {
61  $seq_item = new ilSCORM2004Item($this->getId());
62  $seq_item->insert();
63  }
Class ilSCORM2004Condition.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ insertQuestion()

static ilSCORM2004Asset::insertQuestion (   $matches)
staticprivate

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

References $ret.

712  {
713  $q_exporter = new ilQuestionExporter();
714 
715  $ret = $q_exporter->exportQuestion($matches[2], "./objects/", "offline");
716 
717  return $ret;
718  }
Scorm 2004 Question Exporter.
$ret
Definition: parser.php:6

◆ renderMetaPage()

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

References $lng, and ilMD\getGeneral().

Referenced by ilSCORM2004ScoGUI\sco_preview().

609  {
610  global $lng;
611 
612  if ($a_sco->getType() != "sco" || $a_sco->getHideObjectivePage())
613  {
614  return;
615  }
616 
617  if ($a_asset_type != "entry_asset" && $a_asset_type != "final_asset")
618  {
619  $meta = new ilMD($a_sco->getSLMId(), $a_sco->getId(), $a_sco->getType());
620  $desc_ids = $meta->getGeneral()->getDescriptionIds();
621  $sco_description = $meta->getGeneral()->getDescription($desc_ids[0])->getDescription();
622  }
623 
624  if ($mode != 'pdf')
625  {
626  // title
627  if ($a_asset_type != "entry_asset" && $a_asset_type != "final_asset")
628  {
629  $a_tpl->setCurrentBlock("title");
630  $a_tpl->setVariable("SCO_TITLE", $a_sco->getTitle());
631  $a_tpl->parseCurrentBlock();
632  }
633  }
634  else
635  {
636  // title
637  $a_tpl->setCurrentBlock("pdf_title");
638  $a_tpl->setVariable("SCO_TITLE", $a_sco->getTitle());
639  $a_tpl->parseCurrentBlock();
640  $a_tpl->touchBlock("pdf_break");
641  }
642 
643  // sco description
644  if (trim($sco_description) != "")
645  {
646  $a_tpl->setCurrentBlock("sco_desc");
647  $a_tpl->setVariable("TXT_DESC", $lng->txt("description"));
648  include_once("./Services/COPage/classes/class.ilPCParagraph.php");
649  $a_tpl->setVariable("VAL_DESC", self::convertLists($sco_description));
650  $a_tpl->parseCurrentBlock();
651  }
652 
653  if ($a_asset_type == "sco")
654  {
655  // sco objective(s)
656  $objs = $a_sco->getObjectives();
657  if (count($objs) > 0)
658  {
659  foreach ($objs as $objective)
660  {
661  $a_tpl->setCurrentBlock("sco_obj");
662  $a_tpl->setVariable("VAL_OBJECTIVE", self::convertLists($objective->getObjectiveID()));
663  $a_tpl->parseCurrentBlock();
664  }
665  $a_tpl->setCurrentBlock("sco_objs");
666  $a_tpl->setVariable("TXT_OBJECTIVES", $lng->txt("sahs_objectives"));
667  $a_tpl->parseCurrentBlock();
668  }
669  }
670  $a_tpl->setCurrentBlock("meta_page");
671  $a_tpl->parseCurrentBlock();
672  }
& getGeneral()
Definition: class.ilMD.php:40
global $lng
Definition: privfeed.php:17
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ renderNavigation()

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

References $lng, and ilUtil\getImagePath().

Referenced by ilSCORM2004ScoGUI\sco_preview().

576  {
577  global $lng;
578 
579  if ($a_spacer_img == "")
580  {
581  $a_spacer_img = ilUtil::getImagePath("spacer.png");
582  }
583  if ($a_lang == "")
584  {
585  $a_lang = $lng->getLangKey();
586  }
587  // previous/next navigation
588  $a_tpl->setCurrentBlock("ilLMNavigation");
589  $a_tpl->setVariable("TXT_PREVIOUS", $lng->txtlng("content", 'scplayer_previous', $a_lang));
590  $a_tpl->setVariable("SRC_SPACER", $a_spacer_img);
591  $a_tpl->setVariable("TXT_NEXT", $lng->txtlng("content", 'scplayer_next', $a_lang));
592  $a_tpl->parseCurrentBlock();
593  $a_tpl->setCurrentBlock("ilLMNavigation2");
594  $a_tpl->setVariable("TXT_PREVIOUS", $lng->txtlng("content", 'scplayer_previous', $a_lang));
595  $a_tpl->setVariable("SRC_SPACER", $a_spacer_img);
596  $a_tpl->setVariable("TXT_NEXT", $lng->txtlng("content", 'scplayer_next', $a_lang));
597  $a_tpl->parseCurrentBlock();
598  }
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
global $lng
Definition: privfeed.php:17
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $q_media

ilSCORM2004Asset::$q_media = null

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


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