diff --git a/mod/assignment/index.php b/mod/assignment/index.php index 467bcbaee0d19..71eb0237ed3b7 100644 --- a/mod/assignment/index.php +++ b/mod/assignment/index.php @@ -47,10 +47,8 @@ if ($usesections) { $table->head = array ($strsectionname, $strname, $strassignmenttype, $strduedate, $strsubmitted, $strgrade); - $table->align = array ("center", "left", "left", "left", "right"); } else { $table->head = array ($strname, $strassignmenttype, $strduedate, $strsubmitted, $strgrade); - $table->align = array ("left", "left", "left", "right"); } $currentsection = ""; diff --git a/mod/assignment/lang/en/assignment.php b/mod/assignment/lang/en/assignment.php index 443353ba56c86..f57c5009c636f 100644 --- a/mod/assignment/lang/en/assignment.php +++ b/mod/assignment/lang/en/assignment.php @@ -151,6 +151,7 @@ $string['notsubmittedyet'] = 'Not submitted yet'; $string['onceassignmentsent'] = 'Once the assignment is sent for marking, you will no longer be able to delete or attach file(s). Do you want to continue?'; $string['operation'] = 'Operation'; +$string['optionalsettings'] = 'Optional settings'; $string['overwritewarning'] = 'Warning: uploading again will REPLACE your current submission'; $string['pagesize'] = 'Submissions shown per page'; $string['pluginadministration'] = 'Assignment administration'; @@ -158,6 +159,7 @@ $string['preventlate'] = 'Prevent late submissions'; $string['quickgrade'] = 'Allow quick grading'; $string['quickgrade_help'] = 'If enabled, multiple assignments can be graded on one page. Add grades and comments then click the "Save all my feedback" button to save all changes for that page.'; +$string['requiregrading'] = 'Require grading'; $string['responsefiles'] = 'Response files'; $string['reviewed'] = 'Reviewed'; $string['saveallfeedback'] = 'Save all my feedback'; diff --git a/mod/assignment/lib.php b/mod/assignment/lib.php index f5f2aecc20730..fd63d8ed8363a 100644 --- a/mod/assignment/lib.php +++ b/mod/assignment/lib.php @@ -46,6 +46,10 @@ */ class assignment_base { + const FILTER_ALL = 0; + const FILTER_SUBMITTED = 1; + const FILTER_REQUIRE_GRADING = 2; + /** @var object */ var $cm; /** @var object */ @@ -143,7 +147,7 @@ function assignment_base($cmid='staticonly', $assignment=NULL, $cm=NULL, $course * * This in turn calls the methods producing individual parts of the page */ - function view() { + function view() { $context = get_context_instance(CONTEXT_MODULE,$this->cm->id); require_capability('mod/assignment:view', $context); @@ -591,8 +595,7 @@ function submissions($mode) { //make user global so we can use the id global $USER, $OUTPUT, $DB, $PAGE; - $mailinfo = optional_param('mailinfo', null, PARAM_BOOL); - $saved = optional_param('saved', null, PARAM_BOOL); + $mailinfo = optional_param('mailinfo', null, PARAM_BOOL); if (optional_param('next', null, PARAM_BOOL)) { $mode='next'; @@ -602,14 +605,14 @@ function submissions($mode) { } if (is_null($mailinfo)) { - $mailinfo = get_user_preferences('assignment_mailinfo', 0); + if (optional_param('sesskey', null, PARAM_BOOL)) { + set_user_preference('assignment_mailinfo', $mailinfo); + } else { + $mailinfo = get_user_preferences('assignment_mailinfo', 0); + } } else { set_user_preference('assignment_mailinfo', $mailinfo); - } - - if ($saved) { - $OUTPUT->heading(get_string('changessaved')); - } + } switch ($mode) { case 'grade': // We are in a main window grading @@ -906,6 +909,7 @@ function display_submission($offset=-1,$userid =-1) { if ($offset==-1) { $offset = required_param('offset', PARAM_INT);//offset for where to start looking for student. } + $filter = optional_param('filter', 0, PARAM_INT); if (!$user = $DB->get_record('user', array('id'=>$userid))) { print_error('nousers'); @@ -944,6 +948,12 @@ function display_submission($offset=-1,$userid =-1) { } $nextid = 0; + $where = ''; + if($filter == 'submitted') { + $where .= 's.timemodified > 0 AND '; + } else if($filter == 'requiregrading') { + $where .= 's.timemarked < s.timemodified AND '; + } if ($users) { $userfields = user_picture::fields('u', array('lastaccess')); @@ -953,8 +963,8 @@ function display_submission($offset=-1,$userid =-1) { COALESCE(SIGN(SIGN(s.timemarked) + SIGN(s.timemarked - s.timemodified)), 0) AS status "; $sql = 'FROM {user} u '. 'LEFT JOIN {assignment_submissions} s ON u.id = s.userid - AND s.assignment = '.$this->assignment->id.' '. - 'WHERE u.id IN ('.implode(',', $users).') '; + AND s.assignment = '.$this->assignment->id.' '. + 'WHERE '.$where.'u.id IN ('.implode(',', $users).') '; if ($sort = flexible_table::get_sort_for_table('mod-assignment-submissions')) { $sort = 'ORDER BY '.$sort.' '; @@ -975,7 +985,7 @@ function display_submission($offset=-1,$userid =-1) { global $USER; $teacher = $USER; } - + $this->preprocess_submission($submission); $mformdata = new stdclass; @@ -999,7 +1009,8 @@ function display_submission($offset=-1,$userid =-1) { $mformdata->submissioncomment= $submission->submissioncomment; $mformdata->submissioncommentformat= FORMAT_HTML; $mformdata->submission_content= $this->print_user_files($user->id,true); - + $mformdata->filter = $filter; + $submitform = new mod_assignment_grading_form( null, $mformdata ); if ($submitform->is_cancelled()) { @@ -1054,20 +1065,28 @@ function display_submissions($message='') { /* first we check to see if the form has just been submitted * to request user_preference updates */ + + $filters = array(self::FILTER_ALL => get_string('all'), + self::FILTER_SUBMITTED => get_string('submitted', 'assignment'), + self::FILTER_REQUIRE_GRADING => get_string('requiregrading', 'assignment')); + + $updatepref = optional_param('updatepref', 0, PARAM_INT); + if (isset($_POST['updatepref'])){ $perpage = optional_param('perpage', 10, PARAM_INT); $perpage = ($perpage <= 0) ? 10 : $perpage ; + $filter = optional_param('filter', 0, PARAM_INT); set_user_preference('assignment_perpage', $perpage); - set_user_preference('assignment_quickgrade', optional_param('quickgrade', 0, PARAM_BOOL)); + set_user_preference('assignment_quickgrade', optional_param('quickgrade', 0, PARAM_BOOL)); + set_user_preference('assignment_filter', $filter); } /* next we get perpage and quickgrade (allow quick grade) params * from database */ $perpage = get_user_preferences('assignment_perpage', 10); - $quickgrade = get_user_preferences('assignment_quickgrade', 0); - + $filter = get_user_preferences('assignment_filter', 0); $grading_info = grade_get_grades($this->course->id, 'mod', 'assignment', $this->assignment->id); if (!empty($CFG->enableoutcomes) and !empty($grading_info->outcomes)) { @@ -1092,15 +1111,20 @@ function display_submissions($message='') { $PAGE->set_heading($this->course->fullname); echo $OUTPUT->header(); + echo '