Index: lang/en_utf8/assignment.php =================================================================== RCS file: /cvsroot/moodle/moodle/lang/en_utf8/assignment.php,v retrieving revision 1.14.2.11 diff -u -r1.14.2.11 assignment.php --- lang/en_utf8/assignment.php 27 Feb 2008 05:05:01 -0000 1.14.2.11 +++ lang/en_utf8/assignment.php 6 Dec 2008 11:37:50 -0000 @@ -138,5 +138,10 @@ $string['viewfeedback'] = 'View assignment grades and feedback'; $string['viewsubmissions'] = 'View $a submitted assignments'; $string['yoursubmission'] = 'Your submission'; +$string['filtersub'] = 'Select submissions...'; +$string['all'] = 'all'; +$string['havesub'] = 'submitted'; +$string['notgradedsub'] = 'await grading'; +$string['show'] = 'Show'; ?> Index: mod/assignment/lib.php =================================================================== RCS file: /cvsroot/moodle/moodle/mod/assignment/lib.php,v retrieving revision 1.277.2.46 diff -u -r1.277.2.46 lib.php --- mod/assignment/lib.php 23 Sep 2008 07:46:53 -0000 1.277.2.46 +++ mod/assignment/lib.php 8 Dec 2008 12:45:34 -0000 @@ -783,6 +783,7 @@ $userid = required_param('userid', PARAM_INT); $offset = required_param('offset', PARAM_INT);//offset for where to start looking for student. + $fill = optional_param('fill','all',PARAM_TEXT); if (!$user = get_record('user', 'id', $userid)) { error('No such user!'); @@ -822,6 +823,15 @@ $nextid = 0; + $where = ''; + if($fill == 'havesub') { + $where .= 's.timemodified > 0 AND '; + } + + if($fill == 'notgraded') { + $where .= 's.timemarked < s.timemodified AND '; + } + if ($users) { $select = 'SELECT u.id, u.firstname, u.lastname, u.picture, u.imagealt, s.id AS submissionid, s.grade, s.submissioncomment, @@ -830,7 +840,7 @@ $sql = 'FROM '.$CFG->prefix.'user u '. 'LEFT JOIN '.$CFG->prefix.'assignment_submissions s ON u.id = s.userid AND s.assignment = '.$this->assignment->id.' '. - 'WHERE u.id IN ('.implode(',', $users).') '; + 'WHERE '.$where.'u.id IN ('.implode(',', $users).') '; if ($sort = flexible_table::get_sql_sort('mod-assignment-submissions')) { $sort = 'ORDER BY '.$sort.' '; @@ -888,6 +898,9 @@ echo ''; echo '';//selected menu index + //for fill mode + echo ''; + //new hidden field, initialized to -1. echo ''; @@ -1010,11 +1023,13 @@ * to request user_preference updates */ - if (isset($_POST['updatepref'])){ + if (isset($_POST['updatepref']) || isset($_GET['fill'])){ $perpage = optional_param('perpage', 10, PARAM_INT); $perpage = ($perpage <= 0) ? 10 : $perpage ; set_user_preference('assignment_perpage', $perpage); set_user_preference('assignment_quickgrade', optional_param('quickgrade', 0, PARAM_BOOL)); + $fill = optional_param('fill','all',PARAM_RAW); + set_user_preference('assignment_filter',$fill); } /* next we get perpage and quickgrade (allow quick grade) params @@ -1024,6 +1039,8 @@ $quickgrade = get_user_preferences('assignment_quickgrade', 0); + $fill = get_user_preferences('assignment_filter','all'); + $grading_info = grade_get_grades($this->course->id, 'mod', 'assignment', $this->assignment->id); if (!empty($CFG->enableoutcomes) and !empty($grading_info->outcomes)) { @@ -1144,6 +1161,14 @@ $where .= ' AND '; } + if($fill == 'havesub') { + $where .= 's.timemodified > 0 AND '; + } + + if($fill == 'notgraded') { + $where .= 's.timemarked < s.timemodified AND '; + } + if ($sort = $table->get_sql_sort()) { $sort = ' ORDER BY '.$sort; } @@ -1157,8 +1182,8 @@ AND s.assignment = '.$this->assignment->id.' '. 'WHERE '.$where.'u.id IN ('.implode(',',$users).') '; - $table->pagesize($perpage, count($users)); - + $ausers = get_records_sql($select.$sql.$sort); + $table->pagesize($perpage, count($ausers)); ///offset used to calculate index of student in that particular query, needed for the pop up to know who's next $offset = $page * $perpage; @@ -1271,7 +1296,7 @@ ///No more buttons, we use popups ;-). $popup_url = '/mod/assignment/submissions.php?id='.$this->cm->id - . '&userid='.$auser->id.'&mode=single'.'&offset='.$offset++; + . '&userid='.$auser->id.'&mode=single'.'&fill='.$fill.'&offset='.$offset++; $button = link_to_popup_window ($popup_url, 'grade'.$auser->id, $buttontext, 600, 780, $buttontext, 'none', true, 'button'.$auser->id); @@ -1321,6 +1346,24 @@ $table->print_html(); /// Print the whole table + if($fill == 'all') { + $selectedall = '"selected"'; + } else { + $selectedall = ''; + } + + if($fill == 'havesub') { + $selectedhavesub = '"selected"'; + } else { + $selectedhavesub = ''; + } + + if($fill == 'notgraded') { + $selectednotgraded = '"selected"'; + } else { + $selectednotgraded = ''; + } + if ($quickgrade){ $lastmailinfo = get_user_preferences('assignment_mailinfo', 1) ? 'checked="checked"' : ''; echo '
'; @@ -1336,10 +1379,25 @@ } /// End of fast grading form - /// Mini form for setting user preference - echo '
'; - echo '
'; + //Additional javascript for jumps + echo '"."\n"; + + echo '
'; echo ''; + echo ''; + helpbutton('assignment_filter', get_string('filter','assignment'), 'moodle', true, false, '', false); + echo ''; echo ''; echo '
'; echo ''; @@ -1360,6 +1418,7 @@ echo ''; echo '
'; echo '
'; + ///End of mini form print_footer($this->course); }