MDL-36804 Assign: Fix undeclared global $USER and undefined variable $userid
authorDamyon Wiese <damyon@moodle.com>
Tue, 2 Apr 2013 05:44:25 +0000 (13:44 +0800)
committerDamyon Wiese <damyon@moodle.com>
Tue, 2 Apr 2013 05:44:25 +0000 (13:44 +0800)
mod/assign/locallib.php

index 08cabe2..4dee4b8 100644 (file)
@@ -3479,7 +3479,7 @@ class assign {
      * @return array $submissions All submission records for this user (or group).
      */
     protected function get_all_submissions($userid) {
      * @return array $submissions All submission records for this user (or group).
      */
     protected function get_all_submissions($userid) {
-        global $DB;
+        global $DB, $USER;
 
         // If the userid is not null then use userid.
         if (!$userid) {
 
         // If the userid is not null then use userid.
         if (!$userid) {
@@ -5495,7 +5495,7 @@ class assign {
                 $gradebookgrade = null;
                 if (isset($gradinginfo->items[0])) {
                     $gradingitem = $gradinginfo->items[0];
                 $gradebookgrade = null;
                 if (isset($gradinginfo->items[0])) {
                     $gradingitem = $gradinginfo->items[0];
-                    $gradebookgrade = $gradingitem->grades[$user->id];
+                    $gradebookgrade = $gradingitem->grades[$userid];
                 }
                 if ($gradebookgrade && !$gradebookgrade->is_passed($gradingitem)) {
                     $shouldreopen = true;
                 }
                 if ($gradebookgrade && !$gradebookgrade->is_passed($gradingitem)) {
                     $shouldreopen = true;