ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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 ()
 
 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
 

Protected Attributes

 $tpl
 
 $lng
 
 $ctrl
 
- Protected Attributes inherited from ilSCORM2004Node
 $db
 
 $user
 

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

References $DIC, and ilSCORM2004Node\setType().

39  {
40  global $DIC;
41 
42  $this->tpl = $DIC["tpl"];
43  $this->lng = $DIC->language();
44  $this->ctrl = $DIC->ctrl();
45  parent::__construct($a_slm_object, $a_id);
46  $this->setType("ass");
47  }
global $DIC
Definition: saml.php:7
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 672 of file class.ilSCORM2004Asset.php.

References ilPCParagraph\input2xmlReplaceLists().

Referenced by ilObjectivesAlignmentTableGUI\fillRow().

673  {
674  include_once("./Services/COPage/classes/class.ilPCParagraph.php");
675  $a_text = nl2br($a_text);
676  $a_text = str_replace(array("\n", "\r"), "", $a_text);
677  $a_text = str_replace("<br>", "<br />", $a_text);
678  $a_text = ilPCParagraph::input2xmlReplaceLists($a_text);
679  $a_text = str_replace(
680  array("<SimpleBulletList>", "</SimpleBulletList>",
681  "<SimpleListItem>", "</SimpleListItem>",
682  "<SimpleNumberedList>", "</SimpleNumberedList>"
683  ),
684  array("<ul class='ilc_list_u_BulletedList'>", "</ul>",
685  "<li class='ilc_list_item_StandardListItem'>", "</li>",
686  "<ol class='ilc_list_o_NumberedList'>", "</ol>"
687  ),
688  $a_text
689  );
690  return $a_text;
691  }
static input2xmlReplaceLists($a_text)
Converts xml from DB to output in edit textarea.
+ 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 107 of file class.ilSCORM2004Asset.php.

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

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

108  {
109  $ass = new ilSCORM2004Asset($a_target_slm);
110  $ass->setTitle($this->getTitle());
111  if ($this->getSLMId() != $a_target_slm->getId()) {
112  $ass->setImportId("il__ass_" . $this->getId());
113  }
114  $ass->setSLMId($a_target_slm->getId());
115  $ass->setType($this->getType());
116  $ass->setDescription($this->getDescription());
117  $ass->create(true);
118  $a_copied_nodes[$this->getId()] = $ass->getId();
119 
120  // copy meta data
121  include_once("Services/MetaData/classes/class.ilMD.php");
122  $md = new ilMD($this->getSLMId(), $this->getId(), $this->getType());
123  $new_md = $md->cloneMD($a_target_slm->getId(), $ass->getId(), $this->getType());
124 
125  return $ass;
126  }
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 63 of file class.ilSCORM2004Asset.php.

References insertDefaultSequencingItem().

64  {
65  include_once("./Modules/Scorm2004/classes/seq_editor/class.ilSCORM2004Item.php");
66  include_once("./Modules/Scorm2004/classes/seq_editor/class.ilSCORM2004Objective.php");
67  parent::create($a_upload);
68  if (!$a_template) {
70  }
71  }
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 52 of file class.ilSCORM2004Asset.php.

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

53  {
54  $node_data = $this->tree->getNodeData($this->getId());
55  $this->delete_rec($a_delete_meta_data);
56  $this->tree->deleteTree($node_data);
57  parent::deleteSeqInfo();
58  }
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 89 of file class.ilSCORM2004Asset.php.

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

Referenced by delete().

90  {
91  $childs = $this->tree->getChilds($this->getId());
92  foreach ($childs as $child) {
93  $obj = ilSCORM2004NodeFactory::getInstance($this->slm_object, $child["obj_id"], false);
94  if (is_object($obj)) {
95  if ($obj->getType() == "page") {
96  $obj->delete($a_delete_meta_data);
97  }
98  }
99  unset($obj);
100  }
101  parent::delete($a_delete_meta_data);
102  }
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 804 of file class.ilSCORM2004Asset.php.

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

Referenced by exportHTMLPageObjects(), and exportPDFPrepareXmlNFiles().

805  {
806  include_once("./Modules/File/classes/class.ilObjFile.php");
807  if (is_array($this->file_ids)) {
808  foreach ($this->file_ids as $file_id) {
809  $expLog->write(date("[y-m-d H:i:s] ") . "File Item " . $file_id);
810  if (ilObject::_lookupType($file_id) == "file") {
811  $file_obj = new ilObjFile($file_id, false);
812  $file_obj->export($a_target_dir);
813  unset($file_obj);
814  } else {
815  $expLog->write(date("[y-m-d H:i:s] ") . "File Item not found, ID: " . $file_id);
816  }
817  }
818  }
819 
820  include_once("./Services/MediaObjects/classes/class.ilObjMediaObject.php");
821  $linked_mobs = array();
822  if (is_array($this->mob_ids)) {
823  // mobs directly embedded into pages
824  foreach ($this->mob_ids as $mob_id) {
825  if ($mob_id > 0 && ilObject::_exists($mob_id)) {
826  $expLog->write(date("[y-m-d H:i:s] ") . "Media Object " . $mob_id);
827  $media_obj = new ilObjMediaObject($mob_id);
828  $media_obj->exportFiles($a_target_dir, $expLog);
829  $lmobs = $media_obj->getLinkedMediaObjects($this->mob_ids);
830  $linked_mobs = array_merge($linked_mobs, $lmobs);
831 
832  unset($media_obj);
833  }
834  }
835 
836  // linked mobs (in map areas)
837  foreach ($linked_mobs as $mob_id) {
838  if ($mob_id > 0 && ilObject::_exists($mob_id)) {
839  $expLog->write(date("[y-m-d H:i:s] ") . "Media Object " . $mob_id);
840  $media_obj = new ilObjMediaObject($mob_id);
841  $media_obj->exportFiles($a_target_dir);
842  unset($media_obj);
843  }
844  }
845  }
846 
847  //media files in questions
848  foreach ($this->q_media as $media) {
849  if ($media != "") {
850  error_log($media);
851  if (is_file($media)) {
852  copy($media, $a_target_dir . "/objects/" . basename($media));
853  }
854  }
855  }
856  }
static _exists($a_id, $a_reference=false, $a_type=null)
checks if an object exists in object_data
Class ilObjMediaObject.
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 197 of file class.ilSCORM2004Asset.php.

References exportHTMLPageObjects().

Referenced by exportScorm().

203  {
204  $this->slm_object->prepareHTMLExporter($a_target_dir);
205  $this->exportHTMLPageObjects(
206  $a_inst,
207  $a_target_dir,
208  $expLog,
209  'full',
210  $a_asset_type,
211  $a_one_file
212  );
213  }
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 216 of file class.ilSCORM2004Asset.php.

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

Referenced by exportPDFPrepareXmlNFiles().

217  {
218  ilUtil::makeDir($a_target_dir . '/css');
219  ilUtil::makeDir($a_target_dir . '/objects');
220  ilUtil::makeDir($a_target_dir . '/images');
221  $this->exportHTMLPageObjects($a_inst, $a_target_dir, $expLog, 'pdf');
222  }
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 299 of file class.ilSCORM2004Asset.php.

References $html, $i, Sabre\VObject\$output, $style, $tree, ilInternalLink\_extractObjIdOfTarget(), assQuestionGUI\_getQuestionGUI(), ilPCQuestion\_getQuestionIdsForPage(), 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().

307  {
308  include_once "./Modules/Scorm2004/classes/class.ilSCORM2004PageGUI.php";
309  include_once "./Modules/Scorm2004/classes/class.ilObjSCORM2004LearningModuleGUI.php";
310  include_once "./Services/MetaData/classes/class.ilMD.php";
311 
312  $tree = new ilTree($this->slm_id);
313  $tree->setTableNames('sahs_sc13_tree', 'sahs_sc13_tree_node');
314  $tree->setTreeTablePK("slm_id");
315 
316  // @todo
317  // Why is that much HTML code in an application class?
318  // Please extract all this HTML to a tpl.<t_name>.html file and use
319  // placeholders and the template engine to insert data.
320  //
321  // There copy/paste code residenting in ilSCORM2004ScoGUI. This
322  // should be merged.
323  //
324  // alex, 4 Apr 09
325  //
326 
327  // if ($a_one_file == "")
328  // {
329  $sco_tpl = new ilTemplate("tpl.sco.html", true, true, "Modules/Scorm2004");
330  // }
331  // else
332  // {
333  // $sco_tpl = $a_sco_tpl;
334  // }
335 
336  if ($mode != 'pdf' && $a_one_file == "") {
337  include_once("./Services/COPage/classes/class.ilCOPageHTMLExport.php");
338  $pg_exp = new ilCOPageHTMLExport($a_target_dir);
339  $pg_exp->getPreparedMainTemplate($sco_tpl);
340 
341  // init and question lang vars
343  $sco_tpl->setCurrentBlock("init");
344  include_once("./Services/COPage/classes/class.ilPCQuestion.php");
345  $sco_tpl->setVariable(
346  "TXT_INIT_CODE",
348  );
349  $sco_tpl->parseCurrentBlock();
350 
351  // (additional) style sheets needed
352  $styles = array("./css/yahoo/container.css",
353  "./css/question_handling.css");
354  foreach ($styles as $style) {
355  $sco_tpl->setCurrentBlock("css_file");
356  $sco_tpl->setVariable("CSS_FILE", $style);
357  $sco_tpl->parseCurrentBlock();
358  }
359 
360  // (additional) scripts needed
361  $scripts = array("./js/scorm.js",
362  "./js/pager.js", "./js/pure.js",
363  "./js/questions_" . $this->getId() . ".js");
364  foreach ($scripts as $script) {
365  $sco_tpl->setCurrentBlock("js_file");
366  $sco_tpl->setVariable("JS_FILE", $script);
367  $sco_tpl->parseCurrentBlock();
368  }
369 
370  if ($a_asset_type != "entry_asset" && $a_asset_type != "final_asset") {
371  self::renderNavigation($sco_tpl, "./images/spacer.png", $lk);
372  }
373 
374  $sco_tpl->touchBlock("finish");
375  }
376  // render head
377  $sco_tpl->setCurrentBlock("head");
378  $sco_tpl->setVariable("SCO_TITLE", $this->getTitle());
379  $sco_tpl->parseCurrentBlock();
380  $sco_tpl->touchBlock("tail");
381 
382  // meta page (meta info at SCO beginning)
383  self::renderMetaPage($sco_tpl, $this, $a_asset_type, $mode);
384  if ($a_one_file != "") {
385  fputs($a_one_file, "<a name='sco" . $this->getId() . "'></a>");
386  fputs($a_one_file, $sco_tpl->get("meta_page"));
387  }
388 
389  //notify Question Exporter of new SCO
390  require_once './Modules/Scorm2004/classes/class.ilQuestionExporter.php';
392 
393  // init export (this initialises glossary template)
395  $terms = array();
396  $terms = $this->getGlossaryTermIds();
397  include_once("./Modules/Scorm2004/classes/class.ilSCORM2004ScoGUI.php");
398  $pages = $tree->getSubTree($tree->getNodeData($this->getId()), true, 'page');
399  $sco_q_ids = array();
400  foreach ($pages as $page) {
401  //echo(print_r($page));
402  $page_obj = new ilSCORM2004PageGUI(
403  $this->getType(),
404  $page["obj_id"],
405  0,
406  $this->slm_object->getId()
407  );
408  $page_obj->setPresentationTitle($page["title"]);
409  $page_obj->setOutputMode(IL_PAGE_OFFLINE);
410  $page_obj->setStyleId($this->slm_object->getStyleSheetId());
411  if (count($terms) > 1) {
412  $page_obj->setGlossaryOverviewInfo(
414  $this
415  );
416  }
417 
418  $page_output = $page_obj->showPage("export");
419 
420  // collect media objects
421  $mob_ids = $page_obj->getSCORM2004Page()->collectMediaObjects(false);
422  foreach ($mob_ids as $mob_id) {
423  $this->mob_ids[$mob_id] = $mob_id;
424  $media_obj = new ilObjMediaObject($mob_id);
425  if ($media_obj->hasFullscreenItem()) {
426  $media_obj->exportMediaFullscreen($a_target_dir, $page_obj->getPageObject());
427  }
428  }
429 
430  // collect glossary items
431  $int_links = $page_obj->getPageObject()->getInternalLinks(true);
432  include_once("./Services/Link/classes/class.ilInternalLink.php");
433  include_once("./Modules/Glossary/classes/class.ilGlossaryDefinition.php");
434  if (is_array($int_links)) {
435  foreach ($int_links as $k => $e) {
436  // glossary link
437  if ($e["Type"] == "GlossaryItem") {
438  $karr = explode(":", $k);
439  $tid = ilInternalLink::_extractObjIdOfTarget($karr[0]);
441  foreach ($dids as $did) {
442  include_once("./Modules/Glossary/classes/class.ilGlossaryDefPage.php");
443  $def_pg = new ilGlossaryDefPage($did["id"]);
444  $def_pg->buildDom();
445  $mob_ids = $def_pg->collectMediaObjects(false);
446  foreach ($mob_ids as $mob_id) {
447  $this->mob_ids[$mob_id] = $mob_id;
448  //echo "<br>-$mob_id-";
449  $media_obj = new ilObjMediaObject($mob_id);
450  if ($media_obj->hasFullscreenItem()) {
451  $media_obj->exportMediaFullscreen($a_target_dir, $def_pg);
452  }
453  }
454  include_once("./Services/COPage/classes/class.ilPCFileList.php");
455  $file_ids = ilPCFileList::collectFileItems($def_pg, $def_pg->getDomDoc());
456 
457  foreach ($file_ids as $file_id) {
458  $this->file_ids[$file_id] = $file_id;
459  }
460  }
461  }
462  }
463  }
464  //exit;
465  // collect all file items
466  include_once("./Services/COPage/classes/class.ilPCFileList.php");
467  $file_ids = ilPCFileList::collectFileItems($page_obj->getSCORM2004Page(), $page_obj->getSCORM2004Page()->getDomDoc());
468  foreach ($file_ids as $file_id) {
469  $this->file_ids[$file_id] = $file_id;
470  }
471 
472  if ($mode == 'pdf') {
473  include_once("./Services/COPage/classes/class.ilPCQuestion.php");
474  $q_ids = ilPCQuestion::_getQuestionIdsForPage("sahs", $page["obj_id"]);
475  foreach ($q_ids as $q_id) {
476  include_once("./Modules/TestQuestionPool/classes/class.assQuestionGUI.php");
477  $q_gui = assQuestionGUI::_getQuestionGUI("", $q_id);
478  $q_gui->setRenderPurpose(assQuestionGUI::RENDER_PURPOSE_PREVIEW);
479  $q_gui->outAdditionalOutput();
480  $html = $q_gui->getPreview(true);
481  $page_output = preg_replace("/{{{{{Question;il__qst_" . $q_id . "}}}}}/i", $html, $page_output);
482  }
483 
484  $sco_tpl->touchBlock("pdf_pg_break");
485  }
486 
487  $sco_tpl->setCurrentBlock("page");
488  $sco_tpl->setVariable("PAGE", $page_output);
489  $sco_tpl->parseCurrentBlock();
490 
491  // get all question ids of the sco
492  if ($a_one_file != "") {
493  include_once("./Services/COPage/classes/class.ilPCQuestion.php");
494  $q_ids = ilPCQuestion::_getQuestionIdsForPage("sahs", $page["obj_id"]);
495  foreach ($q_ids as $i) {
496  if (!in_array($i, $sco_q_ids)) {
497  $sco_q_ids[] = $i;
498  }
499  }
500  }
501  }
502 
503  // glossary
504  if ($mode != 'pdf') {
505  $sco_tpl->setVariable(
506  "GLOSSARY_HTML",
508  );
509  }
510 
511  if ($a_one_file == "") {
512  $output = $sco_tpl->get();
513  } else {
514  $output = $sco_tpl->get("page");
515  }
516 
517  if ($mode == 'pdf') {
518  $output = preg_replace("/<div class=\"ilc_page_title_PageTitle\">(.*?)<\/div>/i", "<h2>$1</h2>", $output);
519  }
520 
521  $output = preg_replace("/mobs\/mm_(\d+)\/([^\"]+)/i", "./objects/il_" . IL_INST_ID . "_mob_$1/$2", $output);
522  $output = preg_replace("/\.\/files\/file_(\d+)\/([^\"]+)/i", "./objects/il_" . IL_INST_ID . "_file_$1/$2", $output);
523  $output = preg_replace("/\.\/Services\/MediaObjects\/flash_mp3_player/i", "./players", $output);
524  $output = preg_replace("/file=..\/..\/..\/.\//i", "file=../", $output);
525 
526  if ($mode != 'pdf') {
527  $output = preg_replace_callback("/href=\"&mob_id=(\d+)&pg_id=(\d+)\"/", array(get_class($this), 'fixFullscreeenLink'), $output);
528  // this one is for fullscreen in glossary entries
529  $output = preg_replace_callback("/href=\"fullscreen_(\d+)\.html\"/", array(get_class($this), 'fixFullscreeenLink'), $output);
530  $output = preg_replace_callback("/{{{{{(Question;)(il__qst_[0-9]+)}}}}}/", array(get_class($this), 'insertQuestion'), $output);
531  $q_handling = file_get_contents('./Modules/Scorm2004/scripts/questions/question_handling.js');
532  fputs(fopen($a_target_dir . '/js/questions_' . $this->getId() . '.js', 'w+'), ilQuestionExporter::questionsJS() . $q_handling);
533  copy(
534  "./Modules/Scorm2004/templates/default/question_handling.css",
535  $a_target_dir . '/css/question_handling.css'
536  );
537 
538  // hack to get the question js into the file and to display the correct answers
539  if ($a_one_file != "") {
540  $output = '<script type="text/javascript">' . ilQuestionExporter::questionsJS() . '</script>' . $output;
541  if (count($sco_q_ids) > 0) {
542  $output .= '<script type="text/javascript">';
543  foreach ($sco_q_ids as $i) {
544  if ($i > 0) {
545  $output .= "ilias.questions.showCorrectAnswers(" . $i . "); \n";
546  }
547  }
548  $output .= '</script>';
549  }
550  }
551 
552  foreach (ilQuestionExporter::getMobs() as $mob_id) {
553  $this->mob_ids[$mob_id] = $mob_id;
554  }
555  }
556  $this->q_media = ilQuestionExporter::getFiles();
557  //questions export end
558 
559  if ($a_one_file != "") {
560  fputs($a_one_file, $output);
561  } else {
562  fputs(fopen($a_target_dir . '/index.html', 'w+'), $output);
563  }
564 
565  $this->exportFileItems($a_target_dir, $expLog);
566  }
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.
exportFileItems($a_target_dir, &$expLog)
export files of file itmes
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...
Class ilSCORM2004Page GUI class.
$i
Definition: disco.tpl.php:19
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 224 of file class.ilSCORM2004Asset.php.

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

225  {
226  $tpl = $this->tpl;
227  $lng = $this->lng;
229  $a_xml_writer = new ilXmlWriter;
230  $a_xml_writer->xmlStartTag("ContentObject", array("Type" => "SCORM2004SCO"));
231  $this->exportPDFPrepareXmlNFiles($a_inst, $a_target_dir, $expLog, $a_xml_writer);
232  $a_xml_writer->xmlEndTag("ContentObject");
233  include_once 'Services/Transformation/classes/class.ilXML2FO.php';
234  $xml2FO = new ilXML2FO();
235  $xml2FO->setXSLTLocation('./Modules/Scorm2004/templates/xsl/contentobject2fo.xsl');
236  $xml2FO->setXMLString($a_xml_writer->xmlDumpMem());
237  $xml2FO->setXSLTParams(array('target_dir' => $a_target_dir));
238  $xml2FO->transform();
239  $fo_string = $xml2FO->getFOString();
240  $fo_xml = simplexml_load_string($fo_string);
241  $fo_ext = $fo_xml->xpath("//fo:declarations");
242  $fo_ext = $fo_ext[0];
243  $results = array();
244  include_once "./Services/Utilities/classes/class.ilFileUtils.php";
245  ilFileUtils::recursive_dirscan($a_target_dir . "/objects", $results);
246  if (is_array($results["file"])) {
247  foreach ($results["file"] as $key => $value) {
248  $e = $fo_ext->addChild("fox:embedded-file", "", "http://xml.apache.org/fop/extensions");
249  $e->addAttribute("src", $results[path][$key] . $value);
250  $e->addAttribute("name", $value);
251  $e->addAttribute("desc", "");
252  }
253  }
254  $fo_string = $fo_xml->asXML();
255  $a_xml_writer->_XmlWriter;
256  return $fo_string;
257  }
xmlStartTag($tag, $attrs=null, $empty=false, $encode=true, $escape=true)
Writes a starttag.
XML writer class.
global $ilCtrl
Definition: ilias.php:18
exportPDFPrepareXmlNFiles($a_inst, $a_target_dir, &$expLog, &$a_xml_writer)
$results
Definition: svg-scanner.php:47
static recursive_dirscan($dir, &$arr)
Recursively scans a given directory and writes path and filename into referenced array.
$key
Definition: croninfo.php:18
+ Here is the call graph for this function:

◆ exportPDFPrepareXmlNFiles()

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

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

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

Referenced by exportPDF().

260  {
261  $this->exportHTML4PDF($a_inst, $a_target_dir, $expLog);
262  $tpl = $this->tpl;
263  $lng = $this->lng;
265  $this->exportXMLPageObjects($a_target_dir, $a_xml_writer, $a_inst, $expLog);
266  $this->exportXMLMediaObjects($a_xml_writer, $a_inst, $a_target_dir, $expLog);
267  $this->exportFileItems($a_target_dir, $expLog);
268 
269  include_once "./Modules/Scorm2004/classes/class.ilSCORM2004PageNode.php";
270  include_once "./Modules/Scorm2004/classes/class.ilSCORM2004Page.php";
271 
272  $tree = new ilTree($this->slm_id);
273  $tree->setTableNames('sahs_sc13_tree', 'sahs_sc13_tree_node');
274  $tree->setTreeTablePK("slm_id");
275  foreach ($tree->getSubTree($tree->getNodeData($this->getId()), true, 'page') as $page) {
276  $page_obj = new ilSCORM2004Page($page["obj_id"]);
277 
278  include_once("./Services/COPage/classes/class.ilPCQuestion.php");
279  $q_ids = ilPCQuestion::_getQuestionIdsForPage("sahs", $page["obj_id"]);
280  if (count($q_ids) > 0) {
281  include_once("./Modules/TestQuestionPool/classes/class.assQuestion.php");
282  foreach ($q_ids as $q_id) {
283  $q_obj = assQuestion::_instanciateQuestion($q_id);
284  $qti_file = fopen($a_target_dir . "/qti_" . $q_id . ".xml", "w");
285  fwrite($qti_file, $q_obj->toXML());
286  fclose($qti_file);
287  $x = file_get_contents($a_target_dir . "/qti_" . $q_id . ".xml");
288  $x = str_replace('<?xml version="1.0" encoding="utf-8"?>', '', $x);
289  $a_xml_writer->appendXML($x);
290  }
291  }
292  unset($page_obj);
293  }
294  }
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.
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)
$x
Definition: complexTest.php:9
+ 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 130 of file class.ilSCORM2004Asset.php.

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

131  {
132  copy('./xml/ilias_co_3_7.dtd', $a_target_dir . '/ilias_co_3_7.dtd');
133  copy('./Modules/Scorm2004/templates/xsl/sco.xsl', $a_target_dir . '/sco.xsl');
134 
135  $a_xml_writer = new ilXmlWriter;
136  // MetaData
137  //file_put_contents($a_target_dir.'/indexMD.xml','<lom xmlns="http://ltsc.ieee.org/xsd/LOM"><general/><classification/></lom>');
138  $this->exportXMLMetaData($a_xml_writer);
139  $metadata_xml = $a_xml_writer->xmlDumpMem(false);
140  $a_xml_writer->_XmlWriter;
141  $xsl = file_get_contents("./Modules/Scorm2004/templates/xsl/metadata.xsl");
142  $args = array( '/_xml' => $metadata_xml , '/_xsl' => $xsl );
143  $xh = xslt_create();
144  $output = xslt_process($xh, "arg:/_xml", "arg:/_xsl", null, $args, null);
145  xslt_free($xh);
146  file_put_contents($a_target_dir . '/indexMD.xml', $output);
147 
148  $a_xml_writer = new ilXmlWriter;
149  // set dtd definition
150  $a_xml_writer->xmlSetDtdDef("<!DOCTYPE ContentObject SYSTEM \"http://www.ilias.de/download/dtd/ilias_co_3_7.dtd\">");
151 
152  // set generated comment
153  $a_xml_writer->xmlSetGenCmt("Export of ILIAS Content Module " . $this->getId() . " of installation " . $a_inst . ".");
154 
155  // set xml header
156  $a_xml_writer->xmlHeader();
157 
158  $a_xml_writer->xmlStartTag("ContentObject", array("Type" => "SCORM2004SCO"));
159 
160  $this->exportXMLMetaData($a_xml_writer);
161 
162  $this->exportXMLPageObjects($a_target_dir, $a_xml_writer, $a_inst, $expLog);
163 
164  $this->exportXMLMediaObjects($a_xml_writer, $a_inst, $a_target_dir, $expLog);
165 
166  $this->exportHTML($a_inst, $a_target_dir, $expLog);
167 
168  //overwrite scorm.js for scrom 1.2
169  if ($ver == "12") {
170  copy('./Modules/Scorm2004/scripts/scorm_12.js', $a_target_dir . '/js/scorm.js');
171  }
172 
173  $a_xml_writer->xmlEndTag("ContentObject");
174 
175  $a_xml_writer->xmlDumpFile($a_target_dir . '/index.xml', false);
176 
177  $a_xml_writer->_XmlWriter;
178 
179  // export sco data (currently only objective) to sco.xml
180  if ($this->getType() == "sco") {
181  $objectives_text = "";
182  $a_xml_writer = new ilXmlWriter;
183 
184  $tr_data = $this->getObjectives();
185  foreach ($tr_data as $data) {
186  $objectives_text .= $data->getObjectiveID();
187  }
188  $a_xml_writer->xmlStartTag("sco");
189  $a_xml_writer->xmlElement("objective", null, $objectives_text);
190  $a_xml_writer->xmlEndTag("sco");
191  $a_xml_writer->xmlDumpFile($a_target_dir . '/sco.xml', false);
192  $a_xml_writer->_XmlWriter;
193  }
194  }
xslt_create()
xmlSetDtdDef($dtdDef)
Sets dtd definition.
xslt_free(&$proc)
XML writer class.
exportXMLMediaObjects(&$a_xml_writer, $a_inst, $a_target_dir, &$expLog)
exportHTML( $a_inst, $a_target_dir, &$expLog, $a_asset_type="sco", $a_one_file="")
exportXMLPageObjects($a_target_dir, &$a_xml_writer, $a_inst, &$expLog)
copy($a_target_slm)
Copy sco.
exportXMLMetaData(&$a_xml_writer)
$data
Definition: bench.php:6
+ Here is the call graph for this function:

◆ exportXMLMediaObjects()

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

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

References ilObject\_lookupType().

Referenced by exportPDFPrepareXmlNFiles(), and exportScorm().

761  {
762  include_once("./Services/MediaObjects/classes/class.ilObjMediaObject.php");
763  include_once("./Modules/File/classes/class.ilObjFile.php");
764  $linked_mobs = array();
765  if (is_array($this->mob_ids)) {
766  // mobs directly embedded into pages
767  foreach ($this->mob_ids as $mob_id) {
768  if ($mob_id > 0) {
769  $expLog->write(date("[y-m-d H:i:s] ") . "Media Object " . $mob_id);
770  $media_obj = new ilObjMediaObject($mob_id);
771  $media_obj->exportXML($a_xml_writer, $a_inst);
772  $lmobs = $media_obj->getLinkedMediaObjects($this->mob_ids);
773  $linked_mobs = array_merge($linked_mobs, $lmobs);
774  unset($media_obj);
775  }
776  }
777 
778  // linked mobs (in map areas)
779  foreach ($linked_mobs as $mob_id) {
780  if ($mob_id > 0) {
781  $expLog->write(date("[y-m-d H:i:s] ") . "Media Object " . $mob_id);
782  $media_obj = new ilObjMediaObject($mob_id);
783  $media_obj->exportXML($a_xml_writer, $a_inst);
784  unset($media_obj);
785  }
786  }
787  }
788  if (is_array($this->file_ids)) {
789  foreach ($this->file_ids as $file_id) {
790  if (ilObject::_lookupType($file_id) == "file") {
791  $expLog->write(date("[y-m-d H:i:s] ") . "File Item " . $file_id);
792  $file_obj = new ilObjFile($file_id, false);
793  $file_obj->export($a_target_dir);
794  unset($file_obj);
795  }
796  }
797  }
798  }
Class ilObjMediaObject.
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 863 of file class.ilSCORM2004Asset.php.

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

Referenced by exportScorm().

864  {
865  include_once("Services/MetaData/classes/class.ilMD2XML.php");
866  $md2xml = new ilMD2XML($this->getSLMId(), $this->getId(), $this->getType());
867  $md2xml->setExportMode(true);
868  $md2xml->startExport();
869  $a_xml_writer->appendXML($md2xml->getXML());
870  }
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 712 of file class.ilSCORM2004Asset.php.

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

Referenced by exportPDFPrepareXmlNFiles(), and exportScorm().

713  {
714  include_once "./Modules/Scorm2004/classes/class.ilSCORM2004PageNode.php";
715  include_once "./Modules/Scorm2004/classes/class.ilSCORM2004Page.php";
716 
717  $tree = new ilTree($this->slm_id);
718  $tree->setTableNames('sahs_sc13_tree', 'sahs_sc13_tree_node');
719  $tree->setTreeTablePK("slm_id");
720 
721  $pages = $tree->getSubTree($tree->getNodeData($this->getId()), true, 'page');
722  foreach ($pages as $page) {
723  $expLog->write(date("[y-m-d H:i:s] ") . "Page Object " . $page["obj_id"]);
724 
725  // export xml to writer object
726  $page_obj = new ilSCORM2004Page($page["obj_id"]);
727  $page_obj->exportXML($a_xml_writer, "normal", $a_inst);
728 
729  //collect media objects
730  $mob_ids = $page_obj->getMediaObjectIds();
731  foreach ($mob_ids as $mob_id) {
732  $this->mob_ids[$mob_id] = $mob_id;
733  }
734 
735  // collect all file items
736  $file_ids = $page_obj->getFileItemIds();
737  foreach ($file_ids as $file_id) {
738  $this->file_ids[$file_id] = $file_id;
739  }
740 
741  include_once("./Services/COPage/classes/class.ilPCQuestion.php");
742  $q_ids = ilPCQuestion::_getQuestionIdsForPage("sahs", $page["obj_id"]);
743  if (count($q_ids) > 0) {
744  include_once("./Modules/TestQuestionPool/classes/class.assQuestion.php");
745  foreach ($q_ids as $q_id) {
746  $q_obj = assQuestion::_instantiateQuestion($q_id);
747  // see #16557
748  if (is_object($q_obj)) {
749  $qti_file = fopen($a_target_dir . "/qti_" . $q_id . ".xml", "w");
750  fwrite($qti_file, $q_obj->toXML());
751  fclose($qti_file);
752  }
753  }
754  }
755 
756  unset($page_obj);
757  }
758  }
static _getQuestionIdsForPage($a_parent_type, $a_page_id, $a_lang="-")
Get all questions of a page.
Class ilSCORM2004Page.
Tree class data representation in hierachical trees using the Nested Set Model with Gaps by Joe Celco...
static _instantiateQuestion($question_id)
+ 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 693 of file class.ilSCORM2004Asset.php.

694  {
695  $media_obj = new ilObjMediaObject($matches[1]);
696  if ($media_obj->hasFullscreenItem()) {
697  return "href=\"./objects/il_" . IL_INST_ID . "_mob_" . $matches[1] . "/fullscreen.html\"";
698  //return "href=\"./objects/il_".IL_INST_ID."_mob_".$matches[1]."/".$media_obj->getMediaItem("Fullscreen")->getLocation()."\"";
699  }
700  }
Class ilObjMediaObject.

◆ getExportFiles()

ilSCORM2004Asset::getExportFiles ( )

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

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

873  {
874  $file = array();
875 
876  require_once("./Modules/Scorm2004/classes/class.ilSCORM2004Export.php");
877 
878  $export = new ilSCORM2004Export($this);
879  foreach ($export->getSupportedExportTypes() as $type) {
880  $dir = $export->getExportDirectoryForType($type);
881  // quit if import dir not available
882  if (!@is_dir($dir) or !is_writeable($dir)) {
883  continue;
884  }
885  // open directory
886  $cdir = dir($dir);
887 
888  // get files and save the in the array
889  while ($entry = $cdir->read()) {
890  if ($entry != "." and
891  $entry != ".." and
892  (
893  preg_match("~^[0-9]{10}_{2}[0-9]+_{2}(" . $this->getType() . "_)" . $this->getId() . "+\.zip\$~", $entry) or
894  preg_match("~^[0-9]{10}_{2}[0-9]+_{2}(" . $this->getType() . "_)" . $this->getId() . "+\.pdf\$~", $entry) or
895  preg_match("~^[0-9]{10}_{2}[0-9]+_{2}(" . $this->getType() . "_)" . $this->getId() . "+\.iso\$~", $entry)
896  )) {
897  $file[$entry . $type] = array("type" => $type, "file" => $entry,
898  "size" => filesize($dir . "/" . $entry));
899  }
900  }
901 
902  // close import directory
903  $cdir->close();
904  }
905 
906  // sort files
907  ksort($file);
908  reset($file);
909  return $file;
910  }
+ Here is the call graph for this function:

◆ getGlossaryTermIds()

ilSCORM2004Asset::getGlossaryTermIds ( )

Get glossary term ids in sco.

Parameters

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

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

Referenced by exportHTMLPageObjects().

919  {
920  include_once("./Modules/Glossary/classes/class.ilGlossaryTerm.php");
921  $childs = $this->tree->getChilds($this->getId());
922  $ids = array();
923  foreach ($childs as $c) {
925  "sahs" . ":pg",
926  $c["child"]
927  );
928  foreach ($links as $l) {
929  if ($l["type"] == "git" && (int) $l["inst"] == 0 && !isset($ids[$l["id"]])) {
930  $ids[$l["id"]] = ilGlossaryTerm::_lookGlossaryTerm($l["id"]);
931  }
932  }
933  }
934  asort($ids);
935  return $ids;
936  }
global $l
Definition: afr.php:30
$links
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 79 of file class.ilSCORM2004Asset.php.

References ilSCORM2004Node\getId().

Referenced by create().

80  {
81  $seq_item = new ilSCORM2004Item($this->getId());
82  $seq_item->insert();
83  }
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 703 of file class.ilSCORM2004Asset.php.

References $ret.

704  {
705  $q_exporter = new ilQuestionExporter();
706 
707  $ret = $q_exporter->exportQuestion($matches[2], "./objects/", "offline");
708 
709  return $ret;
710  }
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 607 of file class.ilSCORM2004Asset.php.

References $DIC, $lng, and ilMD\getGeneral().

Referenced by ilSCORM2004ScoGUI\sco_preview().

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

References $DIC, $lng, and ilUtil\getImagePath().

Referenced by ilSCORM2004ScoGUI\sco_preview().

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

Field Documentation

◆ $ctrl

ilSCORM2004Asset::$ctrl
protected

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

Referenced by exportPDF(), and exportPDFPrepareXmlNFiles().

◆ $lng

ilSCORM2004Asset::$lng
protected

◆ $q_media

ilSCORM2004Asset::$q_media = null

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

◆ $tpl

ilSCORM2004Asset::$tpl
protected

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

Referenced by exportPDF(), and exportPDFPrepareXmlNFiles().


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