diff --git a/mod/journal/report.php b/mod/journal/report.php index fbe7d7b2b31..34372bcf15e 100644 --- a/mod/journal/report.php +++ b/mod/journal/report.php @@ -43,6 +43,37 @@ id\">$strjournals -> id\">$journal->name -> $strentries", "", "", true); + +/// 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 ' |