MDL-19052 fixed separate group mode access on grader report

This commit is contained in:
skodak
2009-05-04 13:12:09 +00:00
parent 4f7ee1cdcc
commit cd669edcc1
2 changed files with 14 additions and 3 deletions
+9 -2
View File
@@ -114,9 +114,18 @@ if (!empty($target) && !empty($action) && confirm_sesskey()) {
grade_report_grader::process_action($target, $action);
}
$reportname = get_string('modulename', 'gradereport_grader');
// Initialise the grader report object
$report = new grade_report_grader($courseid, $gpr, $context, $page, $sortitemid);
// make sure separate group does not prevent view
if ($report->currentgroup == -2) {
print_grade_page_head($COURSE->id, 'report', 'grader', $reportname, false, null, $buttons);
print_heading(get_string("notingroup"));
print_footer($course);
exit;
}
/// processing posted grades & feedback here
if ($data = data_submitted() and confirm_sesskey() and has_capability('moodle/grade:edit', $context)) {
$warnings = $report->process_data($data);
@@ -136,8 +145,6 @@ $numusers = $report->get_numusers();
$report->load_final_grades();
/// Print header
$reportname = get_string('modulename', 'gradereport_grader');
// Matt - removed stylesheet
print_grade_page_head($COURSE->id, 'report', 'grader', $reportname, false, null, $buttons);
echo $report->group_selector;
+5 -1
View File
@@ -301,8 +301,12 @@ class grade_report {
/// find out current groups mode
if ($this->groupmode = groups_get_course_groupmode($this->course)) {
$this->group_selector = groups_print_course_menu($this->course, $this->pbarurl, true);
$this->currentgroup = groups_get_course_group($this->course, true);
$this->group_selector = groups_print_course_menu($this->course, $this->pbarurl, true);
if ($this->groupmode == SEPARATEGROUPS and !$this->currentgroup and !has_capability('moodle/site:accessallgroups', $this->context)) {
$this->currentgroup = -2; // means can not accesss any groups at all
}
if ($this->currentgroup) {
$this->groupsql = " JOIN {$CFG->prefix}groups_members gm ON gm.userid = u.id ";