2 /**********************************************
3 * Gets the users registered for a course that
4 * don't belong to a specified group and prints
5 * their detailsin an XML format.
6 **********************************************/
8 require_once('../../config.php');
9 require_once('../lib/lib.php');
11 @header
('Content-Type: text/xml; charset=utf-8');
12 echo '<?xml version="1.0" encoding="utf-8"?>';
13 echo '<groupsresponse>';
15 $groupid = required_param('groupid', PARAM_INT
);
16 $groupingid = required_param('groupingid', PARAM_INT
);
17 $courseid = required_param('courseid', PARAM_INT
);
18 $showall = required_param('showall', PARAM_INT
);
20 require_login($courseid);
22 if (confirm_sesskey() and isteacheredit($courseid)) {
23 echo "$groupingid $groupid";
25 $userids = groups_get_users_not_in_any_group_in_grouping($courseid,$groupingid, $groupid);
27 $userids = groups_get_users_not_in_group($courseid, $groupid);
30 if ($userids != false) {
31 // Put the groupings into a hash and sorts them
32 foreach($userids as $userid) {
33 $listmembers[$userid] = groups_get_user_displayname($userid, $courseid);
35 natcasesort($listmembers);
40 foreach($listmembers as $value=>$name) {
41 echo "<name>$name</name>";
42 echo "<value>$value</value>";
48 echo '</groupsresponse>';