MDL-33938 SCORM use consistant naming for maxattempt setting - match setting name with db field name to help when matching default settings

This commit is contained in:
Dan Marsden 2012-06-21 19:24:58 +12:00
parent f4a9bf65da
commit e0d90c54c0
4 changed files with 17 additions and 4 deletions

View File

@ -60,6 +60,19 @@ function xmldb_scorm_upgrade($oldversion) {
upgrade_mod_savepoint(true, 2012032101, 'scorm');
}
//rename config var from maxattempts to maxattempt
if ($oldversion < 2012061701) {
$maxattempts = get_config('scorm', 'maxattempts');
$maxattempts_adv = get_config('scorm', 'maxattempts_adv');
set_config('maxattempt', $maxattempts, 'scorm');
set_config('maxattempt_adv', $maxattempts_adv, 'scorm');
unset_config('maxattempts', 'scorm'); //remove old setting.
unset_config('maxattempts_adv', 'scorm'); //remove old setting.
upgrade_mod_savepoint(true, 2012061701, 'scorm');
}
return true;
}

View File

@ -177,8 +177,8 @@ class mod_scorm_mod_form extends moodleform_mod {
// Max Attempts
$mform->addElement('select', 'maxattempt', get_string('maximumattempts', 'scorm'), scorm_get_attempts_array());
$mform->addHelpButton('maxattempt', 'maximumattempts', 'scorm');
$mform->setDefault('maxattempt', $cfg_scorm->maxattempts);
$mform->setAdvanced('maxattempt', $cfg_scorm->maxattempts_adv);
$mform->setDefault('maxattempt', $cfg_scorm->maxattempt);
$mform->setAdvanced('maxattempt', $cfg_scorm->maxattempt_adv);
// What Grade
$mform->addElement('select', 'whatgrade', get_string('whatgrade', 'scorm'), scorm_get_what_grade_array());

View File

@ -82,7 +82,7 @@ if ($ADMIN->fulltree) {
$settings->add(new admin_setting_heading('scorm/othersettings', get_string('defaultothersettings', 'scorm'), ''));
//default attempts settings.
$settings->add(new admin_setting_configselect_with_advanced('scorm/maxattempts',
$settings->add(new admin_setting_configselect_with_advanced('scorm/maxattempt',
get_string('maximumattempts', 'scorm'), '',
array('value' => '0', 'adv' => false), scorm_get_attempts_array()));

View File

@ -25,7 +25,7 @@
defined('MOODLE_INTERNAL') || die();
$module->version = 2012061700; // The current module version (Date: YYYYMMDDXX)
$module->version = 2012061701; // The current module version (Date: YYYYMMDDXX)
$module->requires = 2012061700; // Requires this Moodle version
$module->component = 'mod_scorm'; // Full name of the plugin (used for diagnostics)
$module->cron = 300;