diff --git a/mod/scorm/lang/en/scorm.php b/mod/scorm/lang/en/scorm.php index bfecc0730c5..8b2d014d9b4 100644 --- a/mod/scorm/lang/en/scorm.php +++ b/mod/scorm/lang/en/scorm.php @@ -74,6 +74,7 @@ $string['browserepository'] = 'Browse repository'; $string['calculatedweight'] = 'Calculated weight'; $string['cannotaccess'] = 'You cannot call this script in that way'; $string['cannotfindsco'] = 'Could not find SCO'; +$string['closebeforeopen'] = 'You have specified a close date before the open date.'; $string['collapsetocwinsize'] = 'Collapse TOC when window size below'; $string['collapsetocwinsizedesc'] = 'This setting lets you specify the window size below which the TOC should automatically collapse.'; $string['compatibilitysettings'] = 'Compatibility settings'; diff --git a/mod/scorm/mod_form.php b/mod/scorm/mod_form.php index 5039646145b..4b00473fc3a 100644 --- a/mod/scorm/mod_form.php +++ b/mod/scorm/mod_form.php @@ -442,6 +442,13 @@ class mod_scorm_mod_form extends moodleform_mod { } + // Validate availability dates. + if ($data['timeopen'] && $data['timeclose']) { + if ($data['timeopen'] > $data['timeclose']) { + $errors['timeclose'] = get_string('closebeforeopen', 'scorm'); + } + } + return $errors; }