diff --git a/mod/scorm/mod_form.php b/mod/scorm/mod_form.php index 6b745a0e17c..783d5428efb 100644 --- a/mod/scorm/mod_form.php +++ b/mod/scorm/mod_form.php @@ -137,12 +137,6 @@ class mod_scorm_mod_form extends moodleform_mod { // Skip view page. $skipviewoptions = scorm_get_skip_view_array(); - if ($COURSE->format == 'singleactivity') { // Remove option that would cause a constant redirect. - unset($skipviewoptions[SCORM_SKIPVIEW_ALWAYS]); - if ($cfgscorm->skipview == SCORM_SKIPVIEW_ALWAYS) { - $cfgscorm->skipview = SCORM_SKIPVIEW_FIRST; - } - } $mform->addElement('select', 'skipview', get_string('skipview', 'scorm'), $skipviewoptions); $mform->addHelpButton('skipview', 'skipview', 'scorm'); $mform->setDefault('skipview', $cfgscorm->skipview); diff --git a/mod/scorm/player.php b/mod/scorm/player.php index beca474643a..c060736867c 100644 --- a/mod/scorm/player.php +++ b/mod/scorm/player.php @@ -160,8 +160,14 @@ $completion->set_module_viewed($cm); // Print the page header. if (empty($scorm->popup) || $displaymode == 'popup') { - // Redirect back to the correct section if one section per page is being used. - $exiturl = course_get_url($course, $cm->sectionnum); + if ($course->format == 'singleactivity' && $scorm->skipview == SCORM_SKIPVIEW_ALWAYS + && !has_capability('mod/scorm:viewreport', context_module::instance($cm->id))) { + // Redirect students back to site home to avoid redirect loop. + $exiturl = $CFG->wwwroot; + } else { + // Redirect back to the correct section if one section per page is being used. + $exiturl = course_get_url($course, $cm->sectionnum); + } $exitlink = html_writer::link($exiturl, $strexit, array('title' => $strexit)); $PAGE->set_button($exitlink);