3 require_once($CFG->dirroot
.'/user/filters/lib.php');
5 if (!defined('MAX_BULK_USERS')) {
6 define('MAX_BULK_USERS', 2000);
9 function add_selection_all($ufiltering) {
10 global $SESSION, $DB, $CFG;
12 list($sqlwhere, $params) = $ufiltering->get_sql_filter("id<>:exguest AND deleted <> 1", array('exguest'=>$CFG->siteguest
));
14 $rs = $DB->get_recordset_select('user', $sqlwhere, $params, 'fullname', 'id,'.$DB->sql_fullname().' AS fullname');
15 foreach ($rs as $user) {
16 if (!isset($SESSION->bulk_users
[$user->id
])) {
17 $SESSION->bulk_users
[$user->id
] = $user->id
;
23 function get_selection_data($ufiltering) {
24 global $SESSION, $DB, $CFG;
27 list($sqlwhere, $params) = $ufiltering->get_sql_filter("id<>:exguest AND deleted <> 1", array('exguest'=>$CFG->siteguest
));
29 $total = $DB->count_records_select('user', "id<>:exguest AND deleted <> 1", array('exguest'=>$CFG->siteguest
));
30 $acount = $DB->count_records_select('user', $sqlwhere, $params);
31 $scount = count($SESSION->bulk_users
);
33 $userlist = array('acount'=>$acount, 'scount'=>$scount, 'ausers'=>false, 'susers'=>false, 'total'=>$total);
34 $userlist['ausers'] = $DB->get_records_select_menu('user', $sqlwhere, $params, 'fullname', 'id,'.$DB->sql_fullname().' AS fullname', 0, MAX_BULK_USERS
);
37 if ($scount < MAX_BULK_USERS
) {
38 $bulkusers = $SESSION->bulk_users
;
40 $bulkusers = array_slice($SESSION->bulk_users
, 0, MAX_BULK_USERS
, true);
42 list($in, $inparams) = $DB->get_in_or_equal($bulkusers);
43 $userlist['susers'] = $DB->get_records_select_menu('user', "id $in", $inparams, 'fullname', 'id,'.$DB->sql_fullname().' AS fullname');