Merge branch 'MDL-82683-main' of https://github.com/rezaies/moodle
This commit is contained in:
@@ -67,12 +67,6 @@ class grading_options_temp_form extends \moodleform {
|
||||
$markingfilter = get_string('markerfilter', 'assign');
|
||||
$mform->addElement('select', 'markerfilter', $markingfilter, $instance['markingallocationopt']);
|
||||
}
|
||||
// Quickgrading.
|
||||
if ($instance['showquickgrading']) {
|
||||
$mform->addElement('checkbox', 'quickgrading', get_string('quickgrading', 'assign'));
|
||||
$mform->addHelpButton('quickgrading', 'quickgrading', 'assign');
|
||||
$mform->setDefault('quickgrading', $instance['quickgrading']);
|
||||
}
|
||||
|
||||
// Show active/suspended user option.
|
||||
if ($instance['showonlyactiveenrolopt']) {
|
||||
|
||||
@@ -123,7 +123,6 @@ class grading_actionmenu implements templatable, renderable {
|
||||
'group' => 0,
|
||||
'status' => '',
|
||||
'workflowfilter' => '',
|
||||
'sesskey' => sesskey(),
|
||||
]);
|
||||
$data['pagereset'] = $url->out(false);
|
||||
}
|
||||
@@ -143,6 +142,26 @@ class grading_actionmenu implements templatable, renderable {
|
||||
$data['graderurl'] = $url->out(false);
|
||||
}
|
||||
|
||||
$gradingmanager = get_grading_manager($this->assign->get_context(), 'mod_assign', 'submissions');
|
||||
$controller = $gradingmanager->get_active_controller();
|
||||
$showquickgrading = empty($controller) && $this->assign->can_grade();
|
||||
if ($showquickgrading) {
|
||||
$quickgradingbaseurl = new moodle_url('/mod/assign/view.php', [
|
||||
'id' => $this->assign->get_course_module()->id,
|
||||
'action' => 'grading',
|
||||
]);
|
||||
if ($userid) {
|
||||
$quickgradingbaseurl->param('userid', $userid);
|
||||
} else if ($usersearch) {
|
||||
$quickgradingbaseurl->param('search', $usersearch);
|
||||
}
|
||||
|
||||
$data['quickgrading'] = [
|
||||
'baseurl' => $quickgradingbaseurl->out(false),
|
||||
'enabled' => get_user_preferences('assign_quickgrading', false),
|
||||
];
|
||||
}
|
||||
|
||||
$actions = $this->get_actions();
|
||||
if ($actions) {
|
||||
$menu = new \action_menu();
|
||||
@@ -223,14 +242,13 @@ class grading_actionmenu implements templatable, renderable {
|
||||
$groupedfilters = $this->assign->get_filters(true);
|
||||
foreach ($groupedfilters as $group => $filters) {
|
||||
foreach ($filters as $filter) {
|
||||
if ($filter['key'] === 'none') {
|
||||
if ($filter['key'] === ASSIGN_FILTER_NONE) {
|
||||
// The 'none' filter is not a real filter.
|
||||
$filter['key'] = '';
|
||||
}
|
||||
$url = new moodle_url('/mod/assign/view.php', [
|
||||
'id' => $this->assign->get_course_module()->id,
|
||||
'action' => 'grading',
|
||||
'sesskey' => sesskey(),
|
||||
'status' => $filter['key'],
|
||||
]);
|
||||
$statusmenu[$url->out(false)] = $filter['name'];
|
||||
|
||||
+34
-32
@@ -4486,8 +4486,17 @@ class assign {
|
||||
require_once($CFG->dirroot . '/mod/assign/gradingbatchoperationsform.php');
|
||||
|
||||
$submittedfilter = optional_param('status', null, PARAM_ALPHA);
|
||||
if (isset($submittedfilter) && confirm_sesskey()) {
|
||||
set_user_preference('assign_filter', $submittedfilter);
|
||||
if (isset($submittedfilter)) {
|
||||
$validfilters = array_column($this->get_filters(), 'key');
|
||||
$validfilters = array_diff($validfilters, [ASSIGN_FILTER_NONE]); // The 'none' filter is not a real filter.
|
||||
if ($submittedfilter === '' || in_array($submittedfilter, $validfilters)) {
|
||||
set_user_preference('assign_filter', $submittedfilter);
|
||||
}
|
||||
}
|
||||
|
||||
$submittedquickgrading = optional_param('quickgrading', null, PARAM_BOOL);
|
||||
if (isset($submittedquickgrading)) {
|
||||
set_user_preference('assign_quickgrading', $submittedquickgrading);
|
||||
}
|
||||
|
||||
$o = '';
|
||||
@@ -4535,17 +4544,17 @@ class assign {
|
||||
$markingworkflowoptions = $this->get_marking_workflow_filters();
|
||||
|
||||
// Print options for changing the filter and changing the number of results per page.
|
||||
$gradingoptionsformparams = array('cm'=>$cmid,
|
||||
'contextid'=>$this->context->id,
|
||||
'userid'=>$USER->id,
|
||||
'submissionsenabled'=>$this->is_any_submission_plugin_enabled(),
|
||||
'showquickgrading'=>$showquickgrading,
|
||||
'quickgrading'=>$quickgrading,
|
||||
'markingworkflowopt'=>$markingworkflowoptions,
|
||||
'markingallocationopt'=>$markingallocationoptions,
|
||||
'showonlyactiveenrolopt'=>$showonlyactiveenrolopt,
|
||||
'showonlyactiveenrol' => $this->show_only_active_users(),
|
||||
'downloadasfolders' => $downloadasfolders);
|
||||
$gradingoptionsformparams = [
|
||||
'cm' => $cmid,
|
||||
'contextid' => $this->context->id,
|
||||
'userid' => $USER->id,
|
||||
'submissionsenabled' => $this->is_any_submission_plugin_enabled(),
|
||||
'markingworkflowopt' => $markingworkflowoptions,
|
||||
'markingallocationopt' => $markingallocationoptions,
|
||||
'showonlyactiveenrolopt' => $showonlyactiveenrolopt,
|
||||
'showonlyactiveenrol' => $this->show_only_active_users(),
|
||||
'downloadasfolders' => $downloadasfolders,
|
||||
];
|
||||
|
||||
$classoptions = array('class'=>'gradingoptionsform');
|
||||
$gradingoptionsform = new \mod_assign\form\grading_options_temp_form(null,
|
||||
@@ -7378,10 +7387,6 @@ class assign {
|
||||
$this->require_view_grades();
|
||||
require_sesskey();
|
||||
|
||||
// Is advanced grading enabled?
|
||||
$gradingmanager = get_grading_manager($this->get_context(), 'mod_assign', 'submissions');
|
||||
$controller = $gradingmanager->get_active_controller();
|
||||
$showquickgrading = empty($controller);
|
||||
if (!is_null($this->context)) {
|
||||
$showonlyactiveenrolopt = has_capability('moodle/course:viewsuspendedusers', $this->context);
|
||||
} else {
|
||||
@@ -7407,26 +7412,23 @@ class assign {
|
||||
// Get marking states to show in form.
|
||||
$markingworkflowoptions = $this->get_marking_workflow_filters();
|
||||
|
||||
$gradingoptionsparams = array('cm'=>$this->get_course_module()->id,
|
||||
'contextid'=>$this->context->id,
|
||||
'userid'=>$USER->id,
|
||||
'submissionsenabled'=>$this->is_any_submission_plugin_enabled(),
|
||||
'showquickgrading'=>$showquickgrading,
|
||||
'quickgrading'=>false,
|
||||
'markingworkflowopt' => $markingworkflowoptions,
|
||||
'markingallocationopt' => $markingallocationoptions,
|
||||
'showonlyactiveenrolopt'=>$showonlyactiveenrolopt,
|
||||
'showonlyactiveenrol' => $this->show_only_active_users(),
|
||||
'downloadasfolders' => get_user_preferences('assign_downloadasfolders', 1));
|
||||
$gradingoptionsparams = [
|
||||
'cm' => $this->get_course_module()->id,
|
||||
'contextid' => $this->context->id,
|
||||
'userid' => $USER->id,
|
||||
'submissionsenabled' => $this->is_any_submission_plugin_enabled(),
|
||||
'markingworkflowopt' => $markingworkflowoptions,
|
||||
'markingallocationopt' => $markingallocationoptions,
|
||||
'showonlyactiveenrolopt' => $showonlyactiveenrolopt,
|
||||
'showonlyactiveenrol' => $this->show_only_active_users(),
|
||||
'downloadasfolders' => get_user_preferences('assign_downloadasfolders', 1),
|
||||
];
|
||||
$mform = new mod_assign\form\grading_options_temp_form(null, $gradingoptionsparams);
|
||||
if ($formdata = $mform->get_data()) {
|
||||
set_user_preference('assign_perpage', $formdata->perpage);
|
||||
if (isset($formdata->markerfilter)) {
|
||||
set_user_preference('assign_markerfilter', $formdata->markerfilter);
|
||||
}
|
||||
if ($showquickgrading) {
|
||||
set_user_preference('assign_quickgrading', isset($formdata->quickgrading));
|
||||
}
|
||||
if (isset($formdata->downloadasfolders)) {
|
||||
set_user_preference('assign_downloadasfolders', 1); // Enabled.
|
||||
} else {
|
||||
@@ -9677,7 +9679,7 @@ class assign {
|
||||
// First is always "no filter" option.
|
||||
$filters[0] = [
|
||||
[
|
||||
'key' => 'none',
|
||||
'key' => ASSIGN_FILTER_NONE,
|
||||
'name' => get_string('filterall', 'assign'),
|
||||
'active' => ($current == ''),
|
||||
],
|
||||
|
||||
@@ -137,12 +137,6 @@ M.mod_assign.init_grading_options = function(Y) {
|
||||
Y.one('form.gradingoptionsform').submit();
|
||||
});
|
||||
}
|
||||
var quickgradingelement = Y.one('#id_quickgrading');
|
||||
if (quickgradingelement) {
|
||||
quickgradingelement.on('change', function(e) {
|
||||
Y.one('form.gradingoptionsform').submit();
|
||||
});
|
||||
}
|
||||
var showonlyactiveenrolelement = Y.one('#id_showonlyactiveenrol');
|
||||
if (showonlyactiveenrolelement) {
|
||||
showonlyactiveenrolelement.on('change', function(e) {
|
||||
|
||||
@@ -27,6 +27,9 @@
|
||||
* groupselector - (optional) HTML that outputs the group selector
|
||||
* statusselector - (optional) The data object containing the required properties to render the status selector
|
||||
* extrafiltersdropdown - HTML that outputs the extra filters dropdown
|
||||
* pagereset - (optional) URL to reset the page
|
||||
* graderurl - (optional) URL to the grader page
|
||||
* quickgrading - (optional) Includes the baseurl and enabled properties for the quick grading checkbox
|
||||
* actions - (optional) HTML that outputs the bulk action menu
|
||||
|
||||
Example context (json):
|
||||
@@ -49,6 +52,11 @@
|
||||
},
|
||||
"extrafiltersdropdown": "<div class='dropdown extrafilters'></div>",
|
||||
"pagereset": "http://moodle.local/mod/assign/view.php?id=2&action=grading&group=0",
|
||||
"graderurl": "http://moodle.local/mod/assign/view.php?id=2&action=grader",
|
||||
"quickgrading": {
|
||||
"baseurl": "http://moodle.local/mod/assign/view.php?id=2&action=grading",
|
||||
"enabled": true
|
||||
},
|
||||
"actions": "<div class='action-menu'></div>"
|
||||
}
|
||||
|
||||
@@ -95,14 +103,32 @@
|
||||
<div class="navitem-divider"></div>
|
||||
{{/pagereset}}
|
||||
{{#graderurl}}
|
||||
<div class="navitem ms-sm-auto align-self-center">
|
||||
<a class="btn btn-primary" href="{{graderurl}}">{{#str}}viewgrader, mod_assign{{/str}}</a>
|
||||
</div>
|
||||
<div class="navitem ms-sm-auto align-self-center">
|
||||
<a class="btn btn-primary" href="{{graderurl}}">{{#str}}viewgrader, mod_assign{{/str}}</a>
|
||||
</div>
|
||||
{{/graderurl}}
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
{{#actions}}
|
||||
<div class="d-flex ml-auto me-3">{{{actions}}}</div>
|
||||
{{/actions}}
|
||||
<div class="container-fluid tertiary-navigation pt-0">
|
||||
<div class="row pb-2">
|
||||
{{#quickgrading}}
|
||||
<div class="navitem m-0 ml-auto">
|
||||
<div class="form-check align-self-center">
|
||||
<input class="form-check-input" type="checkbox" id="quickgrading-{{uniqid}}" {{#enabled}}checked{{/enabled}}/>
|
||||
<label class="form-check-label" for="quickgrading-{{uniqid}}" >{{#str}}quickgrading, mod_assign{{/str}}</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="navitem-divider m-0"></div>
|
||||
{{#js}}
|
||||
document.querySelector('#quickgrading-{{uniqid}}').addEventListener('change', function(e) {
|
||||
var url = new URL('{{{baseurl}}}');
|
||||
url.searchParams.set('quickgrading', e.target.checked ? 1 : 0);
|
||||
window.location.href = url;
|
||||
});
|
||||
{{/js}}
|
||||
{{/quickgrading}}
|
||||
{{#actions}}
|
||||
<div class="navitem m-0">{{{actions}}}</div>
|
||||
{{/actions}}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user