Permalink
Browse files

MDL-34256: Grading table shows users with no submissions with "requir…

…es grading" filter

Also hide the filters completely if there are no submission plugins enabled (offline assignment).
  • Loading branch information...
Damyon Wiese
Damyon Wiese committed Jul 13, 2012
1 parent 904673d commit 44e2f0fe72c6be2cd1ba0c3c0bdd7e9d4854b7e4
Showing with 10 additions and 3 deletions.
  1. +3 −1 mod/assign/gradingoptionsform.php
  2. +1 −1 mod/assign/gradingtable.php
  3. +6 −1 mod/assign/locallib.php
@@ -52,7 +52,9 @@ function definition() {
$options = array('' => get_string('filternone', 'assign'),
ASSIGN_FILTER_SUBMITTED => get_string('filtersubmitted', 'assign'),
ASSIGN_FILTER_REQUIRE_GRADING => get_string('filterrequiregrading', 'assign'));
- $mform->addElement('select', 'filter', get_string('filter', 'assign'), $options);
+ if ($instance['submissionsenabled']) {
+ $mform->addElement('select', 'filter', get_string('filter', 'assign'), $options);
+ }
// quickgrading
if ($instance['showquickgrading']) {
@@ -105,7 +105,7 @@ function __construct(assign $assignment, $perpage, $filter, $rowoffset, $quickgr
$where .= ' AND s.timecreated > 0 ';
}
if ($filter == ASSIGN_FILTER_REQUIRE_GRADING) {
- $where .= ' AND (s.timemodified > g.timemodified OR g.timemodified IS NULL)';
+ $where .= ' AND (s.timemodified > g.timemodified OR (s.timemodified IS NOT NULL AND g.timemodified IS NULL))';
}
if (strpos($filter, ASSIGN_FILTER_SINGLE_USER) === 0) {
$userfilter = (int) array_pop(explode('=', $filter));
View
@@ -1724,6 +1724,7 @@ private function view_grading_table() {
array('cm'=>$this->get_course_module()->id,
'contextid'=>$this->context->id,
'userid'=>$USER->id,
+ 'submissionsenabled'=>$this->is_any_submission_plugin_enabled(),
'showquickgrading'=>$showquickgrading,
'quickgrading'=>$quickgrading),
'post', '',
@@ -2654,7 +2655,11 @@ private function process_save_grading_options() {
// Need submit permission to submit an assignment
require_capability('mod/assign:grade', $this->context);
- $mform = new mod_assign_grading_options_form(null, array('cm'=>$this->get_course_module()->id, 'contextid'=>$this->context->id, 'userid'=>$USER->id, 'showquickgrading'=>false));
+ $mform = new mod_assign_grading_options_form(null, array('cm'=>$this->get_course_module()->id,
+ 'contextid'=>$this->context->id,
+ 'userid'=>$USER->id,
+ 'submissionsenabled'=>$this->is_any_submission_plugin_enabled(),
+ 'showquickgrading'=>false));
if ($formdata = $mform->get_data()) {
set_user_preference('assign_perpage', $formdata->perpage);
set_user_preference('assign_filter', $formdata->filter);

0 comments on commit 44e2f0f

Please sign in to comment.