MDL-78082 core_grades: Hide lock/unlock options for grade categories
Problem: The grade_categories table lacks a 'locked' field, making it technically impossible to lock grade categories. In Moodle 4.1, the "category total" column could be locked (from the edit category form), but locking grade categories directly was not supported. Solution: In response to the issue, the lock/unlock feature for grade categories has been removed. Since the grade_categories table does not have the necessary 'locked' field, attempting to implement category locking would be infeasible. As a result, the feature has been removed from the interface to avoid confusion. Explanation: By removing the lock/unlock feature for grade categories, we ensure that users no longer encounter non-functional options and prevent any potential misunderstandings about the locking behaviour. Additionally, this change aligns the user interface with the underlying database schema and eliminates any misleading functionality.
This commit is contained in:
+5
-2
@@ -2379,7 +2379,10 @@ class grade_structure {
|
||||
['id' => $this->courseid, 'sesskey' => sesskey(), 'eid' => $element['eid']]);
|
||||
$url = $gpr->add_url_params($url);
|
||||
|
||||
if (($element['type'] == 'grade') && ($element['object']->grade_item->is_locked())) {
|
||||
if ($element['type'] == 'category') {
|
||||
// Grade categories themselves cannot be locked.
|
||||
return null;
|
||||
} else if (($element['type'] == 'grade') && ($element['object']->grade_item->is_locked())) {
|
||||
// Don't allow an unlocking action for a grade whose grade item is locked: just print a state icon.
|
||||
$strparamobj = new stdClass();
|
||||
$strparamobj->itemname = $element['object']->grade_item->get_name(true, true);
|
||||
@@ -2520,6 +2523,7 @@ class grade_structure {
|
||||
|
||||
if (isset($element['type']) && ($element['type'] == 'category')) {
|
||||
$context['classes'] = 'category_grade_icons';
|
||||
$context['locked'] = false;
|
||||
}
|
||||
|
||||
return $OUTPUT->render_from_template('core_grades/status_icons', $context);
|
||||
@@ -2651,7 +2655,6 @@ class grade_structure {
|
||||
}
|
||||
$context->editurl = $this->get_edit_link($element, $gpr);
|
||||
$context->hideurl = $this->get_hiding_link($element, $gpr);
|
||||
$context->lockurl = $this->get_locking_link($element, $gpr);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user