MDL-28649 SCORM start new attempt if set when skipview used.
This commit is contained in:
+12
-7
@@ -798,7 +798,7 @@ function scorm_view_display ($user, $scorm, $action, $cm) {
|
||||
}
|
||||
}
|
||||
|
||||
function scorm_simple_play($scorm,$user, $context) {
|
||||
function scorm_simple_play($scorm,$user, $context, $cmid) {
|
||||
global $DB;
|
||||
|
||||
$result = false;
|
||||
@@ -824,12 +824,17 @@ function scorm_simple_play($scorm,$user, $context) {
|
||||
|
||||
if ($scorm->skipview >= 1) {
|
||||
$sco = current($scoes);
|
||||
if (scorm_get_tracks($sco->id,$user->id) === false) {
|
||||
header('Location: player.php?a='.$scorm->id.'&scoid='.$sco->id.'¤torg='.$orgidentifier);
|
||||
$result = true;
|
||||
} else if ($scorm->skipview == 2) {
|
||||
header('Location: player.php?a='.$scorm->id.'&scoid='.$sco->id.'¤torg='.$orgidentifier);
|
||||
$result = true;
|
||||
$url = new moodle_url('/mod/scorm/player.php', array('a' => $scorm->id,
|
||||
'currentorg'=>$orgidentifier,
|
||||
'scoid'=>$sco->id));
|
||||
if ($scorm->skipview == 2 || scorm_get_tracks($sco->id, $user->id) === false) {
|
||||
if (!empty($scorm->forcenewattempt)) {
|
||||
$result = scorm_get_toc($user, $scorm, $cmid, TOCFULLURL, $orgidentifier);
|
||||
if ($result->incomplete === false) {
|
||||
$url->param('newattempt','on');
|
||||
}
|
||||
}
|
||||
redirect($url);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -57,7 +57,7 @@
|
||||
|
||||
add_to_log($course->id, 'scorm', 'pre-view', 'view.php?id='.$cm->id, "$scorm->id", $cm->id);
|
||||
|
||||
if ((has_capability('mod/scorm:skipview', $contextmodule)) && scorm_simple_play($scorm,$USER, $contextmodule)) {
|
||||
if ((has_capability('mod/scorm:skipview', $contextmodule)) && scorm_simple_play($scorm,$USER, $contextmodule,$cm->id)) {
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user