Groups support for choice module

This commit is contained in:
moodler 2004-02-15 08:17:45 +00:00
parent 52f1b49620
commit b6ee2d82ea
2 changed files with 33 additions and 4 deletions

View File

@ -34,9 +34,23 @@
<a href=\"index.php?id=$course->id\">$strchoices</a> ->
<a href=\"view.php?id=$cm->id\">$choice->name</a> -> $strresponses", "");
/// Check to see if groups are being used in this choice
if ($groupmode = groupmode($course, $cm)) { // Groups are being used
$currentgroup = setup_and_print_groups($course, $groupmode, "report.php?id=$cm->id");
} else {
$currentgroup = false;
}
if (! $users = get_course_users($course->id, "u.firstname ASC")) {
error("No users found (very strange)");
if ($currentgroup) {
$users = get_users_in_group($currentgroup, "u.firstname ASC");
} else {
$users = get_course_users($course->id, "u.firstname ASC");
}
if (!$users) {
print_heading(get_string("nousersyet"));
print_footer($course);
exit;
}
if ( $allanswers = get_records("choice_answers", "choice", $choice->id)) {

View File

@ -70,6 +70,13 @@
"$navigation <A HREF=index.php?id=$course->id>$strchoices</A> -> $choice->name", "", "", true,
update_module_button($cm->id, $course->id, $strchoice), navmenu($course, $cm));
/// Check to see if groups are being used in this choice
if ($groupmode = groupmode($course, $cm)) { // Groups are being used
$currentgroup = setup_and_print_groups($course, $groupmode, "view.php?id=$cm->id");
} else {
$currentgroup = false;
}
if (isteacher($course->id)) {
if ( $allanswers = get_records("choice_answers", "choice", $choice->id)) {
$responsecount = count($allanswers);
@ -107,8 +114,16 @@
print_heading(get_string("responses", "choice"));
if (! $users = get_course_users($course->id, "u.firstname ASC")) {
error("No users found (very strange)");
if ($currentgroup) {
$users = get_users_in_group($currentgroup, "u.firstname ASC");
} else {
$users = get_course_users($course->id, "u.firstname ASC");
}
if (!$users) {
print_heading(get_string("nousersyet"));
print_footer($course);
exit;
}
if ( $allanswers = get_records("choice_answers", "choice", $choice->id)) {