diff --git a/mod/scorm/locallib.php b/mod/scorm/locallib.php index 4b4b01f7be0..b398b315b0a 100644 --- a/mod/scorm/locallib.php +++ b/mod/scorm/locallib.php @@ -22,6 +22,10 @@ define('SCORM_UPDATE_NEVER', '0'); define('SCORM_UPDATE_EVERYDAY', '2'); define('SCORM_UPDATE_EVERYTIME', '3'); +define('SCORM_SKIPVIEW_NEVER', '0'); +define('SCORM_SKIPVIEW_FIRST', '1'); +define('SCORM_SKIPVIEW_ALWAYS', '2'); + define('SCO_ALL', 0); define('SCO_DATA', 1); define('SCO_ONLY', 2); @@ -109,9 +113,9 @@ function scorm_get_what_grade_array() { * @return array an array of skip view options */ function scorm_get_skip_view_array() { - return array(0 => get_string('never'), - 1 => get_string('firstaccess', 'scorm'), - 2 => get_string('always')); + return array(SCORM_SKIPVIEW_NEVER => get_string('never'), + SCORM_SKIPVIEW_FIRST => get_string('firstaccess', 'scorm'), + SCORM_SKIPVIEW_ALWAYS => get_string('always')); } /** diff --git a/mod/scorm/mod_form.php b/mod/scorm/mod_form.php index 247b3212110..1bf9e3a2901 100644 --- a/mod/scorm/mod_form.php +++ b/mod/scorm/mod_form.php @@ -124,7 +124,14 @@ class mod_scorm_mod_form extends moodleform_mod { $mform->setAdvanced('winoptgrp', $cfg_scorm->winoptgrp_adv); // Skip view page - $mform->addElement('select', 'skipview', get_string('skipview', 'scorm'), scorm_get_skip_view_array()); + $skipviewoptions = scorm_get_skip_view_array(); + if ($COURSE->format == 'scorm') { // Remove option that would cause a constant redirect. + unset($skipviewoptions[SCORM_SKIPVIEW_ALWAYS]); + if ($cfg_scorm->skipview == SCORM_SKIPVIEW_ALWAYS) { + $cfg_scorm->skipview = SCORM_SKIPVIEW_FIRST; + } + } + $mform->addElement('select', 'skipview', get_string('skipview', 'scorm'), $skipviewoptions); $mform->addHelpButton('skipview', 'skipview', 'scorm'); $mform->setDefault('skipview', $cfg_scorm->skipview); $mform->setAdvanced('skipview', $cfg_scorm->skipview_adv);