Merge branch 'MDL-30350-master-1' of git://git.luns.net.uk/moodle
authorAparup Banerjee <aparup@moodle.com>
Thu, 8 Dec 2011 06:19:46 +0000 (14:19 +0800)
committerAparup Banerjee <aparup@moodle.com>
Thu, 8 Dec 2011 06:19:46 +0000 (14:19 +0800)
1  2 
mod/assignment/lib.php

diff --combined mod/assignment/lib.php
@@@ -769,16 -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':
                  $currentposition = 0;
                  foreach ($ausers as $auser) {
                      if ($currentposition == $offset && $offset < $endposition) {
+                         $rowclass = null;
                          $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);
                          ///attach file or print link to student answer, depending on the type of the assignment.
                          ///Refer to print_student_answer in inherited classes.
                              if ($auser->timemodified > 0) {
-                                 $studentmodified = '<div id="ts'.$auser->id.'">'.$this->print_student_answer($auser->id)
-                                                  . userdate($auser->timemodified).'</div>';
+                                 $studentmodifiedcontent = $this->print_student_answer($auser->id)
+                                         . userdate($auser->timemodified);
+                                 if ($assignment->timedue && $auser->timemodified > $assignment->timedue) {
+                                     $studentmodifiedcontent .= assignment_display_lateness($auser->timemodified, $assignment->timedue);
+                                     $rowclass = 'late';
+                                 }
                              } else {
-                                 $studentmodified = '<div id="ts'.$auser->id.'">&nbsp;</div>';
+                                 $studentmodifiedcontent = '&nbsp;';
                              }
+                             $studentmodified = html_writer::tag('div', $studentmodifiedcontent, array('id' => 'ts' . $auser->id));
                          ///Print grade, dropdown or text
                              if ($auser->timemarked > 0) {
                                  $teachermodified = '<div id="tt'.$auser->id.'">'.userdate($auser->timemarked).'</div>';
                          if ($uses_outcomes) {
                              $row[] = $outcomes;
                          }
-                         $table->add_data($row);
+                         $table->add_data($row, $rowclass);
                      }
                      $currentposition++;
                  }
@@@ -3547,7 -3546,7 +3553,7 @@@ function assignment_get_coursemodule_in
          }
          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 {