Index: moodle/lang/en_utf8/assignment.php
--- moodle/lang/en_utf8/assignment.php Base (1.33)
+++ moodle/lang/en_utf8/assignment.php Locally Modified (Based On 1.33)
@@ -153,4 +153,5 @@
 $string['maxpublishstate'] = 'Maximum visibility for blog entry before duedate';
 $string['selectblog'] = 'Select which blog entry you wish to submit';
 $string['noblogs'] = 'You have no blog entries to submit!';
+$string['requiregrading'] = 'Require grading';
 ?>
Index: moodle/lang/en_utf8/help/assignment/filterpreference.html
--- moodle/lang/en_utf8/help/assignment/filterpreference.html No Base Revision
+++ moodle/lang/en_utf8/help/assignment/filterpreference.html Locally New
@@ -0,0 +1,12 @@
+<h1>Show Submission</h1>
+
+<p>User submission can be display in 3 different ways.  <br />
+
+All - display all user that participate in the course.<br />
+
+Submitted - display user that had submitted the assignment<br />
+
+Require grading - dislay submitted assignemnt that need to be graded.</p>
+
+<p>Selected preference is saved and will apply to all assignments in all courses.</p>
+
Index: moodle/lang/en_utf8/help/assignment/savepreferences.html
--- moodle/lang/en_utf8/help/assignment/savepreferences.html No Base Revision
+++ moodle/lang/en_utf8/help/assignment/savepreferences.html Locally New
@@ -0,0 +1,5 @@
+<h1>Save Preferences</h1>
+
+<p>The selected preference options will be saved and apply to all assignments in all courses.</p>
+
+
Index: moodle/mod/assignment/lib.php
--- moodle/mod/assignment/lib.php Base (1.434)
+++ moodle/mod/assignment/lib.php Locally Modified (Based On 1.434)
@@ -860,6 +860,7 @@
 
         $userid = required_param('userid', PARAM_INT);
         $offset = required_param('offset', PARAM_INT);//offset for where to start looking for student.
+        $filter = optional_param('filter', PARAM_INT);
 
         if (!$user = $DB->get_record('user', array('id'=>$userid))) {
             print_error('nousers');
@@ -898,16 +899,24 @@
         }
 
         $nextid = 0;
+        $where = '';
+        if($filter == 'submitted') {
+            $where .= 's.timemodified > 0 AND ';
+        }
 
+        if($filter == 'requiregrading') {
+            $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 {user} u '.
-                   'LEFT JOIN {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.' ';
@@ -952,6 +961,8 @@
         echo '<input type="hidden" name="sesskey" value="'.sesskey().'" />';
         echo '<input type="hidden" name="mode" value="grade" />';
         echo '<input type="hidden" name="menuindex" value="0" />';//selected menu index
+        //for filter mode
+        echo '<input type="hidden" name="filter" value="'.$filter.'">';
 
         //new hidden field, initialized to -1.
         echo '<input type="hidden" name="saveuserid" value="-1" />';
@@ -1080,21 +1091,30 @@
         /* 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);
 
-        if (isset($_POST['updatepref'])){
+       $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 ($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)) {
@@ -1214,7 +1234,12 @@
         if ($where = $table->get_sql_where()) {
             $where .= ' AND ';
         }
-
+        if($filter == SUBMITTED) {
+            $where .= 's.timemodified > 0 AND ';
+        }
+	if($filter == REQUIRE_GRADING) {
+           $where .= 's.timemarked < s.timemodified AND ';
+        }
         if ($sort = $table->get_sql_sort()) {
             $sort = ' ORDER BY '.$sort;
         }
@@ -1228,18 +1253,30 @@
                                                                   AND s.assignment = '.$this->assignment->id.' '.
                'WHERE '.$where.'u.id IN ('.implode(',',$users).') ';
 
-        $table->pagesize($perpage, count($users));
+        $ausers = $DB->get_records_sql($select.$sql.$sort, null, $table->get_page_start(), $table->get_page_size());
+        $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;
-
         $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) {
+         /// Print quickgrade form around the table
+        if ($quickgrade){
+            echo '<form action="submissions.php" id="fastg" method="post">';            
+            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().'" />';            
+        }
+
+        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);
@@ -1342,7 +1379,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++;
 
                 $action = new popup_action('click', $popup_url, 'grade'.$auser->id, array('height' => 600, 'width' => 700));
                 $button = $OUTPUT->action_link($popup_url, $buttontext, $action);
@@ -1372,7 +1409,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;
@@ -1380,17 +1417,8 @@
 
                 $table->add_data($row);
             }
+                $currentposition++;
         }
-
-        /// 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>';
         }
 
         $table->print_html();  /// Print the whole table
@@ -1412,29 +1440,33 @@
 
         /// 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 '<form id="optionspref" action="submissions.php?id='.$this->cm->id.'" method="post">';
         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 '<div>';
+        echo '<label for="_jump">'.get_string('show','moodle').' </label>';
+        echo html_writer::select($filters, 'filter', $filter);
+        
+        echo $OUTPUT->help_icon('filterpreference', get_string('filter','assignment'), 'assignment');
+        echo '<br />';
+        echo '<label for="perpage">'.get_string('pagesize','assignment').'&nbsp;</label>';
+        echo '<input type="text" id="perpage" name="perpage" size="0" value="'.$perpage.'" />';
         echo $OUTPUT->help_icon('pagesize', get_string('pagesize','assignment'), 'assignment');
-        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 $OUTPUT->help_icon('quickgrade', get_string('quickgrade', 'assignment'), 'assignment').'</p></div>';
-        echo '</td></tr>';
-        echo '<tr><td colspan="2">';
+        echo '<br />';
+        echo '<label for="quickgrade">'.get_string('quickgrade','assignment').'&nbsp;</label>';
+        $checked = $quickgrade ? true : false;
+       
+        echo html_writer::checkbox('quickgrade', "1", $checked);
+        echo $OUTPUT->help_icon('quickgrade', get_string('quickgrade', 'assignment'), 'assignment');
+        echo '<br />';
         echo '<input type="submit" value="'.get_string('savepreferences').'" />';
-        echo '</td></tr></table>';
-        echo '</div></form></div>';
-        ///End of mini form
+        echo $OUTPUT->help_icon('savepreferences', get_string('savepreferences'), 'assignment');
+        echo '</div>';
+        echo '</form>';
+        
+        echo '<div class="clearer"> </div>';
+        
+        echo '</div>';
+        
         echo $OUTPUT->footer();
     }
 
Index: moodle/theme/standardold/style/mod_assignment.css
--- moodle/theme/standardold/style/mod_assignment.css Base (1.1)
+++ moodle/theme/standardold/style/mod_assignment.css Locally Modified (Based On 1.1)
@@ -28,6 +28,10 @@
   margin-right:20px;
 }
 
+#mod-assignment-submissions form#optionspref div {
+  text-align:right;
+  line-height: 30px;
+}
+
 .mod-assignment .feedback .files {
   float: right;
   background-color: #EFEFEF;
