Skip to content

Commit

Permalink
Merge branch 'w27_MDL-34036_m24_bulkrole' of git://github.com/skodak/…
Browse files Browse the repository at this point in the history
…moodle
  • Loading branch information
danpoltawski committed Jul 3, 2012
2 parents 78e43b8 + 66c528d commit 606319c
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions user/filters/courserole.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ function check_data($formdata) {
function get_sql_filter($data) {
global $CFG, $DB;
static $counter = 0;
$name = 'ex_courserole'.$counter++;
$pref = 'ex_courserole'.($counter++).'_';

$value = $data['value'];
$roleid = $data['roleid'];
Expand All @@ -98,17 +98,16 @@ function get_sql_filter($data) {

$where = "b.contextlevel=50";
if ($roleid) {
$where .= " AND a.roleid = :roleid";
$params['roleid'] = $roleid;

$where .= " AND a.roleid = :{$pref}roleid";
$params[$pref.'roleid'] = $roleid;
}
if ($categoryid) {
$where .= " AND c.category = :categoryid";
$params['categoryid'] = $categoryid;
$where .= " AND c.category = :{$pref}categoryid";
$params[$pref.'categoryid'] = $categoryid;
}
if ($value) {
$where .= " AND c.shortname = :$name";
$params[$name] = $value;
$where .= " AND c.shortname = :{$pref}course";
$params[$pref.'course'] = $value;
}
return array("id IN (SELECT userid
FROM {role_assignments} a
Expand Down

0 comments on commit 606319c

Please sign in to comment.