From: Dan Marsden Date: Fri, 12 Aug 2011 00:44:16 +0000 (+1200) Subject: MDL-28649 SCORM fix force new attempt when skipview is used X-Git-Tag: v2.2.0-beta~529^2 X-Git-Url: http://git.moodle.org/gw?p=moodle.git;a=commitdiff_plain;h=666efc149a2e65d1b8a8ec0bbc65841a7fcdfe41 MDL-28649 SCORM fix force new attempt when skipview is used --- diff --git a/mod/scorm/locallib.php b/mod/scorm/locallib.php index 51248fd1edb..a19b845e4f6 100644 --- a/mod/scorm/locallib.php +++ b/mod/scorm/locallib.php @@ -680,7 +680,7 @@ function scorm_course_format_display($user, $course) { } $contextmodule = get_context_instance(CONTEXT_MODULE, $cm->id); if ((has_capability('mod/scorm:skipview', $contextmodule))) { - scorm_simple_play($scorm, $user, $contextmodule); + scorm_simple_play($scorm, $user, $contextmodule, $cm->id); } $colspan = ''; $headertext = '
'.get_string('name').': '.format_string($scorm->name).''; @@ -811,7 +811,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; @@ -840,6 +840,12 @@ function scorm_simple_play($scorm, $user, $context) { '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); } } diff --git a/mod/scorm/view.php b/mod/scorm/view.php index 42c5c588d80..1b536b6a797 100644 --- a/mod/scorm/view.php +++ b/mod/scorm/view.php @@ -72,7 +72,7 @@ $pagetitle = strip_tags($course->shortname.': '.format_string($scorm->name)); 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); + scorm_simple_play($scorm, $USER, $contextmodule, $cm->id); } //