public function CourseObjectAccessGrade::optionsValidate in Course 7
Same name and namespace in other branches
- 7.2 plugins/course_object_access/grade.inc \CourseObjectAccessGrade::optionsValidate()
Overrides CourseObjectAccess::optionsValidate
File
- plugins/
course_object_access/ grade.inc, line 25
Class
Code
public function optionsValidate($form, &$form_state) {
if (!empty($form_state['course_grade_range']['low']) || !empty($form_state['course_grade_range']['high'])) {
// If user filled out at least one.
if (is_numeric($form_state['course_grade_range']['low']) && is_numeric($form_state['course_grade_range']['high'])) {
// User filled out both.
if ($form_state['course_grade_range']['low'] > $form_state['course_grade_range']['high']) {
form_error($form['course_grade_range'], t('High range cannot be lower than the low range.'));
}
}
else {
// User did not fill out both.
form_error($form['course_grade_range'], t('You must enter a numeric value for both the low and high grade range.'));
}
}
}