Merge branch 'MDL-54911_m32v3' of https://github.com/sbourget/moodle

This commit is contained in:
Andrew Nicols
2016-06-29 15:05:19 +08:00
2 changed files with 14 additions and 0 deletions
+1
View File
@@ -41,6 +41,7 @@ $string['cannotaccess'] = 'You can only access this feedback from a course';
$string['cannotsavetempl'] = 'saving templates is not allowed';
$string['captcha'] = 'Captcha';
$string['captchanotset'] = 'Captcha hasn\'t been set.';
$string['closebeforeopen'] = 'You have specified an end date before the start date.';
$string['completed_feedbacks'] = 'Submitted answers';
$string['complete_the_form'] = 'Answer the questions...';
$string['completionsubmit'] = 'View as completed if the feedback is submitted';
+13
View File
@@ -179,8 +179,21 @@ class mod_feedback_mod_form extends moodleform_mod {
return $data;
}
/**
* Enforce validation rules here
*
* @param array $data array of ("fieldname"=>value) of submitted data
* @param array $files array of uploaded files "element_name"=>tmp_file_path
* @return array
**/
public function validation($data, $files) {
$errors = parent::validation($data, $files);
// Check open and close times are consistent.
if ($data['timeopen'] && $data['timeclose'] &&
$data['timeclose'] < $data['timeopen']) {
$errors['timeclose'] = get_string('closebeforeopen', 'feedback');
}
return $errors;
}