Skip to content
Permalink
Browse files

MDL-28649 SCORM start new attempt if set when skipview used.

  • Loading branch information...
danmarsden committed Aug 12, 2011
1 parent 3a5778e commit dbc61bc225d55b9314fba236afcd2cbfa5fd68b7
Showing with 13 additions and 8 deletions.
  1. +12 −7 mod/scorm/locallib.php
  2. +1 −1 mod/scorm/view.php
@@ -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.'&currentorg='.$orgidentifier);
$result = true;
} else if ($scorm->skipview == 2) {
header('Location: player.php?a='.$scorm->id.'&scoid='.$sco->id.'&currentorg='.$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);
}
}
}
@@ -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;
}

0 comments on commit dbc61bc

Please sign in to comment.
You can’t perform that action at this time.