MDL-46824 core_grades: Prevent user from using drop lowest/keep highest

Part of: MDL-46576
This commit is contained in:
Frederic Massart
2014-10-03 13:54:06 +08:00
committed by Adrian Greeve
parent 4272386a7d
commit 40544c9b58
+12
View File
@@ -331,6 +331,18 @@ class edit_category_form extends moodleform {
}
// Prevent the user from using drop lowest/keep highest when the aggregation method cannot handle it.
if (!$grade_category->can_apply_limit_rules()) {
if ($mform->elementExists('keephigh')) {
$mform->setConstant('keephigh', 0);
$mform->hardFreeze('keephigh');
}
if ($mform->elementExists('droplow')) {
$mform->setConstant('droplow', 0);
$mform->hardFreeze('droplow');
}
}
if ($grade_item->is_calculated()) {
// following elements are ignored when calculation formula used
if ($mform->elementExists('aggregation')) {