MDL-30144 Assignmnet 2.2: fixed context retrival
authorRajesh Taneja <rajesh@moodle.com>
Wed, 6 Feb 2013 04:36:25 +0000 (12:36 +0800)
committerDan Poltawski <dan@moodle.com>
Wed, 6 Feb 2013 05:22:27 +0000 (13:22 +0800)
mod/assignment/lib.php

index 6544c0e..c605f01 100644 (file)
@@ -3553,7 +3553,8 @@ function assignment_get_all_submissions($assignment, $sort="", $dir="DESC") {
     if ($assignment->course == SITEID) {
         $select = '';
     }*/
-    $context = context_module::instance($assignment->id);
+    $cm = get_coursemodule_from_instance('assignment', $assignment->id, $assignment->course);
+    $context = context_module::instance($cm->id);
     list($enroledsql, $params) = get_enrolled_sql($context, 'mod/assignment:submit');
     $params['assignmentid'] = $assignment->id;
     return $DB->get_records_sql("SELECT a.*