MDL-30144 Assignmnet 2.2: fixed context retrival
[moodle.git] / mod / assignment / lib.php
index 7b9f9aa..7bd8064 100644 (file)
@@ -3574,7 +3574,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.*