merged fix for MDL-9185

This commit is contained in:
toyomoyo 2007-04-04 04:05:53 +00:00
parent 11cc8e64a6
commit 2d7617c67f
4 changed files with 102 additions and 9 deletions

View file

@ -15,13 +15,14 @@
require_login($course->id);
/*
if (has_capability('moodle/site:accessallgroups', get_context_instance(CONTEXT_COURSE, $course->id))) {
$group = get_and_set_current_group($course, $course->groupmode, $group);
} else {
$group = get_current_group($course->id);
}
*/
// if the user set new prefs make sure they happen now
if ($action == 'set_grade_preferences' && $prefs = data_submitted()) {
if (!confirm_sesskey()) {
@ -49,9 +50,30 @@
}
print_header($course->shortname.': '.get_string('grades'), $course->fullname, grade_nav($course, $action));
grade_preferences_menu($action, $course, $group);
/// copied code from assignment module, if this is not the way to do this please change it
/// the above code does not work
/// set_and_print_groups() is not fully implemented as function groups_instance_print_grouping_selector()
/// and function groups_instance_print_group_selector() are missing.
$context = get_context_instance(CONTEXT_COURSE, $course->id);
$changegroup = optional_param('group', -1, PARAM_INT); // choose the current group
$groupmode = groupmode($course);
$currentgroup = get_and_set_current_group($course, $groupmode, $changegroup);
/// Now we need a menu for separategroups as well!
if ($groupmode == VISIBLEGROUPS || ($groupmode
&& has_capability('moodle/site:accessallgroups', $context))) {
//the following query really needs to change
if ($groups = groups_get_groups_names($course->id)) { //TODO:
print_box_start('groupmenu');
print_group_menu($groups, $groupmode, $currentgroup, 'index.php?id='.$course->id);
print_box_end(); // groupmenu
}
}
grade_set_uncategorized();
if (has_capability('moodle/course:viewcoursegrades', get_context_instance(CONTEXT_COURSE, $course->id))) {