mirror of
https://github.com/moodle/moodle.git
synced 2025-08-09 02:46:40 +02:00
MDL-46639 mod_scorm: Fix load of simple AICC content
Thanks to Ian Wild for the report and suggested patch.
This commit is contained in:
parent
fd72531964
commit
9dc8c0f8b1
2 changed files with 27 additions and 13 deletions
|
@ -286,11 +286,13 @@ function scorm_parse($scorm, $full) {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
require_once("$CFG->dirroot/mod/scorm/datamodels/aicclib.php");
|
require_once("$CFG->dirroot/mod/scorm/datamodels/aicclib.php");
|
||||||
// AICC
|
$result = scorm_parse_aicc($scorm);
|
||||||
if (!scorm_parse_aicc($scorm)) {
|
if (!$result) {
|
||||||
$scorm->version = 'ERROR';
|
$scorm->version = 'ERROR';
|
||||||
}
|
} else {
|
||||||
$scorm->version = 'AICC';
|
$scorm->version = 'AICC';
|
||||||
|
$scorm->launch = $result;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if ($scorm->scormtype === SCORM_TYPE_EXTERNAL and $cfg_scorm->allowtypeexternal) {
|
} else if ($scorm->scormtype === SCORM_TYPE_EXTERNAL and $cfg_scorm->allowtypeexternal) {
|
||||||
|
@ -303,11 +305,15 @@ function scorm_parse($scorm, $full) {
|
||||||
|
|
||||||
} else if ($scorm->scormtype === SCORM_TYPE_AICCURL and $cfg_scorm->allowtypeexternalaicc) {
|
} else if ($scorm->scormtype === SCORM_TYPE_AICCURL and $cfg_scorm->allowtypeexternalaicc) {
|
||||||
require_once("$CFG->dirroot/mod/scorm/datamodels/aicclib.php");
|
require_once("$CFG->dirroot/mod/scorm/datamodels/aicclib.php");
|
||||||
// AICC
|
// AICC.
|
||||||
if (!scorm_parse_aicc($scorm)) {
|
$result = scorm_parse_aicc($scorm);
|
||||||
|
if (!$result) {
|
||||||
$scorm->version = 'ERROR';
|
$scorm->version = 'ERROR';
|
||||||
}
|
} else {
|
||||||
$scorm->version = 'AICC';
|
$scorm->version = 'AICC';
|
||||||
|
$scorm->launch = $result;
|
||||||
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
// sorry, disabled type
|
// sorry, disabled type
|
||||||
return;
|
return;
|
||||||
|
@ -1792,7 +1798,13 @@ function scorm_get_toc($user, $scorm, $cmid, $toclink=TOCJSLINK, $currentorg='',
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty($scoid)) {
|
if (empty($scoid)) {
|
||||||
|
// If this is a normal package with an org sco and child scos get the first child.
|
||||||
|
if (!empty($scoes['scoes'][0]->children)) {
|
||||||
$result->sco = $scoes['scoes'][0]->children[0];
|
$result->sco = $scoes['scoes'][0]->children[0];
|
||||||
|
} else { // This package only has one sco - it may be a simple external AICC package.
|
||||||
|
$result->sco = $scoes['scoes'][0];
|
||||||
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
$result->sco = scorm_get_sco($scoid);
|
$result->sco = scorm_get_sco($scoid);
|
||||||
}
|
}
|
||||||
|
|
|
@ -742,6 +742,7 @@ M.mod_scorm.init = function(Y, nav_display, navposition_left, navposition_top, h
|
||||||
|
|
||||||
// finally activate the chosen item
|
// finally activate the chosen item
|
||||||
var scorm_first_url = null;
|
var scorm_first_url = null;
|
||||||
|
if (typeof tree.rootNode.children[0] !== 'undefined') {
|
||||||
if (tree.rootNode.children[0].title !== scoes_nav[launch_sco].url) {
|
if (tree.rootNode.children[0].title !== scoes_nav[launch_sco].url) {
|
||||||
var node = tree.getNodeByAttribute('title', scoes_nav[launch_sco].url);
|
var node = tree.getNodeByAttribute('title', scoes_nav[launch_sco].url);
|
||||||
if (node !== null) {
|
if (node !== null) {
|
||||||
|
@ -750,6 +751,7 @@ M.mod_scorm.init = function(Y, nav_display, navposition_left, navposition_top, h
|
||||||
} else {
|
} else {
|
||||||
scorm_first_url = tree.rootNode.children[0];
|
scorm_first_url = tree.rootNode.children[0];
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (scorm_first_url == null) { // This is probably a single sco with no children (AICC Direct uses this).
|
if (scorm_first_url == null) { // This is probably a single sco with no children (AICC Direct uses this).
|
||||||
scorm_first_url = tree.rootNode;
|
scorm_first_url = tree.rootNode;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue