MDL-35665: Cherry-pick MDL-35389 : Fix an error when changing locked state of a assig...
authorRaymond Wijaya <raymond.wijaya@netspot.com.au>
Wed, 12 Sep 2012 08:33:54 +0000 (16:33 +0800)
committerRaymond Wijaya <raymond.wijaya@netspot.com.au>
Fri, 28 Sep 2012 04:30:30 +0000 (12:30 +0800)
mod/assign/lib.php

index 070dc50..74cfd3b 100644 (file)
@@ -757,7 +757,9 @@ function assign_get_user_grades($assign, $userid=0) {
     global $CFG;
     require_once($CFG->dirroot . '/mod/assign/locallib.php');
 
-    $assignment = new assign(null, null, null);
+    $cm = get_coursemodule_from_instance('assign', $assign->id, 0, false, MUST_EXIST);
+    $context = context_module::instance($cm->id);
+    $assignment = new assign($context, null, null);
     $assignment->set_instance($assign);
     return $assignment->get_user_grades_for_gradebook($userid);
 }