MDL-14978 removed obsoleted get_site_users()

This commit is contained in:
skodak 2008-05-25 11:18:12 +00:00
parent 0b2e23c4eb
commit 79eaec48cd
2 changed files with 9 additions and 21 deletions

View File

@ -51,7 +51,8 @@ function print_mnet_log_selector_form($hostid, $course, $selecteduser=0, $select
if ($hostid == $CFG->mnet_localhost_id && $course->id != SITEID) {
$courseusers = get_users_by_capability($context, 'moodle/course:view', '', 'lastname ASC, firstname ASC', '','u.id, u.firstname, u.lastname, u.idnumber',$selectedgroup,null, false);
} else {
$courseusers = get_site_users("u.lastaccess DESC", "u.id, u.firstname, u.lastname, u.idnumber");
// this may be a lot of users :-(
$courseusers = $DB->get_records('user', array('deleted'=>0), 'u.lastaccess DESC', 'u.id, u.firstname, u.lastname, u.idnumber');
}
if (count($courseusers) < COURSE_MAX_USERS_PER_DROPDOWN && !$showusers) {
@ -274,7 +275,7 @@ function print_mnet_log_selector_form($hostid, $course, $selecteduser=0, $select
function print_log_selector_form($course, $selecteduser=0, $selecteddate='today',
$modname="", $modid=0, $modaction='', $selectedgroup=-1, $showcourses=0, $showusers=0, $logformat='showashtml') {
global $USER, $CFG;
global $USER, $CFG, $DB;
// first check to see if we can override showcourses and showusers
$numcourses = count_records_select("course", "", "COUNT(id)");
@ -305,7 +306,8 @@ function print_log_selector_form($course, $selecteduser=0, $selecteddate='today'
if ($course->id != SITEID) {
$courseusers = get_users_by_capability($context, 'moodle/course:view', '', 'lastname ASC, firstname ASC', '','u.id, u.firstname, u.lastname, u.idnumber',$selectedgroup,null, false);
} else {
$courseusers = get_site_users("u.lastaccess DESC", "u.id, u.firstname, u.lastname, u.idnumber");
// this may be a lot of users :-(
$courseusers = $DB->get_records('user', array('deleted'=>0), 'u.lastaccess DESC', 'u.id, u.firstname, u.lastname, u.idnumber');
}
if (count($courseusers) < COURSE_MAX_USERS_PER_DROPDOWN && !$showusers) {

View File

@ -73,7 +73,7 @@ function isteacher($courseid=0, $userid=0, $obsolete_includeadmin=true) {
* @return bool
*/
function isteacherinanycourse($userid=0, $includeadmin=true) {
global $USER, $CFG;
global $USER, $CFG, $DB;
if (empty($CFG->rolesactive)) { // Teachers are locked out during an upgrade to 1.7
return false;
@ -86,14 +86,14 @@ function isteacherinanycourse($userid=0, $includeadmin=true) {
$userid = $USER->id;
}
if (!record_exists('role_assignments', 'userid', $userid)) { // Has no roles anywhere
if (!$DB->record_exists('role_assignments', array('userid'=>$userid))) { // Has no roles anywhere
return false;
}
/// If this user is assigned as an editing teacher anywhere then return true
if ($roles = get_roles_with_capability('moodle/legacy:editingteacher', CAP_ALLOW)) {
foreach ($roles as $role) {
if (record_exists('role_assignments', 'roleid', $role->id, 'userid', $userid)) {
if ($DB->record_exists('role_assignments', array('roleid'=>$role->id, 'userid'=>$userid))) {
return true;
}
}
@ -102,7 +102,7 @@ function isteacherinanycourse($userid=0, $includeadmin=true) {
/// If this user is assigned as a non-editing teacher anywhere then return true
if ($roles = get_roles_with_capability('moodle/legacy:teacher', CAP_ALLOW)) {
foreach ($roles as $role) {
if (record_exists('role_assignments', 'roleid', $role->id, 'userid', $userid)) {
if ($DB->record_exists('role_assignments', array('roleid'=>$role->id, 'userid'=>$userid))) {
return true;
}
}
@ -242,20 +242,6 @@ function get_course_users($courseid, $sort='ul.timeaccess DESC', $exceptions='',
}
/**
* Returns a list of all site users
* Obsolete, just calls get_course_users(SITEID)
*
* @uses SITEID
* @deprecated Use {@link get_course_users()} instead.
* @param string $fields A comma separated list of fields to be returned from the chosen table.
* @return object|false {@link $USER} records or false if error.
*/
function get_site_users($sort='u.lastaccess DESC', $fields='*', $exceptions='') {
return get_course_users(SITEID, $sort, $exceptions, $fields);
}
########### FROM weblib.php ##########################################################################