Permalink
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 1918a24 commit 127d66f183ade4b7ad04a1b3d423106dea4d24a0 @mhughes2k mhughes2k committed with Rajesh Taneja Feb 1, 2013
Showing with 7 additions and 4 deletions.
  1. +7 −4 mod/assignment/lib.php
View
@@ -3574,12 +3574,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 127d66f

Please sign in to comment.