From aab23f98cda94fe70174fc44362e1d5d9e7aabbe Mon Sep 17 00:00:00 2001 From: Dan Marsden Date: Sun, 31 Jul 2011 18:51:39 +1200 Subject: [PATCH] MDL-28542 SCORM Course format should use skipview setting. --- mod/scorm/locallib.php | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/mod/scorm/locallib.php b/mod/scorm/locallib.php index 982329f3606..3a8773cb252 100644 --- a/mod/scorm/locallib.php +++ b/mod/scorm/locallib.php @@ -678,6 +678,10 @@ function scorm_course_format_display($user, $course) { if (! $cm = get_coursemodule_from_instance('scorm', $scorm->id, $course->id)) { print_error('invalidcoursemodule'); } + $contextmodule = get_context_instance(CONTEXT_MODULE, $cm->id); + if ((has_capability('mod/scorm:skipview', $contextmodule)) && scorm_simple_play($scorm, $user, $contextmodule)) { + exit; + } $colspan = ''; $headertext = '
'.get_string('name').': '.format_string($scorm->name).''; if (has_capability('moodle/course:manageactivities', $context)) { @@ -832,12 +836,11 @@ 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) { + redirect($url); } } }