Skip to content
Browse files

MDL-30144 Assignment 2.2: Download all as zip should only contain sub…

…mission from active enroled users
  • Loading branch information...
1 parent 1a5f2cf commit ac3fe66f069af0ec058b90dd5d4a4f46e799cd1f @mhughes2k mhughes2k committed with danpoltawski Feb 1, 2013
Showing with 7 additions and 4 deletions.
  1. +7 −4 mod/assignment/lib.php
View
11 mod/assignment/lib.php
@@ -3553,12 +3553,15 @@ function assignment_get_all_submissions($assignment, $sort="", $dir="DESC") {
if ($assignment->course == SITEID) {
$select = '';
}*/
-
+ $context = context_module::instance($assignment->id);
+ list($enroledsql, $params) = get_enrolled_sql($context, 'mod/assignment:submit');
+ $params['assignmentid'] = $assignment->id;
return $DB->get_records_sql("SELECT a.*
- FROM {assignment_submissions} a, {user} u
+ FROM {assignment_submissions} a
+ INNER JOIN (". $enroledsql .") u ON u.id = a.userid
WHERE u.id = a.userid
- AND a.assignment = ?
- ORDER BY $sort", array($assignment->id));
+ AND a.assignment = :assignmentid
+ ORDER BY $sort", $params);
}

0 comments on commit ac3fe66

Please sign in to comment.
Something went wrong with that request. Please try again.