Merge branch 'MDL-34256' of git://github.com/netspotau/moodle-mod_assign

This commit is contained in:
Sam Hemelryk 2012-07-23 11:09:28 +12:00
commit 5b2b9e04ef
3 changed files with 10 additions and 3 deletions

View File

@ -52,7 +52,9 @@ class mod_assign_grading_options_form extends moodleform {
$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']) {

View File

@ -105,7 +105,7 @@ class assign_grading_table extends table_sql implements renderable {
$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 File

@ -1745,6 +1745,7 @@ class assign {
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', '',
@ -2673,7 +2674,11 @@ class assign {
// 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);