Merged fixes for get_course_users from stable 1.4

This commit is contained in:
moodler
2004-09-08 15:46:43 +00:00
parent b25b9f2dce
commit 65ee9c16b3
2 changed files with 7 additions and 14 deletions
+3 -10
View File
@@ -32,13 +32,7 @@ function print_recent_selector_form($course, $advancedfilter=0, $selecteduser=0,
// Get all the possible users
$users = array();
if ($course->category) {
$courseusers = get_course_users($course->id);
} else {
$courseusers = get_site_users("u.lastaccess DESC", "u.id, u.firstname, u.lastname");
}
if ($courseusers) {
if ($courseusers = get_course_users($course->id, '', '', 'u.id, u.firstname, u.lastname')) {
foreach ($courseusers as $courseuser) {
$users[$courseuser->id] = fullname($courseuser, $isteacher);
}
@@ -266,9 +260,8 @@ function print_log_selector_form($course, $selecteduser=0, $selecteddate="today"
'WHERE us.course='.$course->id.' AND gm.groupid='.$selectedgroup.
' AND (gm.userid=us.userid OR gm.userid=ut.userid) AND gm.userid=u.id';
$courseusers = get_records_sql($sql);
}
else {
$courseusers = get_course_users($course->id);
} else {
$courseusers = get_course_users($course->id, '', '', 'u.id, u.firstname, u.lastname');
}
} else {
$courseusers = get_site_users("u.lastaccess DESC", "u.id, u.firstname, u.lastname");
+4 -4
View File
@@ -1295,7 +1295,7 @@ function get_course_teachers($courseid, $sort="t.authority ASC", $exceptions='')
*
* @param type description
*/
function get_course_users($courseid, $sort="timeaccess DESC", $exceptions='') {
function get_course_users($courseid, $sort="timeaccess DESC", $exceptions='', $fields='*') {
/// Using this method because the single SQL is too inefficient
// Note that this has the effect that teachers and students are
@@ -1304,7 +1304,7 @@ function get_course_users($courseid, $sort="timeaccess DESC", $exceptions='') {
if (!$teachers = get_course_teachers($courseid, $sort, $exceptions)) {
$teachers = array();
}
if (!$students = get_course_students($courseid, $sort, "", 0, 99999, "", "", NULL, "", '', $exceptions)) {
if (!$students = get_course_students($courseid, $sort, '', 0, 99999, '', '', NULL, '', $fields, $exceptions)) {
$students = array();
}
@@ -1394,9 +1394,9 @@ function search_users($courseid, $groupid, $searchtext, $sort='', $exceptions=''
*
* @param type description
*/
function get_site_users($sort="u.lastaccess DESC", $select="", $exceptions='') {
function get_site_users($sort="u.lastaccess DESC", $fields='*', $exceptions='') {
return get_course_users(SITEID, $sort, '', 0, 999999, '', '', NULL, '', $select, $exceptions);
return get_course_users(SITEID, $sort, $exceptions, $fields);
}