Index: moodle/grade/report/grader/lib.php
--- moodle/grade/report/grader/lib.php Base (1.98.2.65)
+++ moodle/grade/report/grader/lib.php Locally Modified (Based On 1.98.2.65)
@@ -657,7 +657,16 @@
                     }
 
                     $headerlink = $this->gtree->get_element_header($element, true, $this->get_pref('showactivityicons'), false);
-                    $headerhtml .= '<th class=" '.$columnclass.' '.$type.$catlevel.$hidden.'" scope="col" onclick="set_col(this.cellIndex)">'
+                    
+                    // need to distinguish between 2 different styling for fixedstudents.
+                    // $fixedstudents == 0, students and grades display in the same table.
+                    // $fixedstudents == 1, students and grades are display in separate table.
+                    if ($fixedstudents) {
+                        $incrementcellindex = '';
+                    } else {
+                        $incrementcellindex = '+1';
+                    }
+                    $headerhtml .= '<th class=" '.$columnclass.' '.$type.$catlevel.$hidden.'" scope="col" onclick="set_col(this.cellIndex' . $incrementcellindex . ')">'
                                 . shorten_text($headerlink) . $arrow;
                     $headerhtml .= '</th>';
                 }



Index: moodle/lang/en_utf8/assignment.php
--- moodle/lang/en_utf8/assignment.php Base (1.14.2.11)
+++ moodle/lang/en_utf8/assignment.php Locally Modified (Based On 1.14.2.11)
@@ -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: moodle/theme/standard/styles_layout.css
--- moodle/theme/standard/styles_layout.css Base (1.516.2.79)
+++ moodle/theme/standard/styles_layout.css Locally Modified (Based On 1.516.2.79)
@@ -4297,3 +4303,11 @@
   border: 1px dashed #ddd;
   padding: 3px;
 }
+
+#optiontable {
+    float: right;
+}
+
+.floatnone{
+    float: none;
+}

Index: moodle/mod/assignment/lib.php
--- moodle/mod/assignment/lib.php Base (1.277.2.52)
+++ moodle/mod/assignment/lib.php Locally Modified (Based On 1.277.2.52)
@@ -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,15 +823,24 @@

         $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,
                               s.timemodified, s.timemarked,
                               COALESCE(SIGN(SIGN(s.timemarked) + SIGN(s.timemarked - s.timemodified)), 0) AS status ';
             $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).') ';
+                   'LEFT JOIN '.$CFG->prefix.'assignment_submissions s ON u.id = s.userid ' .
+                   'AND s.assignment = '.$this->assignment->id.' '.
+                   '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 '<input type="hidden" name="mode" value="grade" />';
         echo '<input type="hidden" name="menuindex" value="0" />';//selected menu index

+        //for fill mode
+        echo '<input type="hidden" name="fill" value="'.$fill.'">';
+
         //new hidden field, initialized to -1.
         echo '<input type="hidden" name="saveuserid" value="-1" />';

@@ -1010,19 +1023,21 @@
          * 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
          * from database
          */
         $perpage    = get_user_preferences('assignment_perpage', 10);
         $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);

@@ -1144,6 +1159,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 +1180,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 +1294,7 @@

                 ///No more buttons, we use popups ;-).
                 $popup_url = '/mod/assignment/submissions.php?id='.$this->cm->id
-                           . '&amp;userid='.$auser->id.'&amp;mode=single'.'&amp;offset='.$offset++;
+                           . '&amp;userid='.$auser->id.'&amp;mode=single'.'&amp;fill='.$fill.'&amp;offset='.$offset++;
                 $button = link_to_popup_window ($popup_url, 'grade'.$auser->id, $buttontext, 600, 780,
                                                 $buttontext, 'none', true, 'button'.$auser->id);

@@ -1321,6 +1344,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 '<div class="fgcontrols">';
@@ -1336,13 +1377,28 @@
         }
         /// End of fast grading form

-        /// Mini form for setting user preference
-        echo '<div class="qgprefs">';
-        echo '<form id="options" action="submissions.php?id='.$this->cm->id.'" method="post"><div>';
+        //Additional javascript for jumps
+        echo '<script type="text/javascript">'."\n<!--\n";
+        echo 'function invokeSubmit(formid) {'."\n";
+        echo '    var selectedUrl;'."\n";
+        echo '    selectedUrl = document.getElementById(formid).jump.options[document.getElementById(formid).jump.selectedIndex].value;'."\n";
+        echo '    document.getElementById(formid).action = selectedUrl;'."\n";
+        echo '    document.getElementById(formid).submit();'."\n";
+        echo '}'."\n";
+        echo "\n-->\n</script>"."\n<br />";
+
+        echo '<form id="options" action="submissions.php?id='.$this->cm->id.'&amp;fill='.$fill.'" method="post"><div>';
         echo '<input type="hidden" name="updatepref" value="1" />';
+        echo '<label for="_jump">'.get_string('show','assignment').' </label>';
+        echo '<select id="_jump" onchange="invokeSubmit(\'options\')" name="jump">';
+        echo '<option value="'.$CFG->wwwroot.'/mod/assignment/submissions.php?id='.$this->cm->id.'&amp;fill=all"'.((!empty($selectedall))?' selected="selected"':'').'>'.get_string('all','assignment').'</option>';
+        echo '<option value="'.$CFG->wwwroot.'/mod/assignment/submissions.php?id='.$this->cm->id.'&amp;fill=havesub"'.((!empty($selectedhavesub))?' selected="selected"':'').'>'.get_string('havesub','assignment').'</option>';
+        echo '<option value="'.$CFG->wwwroot.'/mod/assignment/submissions.php?id='.$this->cm->id.'&amp;fill=notgraded"'.((!empty($selectednotgraded))?' selected="selected"':'').'>'.get_string('notgradedsub','assignment').'</option>';
+        echo '</select>';
+        helpbutton('assignment_filter', get_string('filter','assignment'), 'moodle', true, false, '', false);
         echo '<table id="optiontable">';
         echo '<tr><td>';
         echo '<label for="perpage">'.get_string('pagesize','assignment').'</label>';

         echo '</td>';
         echo '<td>';
         echo '<input type="text" id="perpage" name="perpage" size="1" value="'.$perpage.'" />';
@@ -1359,6 +1415,7 @@
         echo '<tr><td colspan="2">';
         echo '<input type="submit" value="'.get_string('savepreferences').'" />';
         echo '</td></tr></table>';
+        echo '<div class="floatnone"></div>';
         echo '</div></form></div>';
         ///End of mini form
         print_footer($this->course);
