Function name change ... hope it doesn't break any third-party code,

sorry if it does!

  get_users_in_group --->  get_group_users

... to be more consistent with other functions

Also a new function:  get_group_students()
This commit is contained in:
moodler
2004-03-13 14:25:27 +00:00
parent a12f686b62
commit 60b025d1cc
+23 -1
View File
@@ -1492,7 +1492,7 @@ function get_groups($courseid, $userid=0) {
*
* @param type description
*/
function get_users_in_group($groupid, $sort="u.lastaccess DESC") {
function get_group_users($groupid, $sort="u.lastaccess DESC") {
global $CFG;
return get_records_sql("SELECT DISTINCT u.*
FROM {$CFG->prefix}user u,
@@ -1513,6 +1513,28 @@ function get_users_not_in_group($courseid) {
return array(); /// XXX TO BE DONE
}
/**
* Returns an array of user objects
*
* @param type description
*/
function get_group_students($groupid, $sort="u.lastaccess DESC") {
global $CFG;
return get_records_sql("SELECT DISTINCT u.*
FROM {$CFG->prefix}user u,
{$CFG->prefix}groups_members m,
{$CFG->prefix}groups g,
{$CFG->prefix}user_students s
WHERE m.groupid = '$groupid'
AND m.userid = u.id
AND m.groupid = g.id
AND g.courseid = s.course
AND s.userid = u.id
ORDER BY $sort");
}
/**
* Returns the user's group in a particular course
*