-
Bug
-
Resolution: Duplicate
-
Minor
-
None
-
2.4, 2.4.1
-
None
-
MOODLE_24_STABLE
Scorm in Moodle 2.4 has an error when review a lesson.
Reproduction steps:
- Attempting a Scorm lesson the first time, everything goes well.
- Enter that lesson again with Start new attempt checked => fine
However, enter that lesson again with Start new attempt unchecked => error
The problem is in the player.php file, scorm_get_toc is expected to always return a sco object:
$result = scorm_get_toc($USER, $scorm, $cm->id, TOCJSLINK, $currentorg, $scoid, $mode, $attempt, true, true);
|
$sco = $result->sco;
|
...
|
if ($trackdata = scorm_get_tracks($sco->id, $USER->id, $attempt)) {
|
|
However, the scorm_get_toc function return either a sco object or an array of sco objects:
if (empty($scoid)) {
|
$result->sco = $scoes['scoes'][0]->children;
|
} else {
|
$result->sco = scorm_get_sco($scoid);
|
}
|
Therefore, when reviewing, the array of scos is returned and it cannot select any sco to display. Placing an if like below seems to work but I'm not sure it works in every case, since I'm not familiar with the scorm specification.
$result = scorm_get_toc($USER, $scorm, $cm->id, TOCJSLINK, $currentorg, $scoid, $mode, $attempt, true, true);
|
if (is_array($result->sco)) {
|
$sco = $result->sco[0];
|
} else {
|
$sco = $result->sco;
|
}
|
...
|
if ($trackdata = scorm_get_tracks($sco->id, $USER->id, $attempt)) {...
|
|
- duplicates
-
MDL-36853 PHP warnings when returning to an existing attempt
-
- Closed
-