I added a couple more patches to get it to work with the Grade All link. This is the entire patch of the file /mod/quiz/report/grading/report.php
========================================================
function display if (!empty($questionid)) {
//prints the selector menu
$userid = optional_param('userid', -1, PARAM_INT); //keeps it off of the grading page for one user
if($userid<0){
$reporturl = $CFG->wwwroot.'/mod/quiz/report.php?mode=grading';
$reporturlwithoptions = $reporturl . '&q=' . $quiz->id . '&action='.$action.'&questionid=' . $questionid;
$gradeall = optional_param('gradeall', 0, PARAM_INT);
if($gradeall>0)
$reporturlwithoptions .= '&gradeall=1';
/// find out current groups mode
$this->currentgroup = groups_get_activity_group($cm, true); //$currentgroup should be a class variable added. will use again later
if ($groupmode = groups_get_activity_groupmode($cm)) { // Groups are being used
groups_print_activity_menu($cm, $reporturlwithoptions);
}
}
========================================================
function view_questions - before if($attempts = get_record_select.......
//sets up the users based on the active group. If active group is all (0) or not set, shows all participants.
$groupid = optional_param('group', -1, PARAM_INT);
if($groupid>0)
$this->currentgroup=$groupid;
if($this->currentgroup>0){
$users = groups_get_members($this->currentgroup, $fields='u.id', $sort='firstname ASC');
$userids = implode(',', array_keys($users));
}
========================================================
function view_question - just before $usercount = count($users)
//same code as previous one, sets up users again based on group
$groupid = optional_param('group', -1, PARAM_INT);
$groupslink='';
if($groupid>0)
$this->currentgroup=$groupid;
if($this->currentgroup>0){
$users = groups_get_members($this->currentgroup, $fields='u.id', $sort='firstname ASC');
$userids = implode(',', array_keys($users));
$groupslink = '&group=$this->currentgroup';
}
=================================
function view_question - replace $table->define_baseurl($CFG->wwwroot.'/mod/quiz/report.php?mode=grading&q='.$quiz->id.'&action=viewquestion&questionid='.$question->id);
with
$table->define_baseurl($CFG->wwwroot.'/mod/quiz/report.php?mode=grading&q='.$quiz->id.'&action=viewquestion&questionid='.$question->id$groupslink);
===================================
function view_question replace
$links = "<div class=\"boxaligncenter\"><a href=\"report.php?mode=grading&action=grade&q=$quiz->id&questionid=$question->id&gradeall=1\">".get_string('gradeall', 'quiz').'</a> | '.
with
$links = "<div class=\"boxaligncenter\"><a href=\"report.php?mode=grading&action=grade&q=$quiz->id&questionid=$question->id$groupslink&gradeall=1\">".get_string('gradeall', 'quiz').'</a> | '.
==============================================
function print_questions_and_form - before first $select =
//setup users again - same code (should probably be a function b/c it's used a lot) - implement groupslink when needed, but otherwise the same code
$groupid = optional_param('group', -1, PARAM_INT);
if($groupid>0)
$this->currentgroup=$groupid;
if($this->currentgroup>0){ $users = groups_get_members($this->currentgroup, $fields='u.id', $sort='firstname ASC'); $userids = implode(',', array_keys($users)); }
}
========================================================
I hope this patch helps move along the process of groups in quizzes. Let me know if you have any questions. I had to modify some of my patch code to fit core, as I'm using a patcher written by Gary Anderson to patch our local version, so if something's off or doesn't work let me know.
Thanks,
Karlene
Thank you very much for the proposed fix. I am really busy right now, so I probably won't have time to look at it until after Christmas, but it was already on my list of things to worry about, as you can see from the duplicate bug.