MDL-64891 gradebook: Disable grade display type dependent on grade type
If the grade types text or none are selected for an item or a category, none of the 'grade display type' options will change the displayed grade within the reports. Thus, we can disable the settings for grade display type as well as the one for decimal places in this case.
This commit is contained in:
@@ -211,6 +211,8 @@ class edit_category_form extends moodleform {
|
||||
}
|
||||
$mform->addElement('select', 'grade_item_display', get_string('gradedisplaytype', 'grades'), $options);
|
||||
$mform->addHelpButton('grade_item_display', 'gradedisplaytype', 'grades');
|
||||
$mform->disabledIf('grade_item_display', 'grade_item_gradetype', 'in',
|
||||
array(GRADE_TYPE_TEXT, GRADE_TYPE_NONE));
|
||||
|
||||
$default_gradedecimals = grade_get_setting($COURSE->id, 'decimalpoints', $CFG->grade_decimalpoints);
|
||||
$options = array(-1=>get_string('defaultprev', 'grades', $default_gradedecimals), 0=>0, 1=>1, 2=>2, 3=>3, 4=>4, 5=>5);
|
||||
@@ -218,6 +220,8 @@ class edit_category_form extends moodleform {
|
||||
$mform->addHelpButton('grade_item_decimals', 'decimalpoints', 'grades');
|
||||
$mform->setDefault('grade_item_decimals', -1);
|
||||
$mform->disabledIf('grade_item_decimals', 'grade_item_display', 'eq', GRADE_DISPLAY_TYPE_LETTER);
|
||||
$mform->disabledIf('grade_item_decimals', 'grade_item_gradetype', 'in',
|
||||
array(GRADE_TYPE_TEXT, GRADE_TYPE_NONE));
|
||||
|
||||
if ($default_gradedisplaytype == GRADE_DISPLAY_TYPE_LETTER) {
|
||||
$mform->disabledIf('grade_item_decimals', 'grade_item_display', "eq", GRADE_DISPLAY_TYPE_DEFAULT);
|
||||
|
||||
@@ -166,6 +166,7 @@ class edit_item_form extends moodleform {
|
||||
}
|
||||
$mform->addElement('select', 'display', get_string('gradedisplaytype', 'grades'), $options);
|
||||
$mform->addHelpButton('display', 'gradedisplaytype', 'grades');
|
||||
$mform->disabledIf('display', 'gradetype', 'eq', GRADE_TYPE_TEXT);
|
||||
|
||||
$default_gradedecimals = grade_get_setting($COURSE->id, 'decimalpoints', $CFG->grade_decimalpoints);
|
||||
$options = array(-1=>get_string('defaultprev', 'grades', $default_gradedecimals), 0=>0, 1=>1, 2=>2, 3=>3, 4=>4, 5=>5);
|
||||
@@ -176,6 +177,7 @@ class edit_item_form extends moodleform {
|
||||
if ($default_gradedisplaytype == GRADE_DISPLAY_TYPE_LETTER) {
|
||||
$mform->disabledIf('decimals', 'display', "eq", GRADE_DISPLAY_TYPE_DEFAULT);
|
||||
}
|
||||
$mform->disabledIf('decimals', 'gradetype', 'eq', GRADE_TYPE_TEXT);
|
||||
|
||||
/// hiding
|
||||
if ($item->cancontrolvisibility) {
|
||||
|
||||
Reference in New Issue
Block a user