$groups = groups_groupids_to_groups(groups_get_groups($course->id), $course->id); $groupsmode = $course->groupmode; $currentgroup = $selgroup; $urlroot = $CFG->wwwroot . '/email/contacts/list.php?id=' . $course->id; $showall = 1; echo '<br/>'; print_group_menu($groups, $groupsmode, $currentgroup, $urlroot, $showall); } else { // Prints only groups current user is a participant of $usergroups = groups_get_groups_for_user($USER->id, $course->id); // Shows a Show all users to users in multiple groups $showall = 0; if (count($usergroups) > 1) { $showall = 1; } $usergroups = groups_groupids_to_groups($usergroups, $course->id); $urlroot = $CFG->wwwroot . '/email/contacts/list.php?id=' . $course->id; echo '<br/>'; print_group_menu($usergroups, $course->groupmode, $selgroup, $urlroot, $showall); } } //--------- l'frame echo '<hr />'; echo '<div id="search_res"></div>' . '<iframe id="idsearch" name="bssearch" src="search.php?id=' . $id . '&pop=si&group=' . $selgroup . '" style="display:none;"></iframe>' . "\n\n"; // '<iframe id="idsearch" name="isearch" src="search.php?id='.$cm->id.'&cid='.$course->id.'" style="display:none;"></iframe>'; ?> <script type="text/javascript" language="JavaScript" > <!-- // Non-Static Javascript functions // This function checks all added users and enables the remove user if they have // already been added to the email
/** * Returns the user's group in a particular course * * @uses $CFG * @param int $courseid The course in question. * @param int $userid The id of the user as found in the 'user' table. * @param int $groupid The id of the group the user is in. * @return object */ function user_group($courseid, $userid) { $groupids = groups_get_groups_for_user($userid, $courseid); return groups_groupids_to_groups($groupids); }