Merge branch 'MDL-30350-master-1' of git://git.luns.net.uk/moodle
[moodle.git] / mod / assignment / lib.php
index a7d50d9..a65441f 100644 (file)
@@ -769,9 +769,16 @@ class assignment_base {
                 $offset = required_param('offset', PARAM_INT);
                 $nextid = required_param('nextid', PARAM_INT);
                 $id = required_param('id', PARAM_INT);
-                $offset = (int)$offset+1;
-                //$this->display_submission($offset+1 , $nextid);
-                redirect('submissions.php?id='.$id.'&userid='. $nextid . '&mode=single&offset='.$offset);
+                $filter = optional_param('filter', self::FILTER_ALL, PARAM_INT);
+
+                if ($mode == 'next' || $filter !== self::FILTER_REQUIRE_GRADING) {
+                    $offset = (int)$offset+1;
+                }
+                $redirect = new moodle_url('submissions.php',
+                        array('id' => $id, 'offset' => $offset, 'userid' => $nextid,
+                        'mode' => 'single', 'filter' => $filter));
+
+                redirect($redirect);
                 break;
 
             case 'singlenosave':
@@ -3546,7 +3553,7 @@ function assignment_get_coursemodule_info($coursemodule) {
         }
         if ($coursemodule->showdescription) {
             // Convert intro to html. Do not filter cached version, filters run at display time.
-            $info->content = format_module_intro('assignment', $assignment, $coursemodule->id, false);
+            $result->content = format_module_intro('assignment', $assignment, $coursemodule->id, false);
         }
         return $result;
     } else {