Index: moodle/mod/assignment/index.php
--- moodle/mod/assignment/index.php Base (1.55)
+++ moodle/mod/assignment/index.php Locally Modified (Based On 1.55)
@@ -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 = "";
Index: moodle/mod/assignment/lang/en/assignment.php
--- moodle/mod/assignment/lang/en/assignment.php Base (1.15)
+++ moodle/mod/assignment/lang/en/assignment.php Locally Modified (Based On 1.15)
@@ -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';
Index: moodle/mod/assignment/lib.php
--- moodle/mod/assignment/lib.php Base (1.484)
+++ moodle/mod/assignment/lib.php Locally Modified (Based On 1.484)
@@ -592,7 +592,6 @@
         global $USER, $OUTPUT, $DB, $PAGE;
 
         $mailinfo = optional_param('mailinfo', null, PARAM_BOOL);
-        $saved = optional_param('saved', null, PARAM_BOOL);
 
         if (optional_param('next', null, PARAM_BOOL)) {
             $mode='next';
@@ -602,15 +601,15 @@
         }
 
         if (is_null($mailinfo)) {
+            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
                 if ($submission = $this->process_feedback()) {
@@ -906,6 +905,7 @@
         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 +944,12 @@
         }
 
         $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'));
@@ -954,7 +960,7 @@
             $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).') ';
+                   'WHERE '.$where.'u.id IN ('.implode(',', $users).') ';
 
             if ($sort = flexible_table::get_sort_for_table('mod-assignment-submissions')) {
                 $sort = 'ORDER BY '.$sort.' ';
@@ -999,6 +1005,7 @@
         $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 );
 
@@ -1054,20 +1061,31 @@
         /* first we check to see if the form has just been submitted
          * to request user_preference updates
          */
+        define('ALL', 0);
+        define('SUBMITTED', 1);
+        define('REQUIRE_GRADING', 2);
+        
+       $filters = array(ALL             => get_string('all'),
+                        SUBMITTED       => get_string('submitted', 'assignment'),
+                        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_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 +1110,20 @@
         $PAGE->set_heading($this->course->fullname);
         echo $OUTPUT->header();
 
+        echo '<div class="usersubmissions">';
+        
         /// Print quickgrade form around the table
         if ($quickgrade) {
-            echo '<form action="submissions.php" id="fastg" method="post">';
-            echo '<div>';
-            echo '<input type="hidden" name="id" value="'.$this->cm->id.'" />';
-            echo '<input type="hidden" name="mode" value="fastgrade" />';
-            echo '<input type="hidden" name="page" value="'.$page.'" />';
-            echo '<input type="hidden" name="sesskey" value="'.sesskey().'" />';
-            echo '</div>';
+            $formattrs = array();
+            $formattrs['action'] = new moodle_url('/mod/assignment/submissions.php');
+            $formattrs['id'] = 'fastg';
+            $formattrs['method'] = 'post';
+
+            echo html_writer::start_tag('form', $formattrs);
+            echo html_writer::empty_tag('input', array('type'=>'hidden', 'name'=>'id',      'value'=> $this->cm->id));
+            echo html_writer::empty_tag('input', array('type'=>'hidden', 'name'=>'mode',    'value'=> 'fastgrade'));
+            echo html_writer::empty_tag('input', array('type'=>'hidden', 'name'=>'page',    'value'=> $page));
+            echo html_writer::empty_tag('input', array('type'=>'hidden', 'name'=>'sesskey', 'value'=> sesskey()));
         }
 
         $course_context = get_context_instance(CONTEXT_COURSE, $course->id);
@@ -1123,7 +1146,30 @@
         groups_print_activity_menu($cm, $CFG->wwwroot . '/mod/assignment/submissions.php?id=' . $this->cm->id);
 
         /// Get all ppl that are allowed to submit assignments
-        if ($users = get_enrolled_users($context, 'mod/assignment:submit', $currentgroup, 'u.id')) {
+        list($esql, $params) = get_enrolled_sql($context, 'mod/assignment:submit', $currentgroup);
+        
+        if ($filter == ALL) {
+            $sql = "SELECT u.id FROM {user} u ".
+                   "LEFT JOIN ($esql) eu ON eu.id=u.id ".
+                   "WHERE u.deleted = 0 AND eu.id=u.id ";
+        } else {
+            $wherefilter = '';
+            if($filter == SUBMITTED) {
+               $wherefilter = ' AND s.timemodified > 0';
+            } else if($filter == REQUIRE_GRADING) {
+                $wherefilter = ' AND s.timemarked < s.timemodified ';
+            }
+
+            $sql = "SELECT u.id FROM {user} u ".
+                   "LEFT JOIN ($esql) eu ON eu.id=u.id ".
+                   "LEFT JOIN {assignment_submissions} s ON (u.id = s.userid) " .
+                   "WHERE u.deleted = 0 AND eu.id=u.id ".
+                   'AND s.assignment = '. $this->assignment->id .
+                    $wherefilter;
+        }
+
+        $users = $DB->get_records_sql($sql, $params);
+        if (!empty($users)) {
             $users = array_keys($users);
         }
 
@@ -1203,11 +1249,18 @@
             $where .= ' AND ';
         }
 
+        if($filter == SUBMITTED) {
+           $where .= 's.timemodified > 0 AND ';           
+        } else if($filter == REQUIRE_GRADING) {
+           $where .= 's.timemarked < s.timemodified AND ';           
+        }
+
         if ($sort = $table->get_sql_sort()) {
             $sort = ' ORDER BY '.$sort;
         }
 
         $ufields = user_picture::fields('u');
+
         $select = "SELECT $ufields,
                           s.id AS submissionid, s.grade, s.submissioncomment,
                           s.timemodified, s.timemarked,
@@ -1217,18 +1270,22 @@
                                                                   AND s.assignment = '.$this->assignment->id.' '.
                'WHERE '.$where.'u.id IN ('.implode(',',$users).') ';
 
+        $ausers = $DB->get_records_sql($select.$sql.$sort, null, $table->get_page_start(), $table->get_page_size());
+
         $table->pagesize($perpage, count($users));
 
         ///offset used to calculate index of student in that particular query, needed for the pop up to know who's next
         $offset = $page * $perpage;
-
         $strupdate = get_string('update');
         $strgrade  = get_string('grade');
         $grademenu = make_grades_menu($this->assignment->grade);
 
-        if (($ausers = $DB->get_records_sql($select.$sql.$sort, null, $table->get_page_start(), $table->get_page_size())) !== false) {
+        if ($ausers !== false) {
             $grading_info = grade_get_grades($this->course->id, 'mod', 'assignment', $this->assignment->id, array_keys($ausers));
+            $endposition = $offset + $perpage;
+            $currentposition = 0;
             foreach ($ausers as $auser) {
+                if ($currentposition == $offset && $offset < $endposition) {
                 $final_grade = $grading_info->items[0]->grades[$auser->id];
                 $grademax = $grading_info->items[0]->grademax;
                 $final_grade->formatted_grade = round($final_grade->grade,2) .' / ' . round($grademax,2);
@@ -1331,7 +1388,7 @@
 
                 ///No more buttons, we use popups ;-).
                 $popup_url = '/mod/assignment/submissions.php?id='.$this->cm->id
-                           . '&userid='.$auser->id.'&mode=single'.'&offset='.$offset++;
+                           . '&amp;userid='.$auser->id.'&amp;mode=single'.'&amp;filter='.$filter.'&amp;offset='.$offset++;
 
                 $button = $OUTPUT->action_link($popup_url, $buttontext);
 
@@ -1360,7 +1417,7 @@
                     }
                 }
 
-                $userlink = '<a href="' . $CFG->wwwroot . '/user/view.php?id=' . $auser->id . '&amp;course=' . $course->id . '">' . fullname($auser) . '</a>';
+                    $userlink = '<a href="' . $CFG->wwwroot . '/user/view.php?id=' . $auser->id . '&amp;course=' . $course->id . '">' . fullname($auser, has_capability('moodle/site:viewfullnames', $this->context)) . '</a>';
                 $row = array($picture, $userlink, $grade, $comment, $studentmodified, $teachermodified, $status, $finalgrade);
                 if ($uses_outcomes) {
                     $row[] = $outcomes;
@@ -1368,50 +1425,57 @@
 
                 $table->add_data($row);
             }
+                $currentposition++;
         }
+        }
 
         $table->print_html();  /// Print the whole table
 
-        if ($quickgrade){
-            $lastmailinfo = get_user_preferences('assignment_mailinfo', 1) ? 'checked="checked"' : '';
-            echo '<div class="fgcontrols">';
-            echo '<div class="emailnotification">';
-            echo '<label for="mailinfo">'.get_string('enableemailnotification','assignment').'</label>';
-            echo '<input type="hidden" name="mailinfo" value="0" />';
-            echo '<input type="checkbox" id="mailinfo" name="mailinfo" value="1" '.$lastmailinfo.' />';
-            echo $OUTPUT->help_icon('enableemailnotification', 'assignment');
-            echo '</div>';
-            echo '</div>';
-            echo '<div class="fastgbutton"><input type="submit" name="fastg" value="'.get_string('saveallfeedback', 'assignment').'" /></div>';
-            echo '</form>';
+        /// Print quickgrade form around the table
+        if ($quickgrade && $table->started_output){
+            $mailinfopref = false;
+            if (get_user_preferences('assignment_mailinfo', 1)) {
+                $mailinfopref = true;
         }
+            $emailnotification =  html_writer::checkbox('mailinfo', 1, $mailinfopref, get_string('enableemailnotification','assignment'));
+            
+            $emailnotification .= $OUTPUT->help_icon('enableemailnotification', 'assignment');
+            echo html_writer::tag('div', $emailnotification, array('class'=>'emailnotification'));
+
+            $savefeedback = html_writer::empty_tag('input', array('type'=>'submit', 'name'=>'fastg', 'value'=>get_string('saveallfeedback', 'assignment')));
+            echo html_writer::tag('div', $savefeedback, array('class'=>'fastgbutton'));
+            
+            echo html_writer::end_tag('form');            
+        } else if ($quickgrade) {
+            echo html_writer::end_tag('form');            
+        }
+
+        echo '</div>';
         /// 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>';
-        echo '<input type="hidden" name="updatepref" value="1" />';
-        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.'" />';
-        echo '</td></tr>';
-        echo '<tr><td>';
-        echo '<label for="quickgrade">'.get_string('quickgrade','assignment').'</label>';
-        echo '</td>';
-        echo '<td>';
-        $checked = $quickgrade ? 'checked="checked"' : '';
-        echo '<input type="checkbox" id="quickgrade" name="quickgrade" value="1" '.$checked.' />';
-        echo '<p>'.$OUTPUT->help_icon('quickgrade', 'assignment').'</p>';
-        echo '</td>';
-        echo '</tr>';
-        echo '<tr><td colspan="2">';
-        echo '<input type="submit" value="'.get_string('savepreferences').'" />';
-        echo '</td></tr></table>';
-        echo '</div></form></div>';
-        ///End of mini form
+        
+        $formaction = new moodle_url('/mod/assignment/submissions.php', array('id'=>$this->cm->id));
+        $mform = new MoodleQuickForm('optionspref', 'post', $formaction, '', array('class'=>'optionspref'));
+        
+        $mform->addElement('hidden', 'updatepref');
+        $mform->setDefault('updatepref', 1);
+        $mform->addElement('header', 'qgprefs', get_string('optionalsettings', 'assignment'));
+        $mform->addElement('select', 'filter', get_string('show'),  $filters);
+        
+        $mform->setDefault('filter', $filter);
+
+        $mform->addElement('text', 'perpage', get_string('pagesize', 'assignment'), array('size'=>1));
+        $mform->setDefault('perpage', $perpage);        
+
+        $mform->addElement('checkbox', 'quickgrade', get_string('quickgrade','assignment'));
+        $mform->setDefault('quickgrade', $quickgrade);
+        $mform->addHelpButton('quickgrade', 'quickgrade', 'assignment');
+        
+        $mform->addElement('submit', 'savepreferences', get_string('savepreferences'));
+
+        $mform->display();
+        
         echo $OUTPUT->footer();
     }
 
@@ -2095,6 +2159,8 @@
         $mform->setType('menuindex', PARAM_INT);
         $mform->addElement('hidden', 'saveuserid', "-1");
         $mform->setType('saveuserid', PARAM_INT);
+        $mform->addElement('hidden', 'filter', "0");
+        $mform->setType('filter', PARAM_INT);
 
         $mform->addElement('static', 'picture', $OUTPUT->user_picture($this->_customdata->user),
                                                 fullname($this->_customdata->user, true) . '<br/>' .
Index: moodle/mod/assignment/styles.css
--- moodle/mod/assignment/styles.css Base (1.3)
+++ moodle/mod/assignment/styles.css Locally Modified (Based On 1.3)
@@ -31,3 +31,10 @@
 #page-mod-assignment-view .feedback .grade {text-align: right;}
 #page-mod-assignment-view #online .singlebutton {text-align: center;}
 #page-mod-assignment-view #dates .c0 {text-align:right;font-weight:bold;}
+
+#page-mod-assignment-submissions .mform.optionspref .fitem .fitemtitle {width:50%;}
+#page-mod-assignment-submissions .mform.optionspref .fitem .felement {width: 30%; margin-left: 51%;}
+#page-mod-assignment-submissions.dir-rtl .mform .fitem .felement {margin-right: 51%; margin-left: 0;}
+
+#page-mod-assignment-submissions .optionspref {width: 50%;}
+#page-mod-assignment-submissions .fastgbutton {text-align: center;}
