MDL-82681 mod_assign: Clean up old filters

Removes the old Marker and Suspended participants filters from the
assignment submissions page, along with all associated logic.
Also, cleans up residual code from the old marking workflow filter
that was not properly removed in MDL-82508.
This commit is contained in:
Mihail Geshoski 2024-08-13 10:49:20 +08:00
parent a97231fc06
commit ca293159e7
3 changed files with 0 additions and 82 deletions

View File

@ -51,17 +51,6 @@ class grading_options_temp_form extends \moodleform {
$mform->disable_form_change_checker();
$mform->addElement('header', 'general', get_string('gradingoptions', 'assign'));
if (!empty($instance['markingallocationopt'])) {
$markingfilter = get_string('markerfilter', 'assign');
$mform->addElement('select', 'markerfilter', $markingfilter, $instance['markingallocationopt']);
}
// Show active/suspended user option.
if ($instance['showonlyactiveenrolopt']) {
$mform->addElement('checkbox', 'showonlyactiveenrol', get_string('showonlyactiveenrol', 'grades'));
$mform->addHelpButton('showonlyactiveenrol', 'showonlyactiveenrol', 'grades');
$mform->setDefault('showonlyactiveenrol', $instance['showonlyactiveenrol']);
}
// Hidden params.
$mform->addElement('hidden', 'contextid', $instance['contextid']);

View File

@ -4515,7 +4515,6 @@ class assign {
$perpage = $this->get_assign_perpage();
$filter = get_user_preferences('assign_filter', '');
$markerfilter = get_user_preferences('assign_markerfilter', '');
// Retrieve the 'workflowfilter' parameter, or set it to null if not provided.
$workflowfilter = optional_param('workflowfilter', null, PARAM_ALPHA);
@ -4545,38 +4544,18 @@ class assign {
$controller = $gradingmanager->get_active_controller();
$showquickgrading = empty($controller) && $this->can_grade();
$quickgrading = get_user_preferences('assign_quickgrading', false);
$showonlyactiveenrolopt = has_capability('moodle/course:viewsuspendedusers', $this->context);
$markingallocation = $this->get_instance()->markingworkflow &&
$this->get_instance()->markingallocation &&
has_capability('mod/assign:manageallocations', $this->context);
// Get markers to use in drop lists.
$markingallocationoptions = array();
if ($markingallocation) {
list($sort, $params) = users_order_by_sql('u');
// Only enrolled users could be assigned as potential markers.
$markers = get_enrolled_users($this->context, 'mod/assign:grade', 0, 'u.*', $sort);
$markingallocationoptions[''] = get_string('filternone', 'assign');
$markingallocationoptions[ASSIGN_MARKER_FILTER_NO_MARKER] = get_string('markerfilternomarker', 'assign');
$viewfullnames = has_capability('moodle/site:viewfullnames', $this->context);
foreach ($markers as $marker) {
$markingallocationoptions[$marker->id] = fullname($marker, $viewfullnames);
}
}
$markingworkflow = $this->get_instance()->markingworkflow;
// Get marking states to show in form.
$markingworkflowoptions = $this->get_marking_workflow_filters();
// Print options for changing the filter and changing the number of results per page.
$gradingoptionsformparams = [
'cm' => $cmid,
'contextid' => $this->context->id,
'userid' => $USER->id,
'markingworkflowopt' => $markingworkflowoptions,
'markingallocationopt' => $markingallocationoptions,
'showonlyactiveenrolopt' => $showonlyactiveenrolopt,
'showonlyactiveenrol' => $this->show_only_active_users(),
];
$classoptions = array('class'=>'gradingoptionsform');
@ -4587,7 +4566,6 @@ class assign {
$classoptions);
$gradingoptionsdata = new stdClass();
$gradingoptionsdata->markerfilter = $markerfilter;
$gradingoptionsform->set_data($gradingoptionsdata);
$buttons = new \mod_assign\output\grading_actionmenu(cmid: $this->get_course_module()->id, assign: $this);
@ -7404,50 +7382,13 @@ class assign {
$this->require_view_grades();
require_sesskey();
if (!is_null($this->context)) {
$showonlyactiveenrolopt = has_capability('moodle/course:viewsuspendedusers', $this->context);
} else {
$showonlyactiveenrolopt = false;
}
$markingallocation = $this->get_instance()->markingworkflow &&
$this->get_instance()->markingallocation &&
has_capability('mod/assign:manageallocations', $this->context);
// Get markers to use in drop lists.
$markingallocationoptions = array();
if ($markingallocation) {
$markingallocationoptions[''] = get_string('filternone', 'assign');
$markingallocationoptions[ASSIGN_MARKER_FILTER_NO_MARKER] = get_string('markerfilternomarker', 'assign');
list($sort, $params) = users_order_by_sql('u');
// Only enrolled users could be assigned as potential markers.
$markers = get_enrolled_users($this->context, 'mod/assign:grade', 0, 'u.*', $sort);
foreach ($markers as $marker) {
$markingallocationoptions[$marker->id] = fullname($marker);
}
}
// Get marking states to show in form.
$markingworkflowoptions = $this->get_marking_workflow_filters();
$gradingoptionsparams = [
'cm' => $this->get_course_module()->id,
'contextid' => $this->context->id,
'userid' => $USER->id,
'markingworkflowopt' => $markingworkflowoptions,
'markingallocationopt' => $markingallocationoptions,
'showonlyactiveenrolopt' => $showonlyactiveenrolopt,
'showonlyactiveenrol' => $this->show_only_active_users(),
];
$mform = new mod_assign\form\grading_options_temp_form(null, $gradingoptionsparams);
if ($formdata = $mform->get_data()) {
if (isset($formdata->markerfilter)) {
set_user_preference('assign_markerfilter', $formdata->markerfilter);
}
if (!empty($showonlyactiveenrolopt)) {
$showonlyactiveenrol = isset($formdata->showonlyactiveenrol);
set_user_preference('grade_report_showonlyactiveenrol', $showonlyactiveenrol);
$this->showonlyactiveenrol = $showonlyactiveenrol;
}
}
}

View File

@ -80,18 +80,6 @@ M.mod_assign.init_grading_table = function(Y) {
M.mod_assign.init_grading_options = function(Y) {
Y.use('node', function(Y) {
var markerfilterelement = Y.one('#id_markerfilter');
if (markerfilterelement) {
markerfilterelement.on('change', function(e) {
Y.one('form.gradingoptionsform').submit();
});
}
var showonlyactiveenrolelement = Y.one('#id_showonlyactiveenrol');
if (showonlyactiveenrolelement) {
showonlyactiveenrolelement.on('change', function(e) {
Y.one('form.gradingoptionsform').submit();
});
}
var downloadasfolderselement = Y.one('#id_downloadasfolders');
if (downloadasfolderselement) {
downloadasfolderselement.on('change', function(e) {