From: moodler Date: Sun, 15 Feb 2004 07:18:07 +0000 (+0000) Subject: Use the new short way of setting up groups X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=424aef6aef1f9504489f54250cb34d0039f60845;p=moodle.git Use the new short way of setting up groups --- diff --git a/mod/assignment/submissions.php b/mod/assignment/submissions.php index 15d02c328b..0d7f626db4 100644 --- a/mod/assignment/submissions.php +++ b/mod/assignment/submissions.php @@ -40,35 +40,13 @@ id\">$assignment->name -> $strsubmissions", "", "", true); -/// Check to see if groups are being used in this forum -/// and if so, set $currentgroup to reflect the current group - - $groupmode = groupmode($course, $cm); // Groups are being used - $currentgroup = get_and_set_current_group($course, $groupmode, $_GET['group']); - - if (!isteacheredit($course->id) and $groupmode and !$currentgroup) { - print_heading("Sorry, but you can't see this group"); - print_footer(); - exit; - } - - if ($groupmode == VISIBLEGROUPS or ($groupmode and isteacheredit($course->id))) { - if ($groups = get_records_menu("groups", "courseid", $course->id, "name ASC", "id,name")) { - echo '
'; - if ($groupmode == VISIBLEGROUPS) { - print_string('groupsvisible'); - } else { - print_string('groupsseparate'); - } - echo ':'; - echo ''; - popup_form("submissions.php?id=$assignment->id&sort=$sort&dir=$dir&group=", - $groups, 'selectgroup', $currentgroup, "", "", "", false, "self"); - echo '
'; - } +/// Check to see if groups are being used in this assignment + if ($groupmode = groupmode($course, $cm)) { // Groups are being used + $currentgroup = setup_and_print_groups($course, $groupmode, "submissions.php?id=$assignment->id&sort=$sort&dir=$dir"); + } else { + $currentgroup = false; } - /// Get all teachers and students $teachers = get_course_teachers($course->id); @@ -163,7 +141,6 @@ // Submission sorting - $sorttypes = array('firstname', 'lastname', 'timemodified', 'grade'); print_simple_box_start("center", "50%"); diff --git a/mod/journal/report.php b/mod/journal/report.php index 34372bcf15..7c83c4a5e3 100644 --- a/mod/journal/report.php +++ b/mod/journal/report.php @@ -45,34 +45,12 @@ /// Check to see if groups are being used in this journal -/// and if so, set $currentgroup to reflect the current group - - $groupmode = groupmode($course, $cm); // Groups are being used - $currentgroup = get_and_set_current_group($course, $groupmode, $_GET['group']); - - if (!isteacheredit($course->id) and $groupmode and !$currentgroup) { - print_heading("Sorry, but you can't see this group"); - print_footer(); - exit; - } - - if ($groupmode == VISIBLEGROUPS or ($groupmode and isteacheredit($course->id))) { - if ($groups = get_records_menu("groups", "courseid", $course->id, "name ASC", "id,name")) { - echo '
'; - if ($groupmode == VISIBLEGROUPS) { - print_string('groupsvisible'); - } else { - print_string('groupsseparate'); - } - echo ':'; - echo ''; - popup_form("report.php?id=$cm->id&sort=$sort&dir=$dir&group=", - $groups, 'selectgroup', $currentgroup, "", "", "", false, "self"); - echo '
'; - } + if ($groupmode = groupmode($course, $cm)) { // Groups are being used + $currentgroup = setup_and_print_groups($course, $groupmode, "report.php?id=$cm->id"); + } else { + $currentgroup = false; } - /// Process incoming data if there is any if ($data = data_submitted()) { diff --git a/mod/quiz/report/overview/report.php b/mod/quiz/report/overview/report.php index 79e0652ff7..073cfc598d 100644 --- a/mod/quiz/report/overview/report.php +++ b/mod/quiz/report/overview/report.php @@ -68,34 +68,12 @@ class quiz_report extends quiz_default_report { } /// Check to see if groups are being used in this quiz - /// and if so, set $currentgroup to reflect the current group - - $groupmode = groupmode($course, $cm); // Groups are being used - $currentgroup = get_and_set_current_group($course, $groupmode, $_GET['group']); - - if ($groupmode and !$currentgroup and !isteacheredit($course->id)) { - print_heading("Sorry, but you can't see this group"); - print_footer(); - exit; + if ($groupmode = groupmode($course, $cm)) { // Groups are being used + $currentgroup = setup_and_print_groups($course, $groupmode, "report.php?id=$cm->id&mode=overview"); + } else { + $currentgroup = false; } - if ($groupmode == VISIBLEGROUPS or ($groupmode and isteacheredit($course->id))) { - if ($groups = get_records_menu("groups", "courseid", $course->id, "name ASC", "id,name")) { - echo '
'; - if ($groupmode == VISIBLEGROUPS) { - print_string('groupsvisible'); - } else { - print_string('groupsseparate'); - } - echo ':'; - echo ''; - popup_form("report.php?id=$cm->id&mode=overview&group=", - $groups, 'selectgroup', $currentgroup, "", "", "", false, "self"); - echo '
'; - } - } - - /// Get all teachers and students if ($currentgroup) { $users = get_users_in_group($currentgroup); diff --git a/mod/quiz/report/simplestat/report.php b/mod/quiz/report/simplestat/report.php index 2d2c5b997b..b5ca2c3480 100644 --- a/mod/quiz/report/simplestat/report.php +++ b/mod/quiz/report/simplestat/report.php @@ -12,34 +12,12 @@ class quiz_report extends quiz_default_report { optional_variable($download, ""); /// Check to see if groups are being used in this quiz - /// and if so, set $currentgroup to reflect the current group - - $groupmode = groupmode($course, $cm); // Groups are being used - $currentgroup = get_and_set_current_group($course, $groupmode, $_GET['group']); - - if ($groupmode and !$currentgroup and !isteacheredit($course->id)) { - print_heading("Sorry, but you can't see this group"); - print_footer(); - exit; - } - - if ($groupmode == VISIBLEGROUPS or ($groupmode and isteacheredit($course->id))) { - if ($groups = get_records_menu("groups", "courseid", $course->id, "name ASC", "id,name")) { - echo '
'; - if ($groupmode == VISIBLEGROUPS) { - print_string('groupsvisible'); - } else { - print_string('groupsseparate'); - } - echo ':'; - echo ''; - popup_form("report.php?id=$cm->id&mode=simplestat&group=", - $groups, 'selectgroup', $currentgroup, "", "", "", false, "self"); - echo '
'; - } + if ($groupmode = groupmode($course, $cm)) { // Groups are being used + $currentgroup = setup_and_print_groups($course, $groupmode, "report.php?id=$cm->id&mode=simplestat"); + } else { + $currentgroup = false; } - if ($currentgroup) { $users = get_users_in_group($currentgroup, "u.lastname ASC"); } else {