Browse Source

Add validation rule so session end date must be after session start date

MOODLE_26_STABLE
Tim Lock 11 years ago
parent
commit
fb8f7ced16
  1. 4
      add_form.php
  2. 1
      lang/en/attendance.php

4
add_form.php

@ -158,6 +158,10 @@ class mod_attendance_add_form extends moodleform {
public function validation($data, $files) {
$errors = parent::validation($data, $files);
if ($data['sessiondate'] != 0 && $data['sessionenddate'] != 0 && $data['sessionenddate'] < $data['sessiondate']) {
$errors['sessionenddate'] = get_string('invalidsessionenddate', 'attendance');
}
if ($data['sessiontype'] == attendance::SESSION_GROUP and empty($data['groups'])) {
$errors['groups'] = get_string('errorgroupsnotselected', 'attendance');
}

1
lang/en/attendance.php

@ -121,6 +121,7 @@ $string['identifyby'] = 'Identify student by';
$string['includeall'] = 'Select all sessions';
$string['includenottaken'] = 'Include not taken sessions';
$string['indetail'] = 'In detail...';
$string['invalidsessionenddate'] = 'The session end date can not be earlier than the session start date';
$string['jumpto'] = 'Jump to';
$string['modulename'] = 'Attendance';
$string['modulename_help'] = 'The attendance activity module enables a teacher to take attendance during class and students to view their own attendance record.

Loading…
Cancel
Save