forked from tmuras/moodle
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MDL-12101 cleanup/fixing/refactoring of user bulk operation and admin…
… user browsing
- Loading branch information
skodak
committed
Nov 13, 2007
1 parent
4fc9ec1
commit cd1edf9
Showing
32 changed files
with
1,374 additions
and
1,324 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
<?php //$Id$ | ||
|
||
require_once($CFG->dirroot.'/user/filters/lib.php'); | ||
|
||
if (!defined('MAX_BULK_USERS')) { | ||
define('MAX_BULK_USERS', 2000); | ||
} | ||
|
||
function add_selection_all($ufiltering) { | ||
global $SESSION; | ||
|
||
$guest = get_guest(); | ||
$sqlwhere = $ufiltering->get_sql_filter("id<>{$guest->id} AND deleted <> 1"); | ||
|
||
if ($rs = get_recordset_select('user', $sqlwhere, 'fullname', 'id,'.sql_fullname().' AS fullname')) { | ||
while ($user = rs_fetch_next_record($rs)) { | ||
if (!in_array($user->id, $SESSION->bulk_users)) { | ||
$SESSION->bulk_users[] = $user->id; | ||
} | ||
} | ||
rs_close($rs); | ||
} | ||
} | ||
|
||
function get_selection_data($ufiltering) { | ||
global $SESSION; | ||
|
||
// get the SQL filter | ||
$guest = get_guest(); | ||
$sqlwhere = $ufiltering->get_sql_filter("id<>{$guest->id} AND deleted <> 1"); | ||
|
||
$total = count_records_select('user', "id<>{$guest->id} AND deleted <> 1"); | ||
$acount = count_records_select('user', $sqlwhere); | ||
$scount = count($SESSION->bulk_users); | ||
|
||
$userlist = array('acount'=>$acount, 'scount'=>$scount, 'ausers'=>false, 'susers'=>false, 'total'=>$total); | ||
$userlist['ausers'] = get_records_select_menu('user', $sqlwhere, 'fullname', 'id,'.sql_fullname().' AS fullname', 0, MAX_BULK_USERS); | ||
|
||
if ($scount) { | ||
if ($scount < MAX_BULK_USERS) { | ||
$in = implode(',', $SESSION->bulk_users); | ||
} else { | ||
$bulkusers = array_slice($SESSION->bulk_users, 0, MAX_BULK_USERS); | ||
$in = implode(',', $bulkusers); | ||
} | ||
$userlist['susers'] = get_records_select_menu('user', "id IN ($in)", 'fullname', 'id,'.sql_fullname().' AS fullname'); | ||
} | ||
|
||
return $userlist; | ||
} | ||
|
||
|
||
?> |
Oops, something went wrong.