mirror of
https://github.com/moodle/moodle.git
synced 2025-04-21 08:22:07 +02:00
MDL-50620 mod_scorm: Add Mastery score override setting
Thanks to Nathan Lewis for the initial patch
This commit is contained in:
parent
9d5d9c64ff
commit
3e28364257
@ -60,6 +60,7 @@ class moodle1_mod_scorm_handler extends moodle1_mod_handler {
|
||||
'forcecompleted' => 0,
|
||||
'forcenewattempt' => 0,
|
||||
'lastattemptlock' => 0,
|
||||
'masteryoverride' => 1,
|
||||
'displayattemptstatus' => 1,
|
||||
'displaycoursestructure' => 0,
|
||||
'timeopen' => '0',
|
||||
|
@ -40,7 +40,7 @@ class backup_scorm_activity_structure_step extends backup_activity_structure_ste
|
||||
'name', 'scormtype', 'reference', 'intro',
|
||||
'introformat', 'version', 'maxgrade', 'grademethod',
|
||||
'whatgrade', 'maxattempt', 'forcecompleted', 'forcenewattempt',
|
||||
'lastattemptlock', 'displayattemptstatus', 'displaycoursestructure', 'updatefreq',
|
||||
'lastattemptlock', 'masteryoverride', 'displayattemptstatus', 'displaycoursestructure', 'updatefreq',
|
||||
'sha1hash', 'md5hash', 'revision', 'launch',
|
||||
'skipview', 'hidebrowse', 'hidetoc', 'nav', 'navpositionleft', 'navpositiontop',
|
||||
'auto', 'popup', 'options', 'width',
|
||||
|
@ -16,7 +16,7 @@
|
||||
//
|
||||
// SCORM 1.2 API Implementation
|
||||
//
|
||||
function SCORMapi1_2(def, cmiobj, cmiint, cmistring256, cmistring4096, scormdebugging, scormauto, scormid, cfgwwwroot, sesskey, scoid, attempt, viewmode, cmid, currentorg, autocommit) {
|
||||
function SCORMapi1_2(def, cmiobj, cmiint, cmistring256, cmistring4096, scormdebugging, scormauto, scormid, cfgwwwroot, sesskey, scoid, attempt, viewmode, cmid, currentorg, autocommit, masteryoverride) {
|
||||
|
||||
var prerequrl = cfgwwwroot + "/mod/scorm/prereqs.php?a=" + scormid + "&scoid=" + scoid + "&attempt=" + attempt + "&mode=" + viewmode + "¤torg=" + currentorg + "&sesskey=" + sesskey;
|
||||
var datamodelurl = cfgwwwroot + "/mod/scorm/datamodel.php";
|
||||
@ -620,7 +620,7 @@ function SCORMapi1_2(def, cmiobj, cmiint, cmistring256, cmistring4096, scormdebu
|
||||
}
|
||||
if (cmi.core.lesson_mode == 'normal') {
|
||||
if (cmi.core.credit == 'credit') {
|
||||
if (cmi.student_data.mastery_score !== '' && cmi.core.score.raw !== '') {
|
||||
if (masteryoverride && cmi.student_data.mastery_score !== '' && cmi.core.score.raw !== '') {
|
||||
if (parseFloat(cmi.core.score.raw) >= parseFloat(cmi.student_data.mastery_score)) {
|
||||
cmi.core.lesson_status = 'passed';
|
||||
} else {
|
||||
@ -660,6 +660,6 @@ function SCORMapi1_2(def, cmiobj, cmiint, cmistring256, cmistring4096, scormdebu
|
||||
|
||||
M.scorm_api = {};
|
||||
|
||||
M.scorm_api.init = function(Y, def, cmiobj, cmiint, cmistring256, cmistring4096, scormdebugging, scormauto, scormid, cfgwwwroot, sesskey, scoid, attempt, viewmode, cmid, currentorg, autocommit) {
|
||||
window.API = new SCORMapi1_2(def, cmiobj, cmiint, cmistring256, cmistring4096, scormdebugging, scormauto, scormid, cfgwwwroot, sesskey, scoid, attempt, viewmode, cmid, currentorg, autocommit);
|
||||
M.scorm_api.init = function(Y, def, cmiobj, cmiint, cmistring256, cmistring4096, scormdebugging, scormauto, scormid, cfgwwwroot, sesskey, scoid, attempt, viewmode, cmid, currentorg, autocommit, masteryoverride) {
|
||||
window.API = new SCORMapi1_2(def, cmiobj, cmiint, cmistring256, cmistring4096, scormdebugging, scormauto, scormid, cfgwwwroot, sesskey, scoid, attempt, viewmode, cmid, currentorg, autocommit, masteryoverride);
|
||||
}
|
||||
|
@ -52,9 +52,10 @@ if (intval(get_config("scorm", "scorm12standard"))) {
|
||||
}
|
||||
|
||||
$scorm->autocommit = ($scorm->autocommit === "1") ? true : false;
|
||||
$scorm->masteryoverride = ($scorm->masteryoverride === "1") ? true : false;
|
||||
$PAGE->requires->js_init_call('M.scorm_api.init', array($def, $cmiobj, $cmiint, $cmistring256, $cmistring4096,
|
||||
scorm_debugging($scorm), $scorm->auto, $scorm->id, $CFG->wwwroot,
|
||||
sesskey(), $scoid, $attempt, $mode, $id, $currentorg, $scorm->autocommit));
|
||||
sesskey(), $scoid, $attempt, $mode, $id, $currentorg, $scorm->autocommit, $scorm->masteryoverride));
|
||||
|
||||
// Pull in the debugging utilities.
|
||||
if (scorm_debugging($scorm)) {
|
||||
|
@ -21,6 +21,7 @@
|
||||
<FIELD NAME="forcecompleted" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
|
||||
<FIELD NAME="forcenewattempt" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
|
||||
<FIELD NAME="lastattemptlock" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
|
||||
<FIELD NAME="masteryoverride" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="1" SEQUENCE="false"/>
|
||||
<FIELD NAME="displayattemptstatus" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="1" SEQUENCE="false"/>
|
||||
<FIELD NAME="displaycoursestructure" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
|
||||
<FIELD NAME="updatefreq" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="Define when the package must be automatically update"/>
|
||||
|
@ -338,6 +338,18 @@ function xmldb_scorm_upgrade($oldversion) {
|
||||
// Moodle v3.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// MDL-50620 Add mastery override option.
|
||||
if ($oldversion < 2016021000) {
|
||||
$table = new xmldb_table('scorm');
|
||||
|
||||
$field = new xmldb_field('masteryoverride', XMLDB_TYPE_INTEGER, '1', null, XMLDB_NOTNULL, null, '1', 'lastattemptlock');
|
||||
if (!$dbman->field_exists($table, $field)) {
|
||||
$dbman->add_field($table, $field);
|
||||
}
|
||||
|
||||
upgrade_mod_savepoint(true, 2016021000, 'scorm');
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -188,6 +188,9 @@ $string['identifier'] = 'Question identifier';
|
||||
$string['incomplete'] = 'Incomplete';
|
||||
$string['info'] = 'Info';
|
||||
$string['interactions'] = 'Interactions';
|
||||
$string['masteryoverride'] = 'Mastery score overrides status';
|
||||
$string['masteryoverride_help'] = 'If enabled and a mastery score is provided, when LMSFinish is called and a raw score has been set, status will be recalculated using the raw score and mastery score and any status provided by the SCORM (including "incomplete") will be overridden.';
|
||||
$string['masteryoverridedesc'] = 'This preference sets the default for the mastery score override setting';
|
||||
$string['repositorynotsupported'] = 'This repository does not support linking directly to an imsmanifest.xml file.';
|
||||
$string['trackid'] = 'Id';
|
||||
$string['trackid_help'] = 'This is the identifier set by your SCORM package for this question, the SCORM specification doesn\'t allow the full question text to be provided.';
|
||||
|
@ -261,6 +261,11 @@ class mod_scorm_mod_form extends moodleform_mod {
|
||||
$mform->addHelpButton('autocommit', 'autocommit', 'scorm');
|
||||
$mform->setDefault('autocommit', $cfgscorm->autocommit);
|
||||
|
||||
// Mastery score overrides status.
|
||||
$mform->addElement('selectyesno', 'masteryoverride', get_string('masteryoverride', 'scorm'));
|
||||
$mform->addHelpButton('masteryoverride', 'masteryoverride', 'scorm');
|
||||
$mform->setDefault('masteryoverride', $cfgscorm->masteryoverride);
|
||||
|
||||
// Hidden Settings.
|
||||
$mform->addElement('hidden', 'datadir', null);
|
||||
$mform->setType('datadir', PARAM_RAW);
|
||||
|
@ -114,6 +114,9 @@ if ($ADMIN->fulltree) {
|
||||
$settings->add(new admin_setting_configselect('scorm/autocommit',
|
||||
get_string('autocommit', 'scorm'), get_string('autocommitdesc', 'scorm'), 0, $yesno));
|
||||
|
||||
$settings->add(new admin_setting_configselect('scorm/masteryoverride',
|
||||
get_string('masteryoverride', 'scorm'), get_string('masteryoverridedesc', 'scorm'), 1, $yesno));
|
||||
|
||||
$settings->add(new admin_setting_configselect('scorm/lastattemptlock',
|
||||
get_string('lastattemptlock', 'scorm'), get_string('lastattemptlockdesc', 'scorm'), 0, $yesno));
|
||||
|
||||
|
@ -68,6 +68,7 @@ class mod_scorm_generator extends testing_module_generator {
|
||||
'forcenewattempt' => $cfgscorm->forcenewattempt,
|
||||
'lastattemptlock' => $cfgscorm->lastattemptlock,
|
||||
'forcecompleted' => $cfgscorm->forcecompleted,
|
||||
'masteryoverride' => $cfgscorm->masteryoverride,
|
||||
'auto' => $cfgscorm->auto,
|
||||
'displayactivityname' => $cfgscorm->displayactivityname
|
||||
);
|
||||
|
@ -24,7 +24,7 @@
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
$plugin->version = 2016011400; // The current module version (Date: YYYYMMDDXX).
|
||||
$plugin->version = 2016021000; // The current module version (Date: YYYYMMDDXX).
|
||||
$plugin->requires = 2015111000; // Requires this Moodle version.
|
||||
$plugin->component = 'mod_scorm'; // Full name of the plugin (used for diagnostics).
|
||||
$plugin->cron = 300;
|
||||
|
Loading…
x
Reference in New Issue
Block a user