MDL-61709 mod_scorm: use student fullname when not in standards mode

Changed the scorm12standard setting for SCORM 1.2 in a more generic
'use SCORM Standards' setting. New setting is off by default.

The student name passed into the module is formatted as
$USER->lastname .', '. $USER->firstname and thus ignores the
fullnamedisplay. This is per SCORM1.2 standards. If setting
'use SCORM Standards' is disabled fullname will be used instead.
This commit is contained in:
willem 2018-04-06 15:06:21 +02:00 committed by Willem Roes
parent 2bd2660751
commit 9376f7d68e
7 changed files with 23 additions and 9 deletions

View File

@ -43,7 +43,7 @@ if ($scoes = $DB->get_records('scorm_scoes', array('scorm' => $scorm->id), 'sort
}
// If SCORM 1.2 standard mode is disabled allow higher datamodel limits.
if (intval(get_config("scorm", "scorm12standard"))) {
if (intval(get_config("scorm", "scormstandard"))) {
$cmistring256 = '^[\\u0000-\\uFFFF]{0,255}$';
$cmistring4096 = '^[\\u0000-\\uFFFF]{0,4096}$';
} else {

View File

@ -29,7 +29,11 @@ function get_scorm_default (&$userdata, $scorm, $scoid, $attempt, $mode) {
global $USER;
$userdata->student_id = $USER->username;
$userdata->student_name = $USER->lastname .', '. $USER->firstname;
if (empty(get_config('scorm', 'scormstandard'))) {
$userdata->student_name = fullname($USER);
} else {
$userdata->student_name = $USER->lastname .', '. $USER->firstname;
}
if ($usertrack = scorm_get_tracks($scoid, $USER->id, $attempt)) {
foreach ($usertrack as $key => $value) {

View File

@ -1193,7 +1193,11 @@ function get_scorm_default (&$userdata, $scorm, $scoid, $attempt, $mode) {
global $DB, $USER;
$userdata->student_id = $USER->username;
$userdata->student_name = $USER->lastname .', '. $USER->firstname;
if (empty(get_config('scorm', 'scormstandard'))) {
$userdata->student_name = fullname($USER);
} else {
$userdata->student_name = $USER->lastname .', '. $USER->firstname;
}
if ($usertrack = scorm_get_tracks($scoid, $USER->id, $attempt)) {
// According to SCORM 2004(RTE V1, 4.2.8), only cmi.exit==suspend should allow previous datamodel elements on re-launch.

View File

@ -55,5 +55,12 @@ function xmldb_scorm_upgrade($oldversion) {
// Automatically generated Moodle v3.4.0 release upgrade line.
// Put any upgrade step following this.
if ($oldversion < 2018032300) {
set_config('scormstandard', get_config('scorm', 'scorm12standard'), 'scorm');
unset_config('scorm12standard', 'scorm');
upgrade_mod_savepoint(true, 2018032300, 'scorm');
}
return true;
}

View File

@ -343,9 +343,8 @@ $string['results'] = 'Results';
$string['review'] = 'Review';
$string['reviewmode'] = 'Review mode';
$string['rightanswer'] = 'Right answer';
$string['scorm12standard'] = 'Enable SCORM 1.2 standard mode';
$string['scorm12standarddesc'] = 'Disabling this setting allows Moodle to store more data than the SCORM 1.2 specification allows.
If your SCORM packages allow users to enter large amounts of text or if your package tries to store large amounts of data in the suspend_data field disable this.';
$string['scormstandard'] = 'SCORM standards mode';
$string['scormstandarddesc'] = 'When disabled, Moodle allows SCORM 1.2 packages to store more than the specification allows, and uses Moodle full name format settings when passing the users name to the SCORM package.';
$string['scoes'] = 'Learning objects';
$string['score'] = 'Score';
$string['scorm:addinstance'] = 'Add a new SCORM package';

View File

@ -129,8 +129,8 @@ if ($ADMIN->fulltree) {
// Admin level settings.
$settings->add(new admin_setting_heading('scorm/adminsettings', get_string('adminsettings', 'scorm'), ''));
$settings->add(new admin_setting_configcheckbox('scorm/scorm12standard', get_string('scorm12standard', 'scorm'),
get_string('scorm12standarddesc', 'scorm'), 1));
$settings->add(new admin_setting_configcheckbox('scorm/scormstandard', get_string('scormstandard', 'scorm'),
get_string('scormstandarddesc', 'scorm'), 0));
$settings->add(new admin_setting_configcheckbox('scorm/allowtypeexternal', get_string('allowtypeexternal', 'scorm'), '', 0));

View File

@ -24,6 +24,6 @@
defined('MOODLE_INTERNAL') || die();
$plugin->version = 2017111300; // The current module version (Date: YYYYMMDDXX).
$plugin->version = 2018032300; // The current module version (Date: YYYYMMDDXX).
$plugin->requires = 2017110800; // Requires this Moodle version.
$plugin->component = 'mod_scorm'; // Full name of the plugin (used for diagnostics).