if (isset($options->questioncommentlink) && $context && has_capability('mod/quiz:grade', $context)) {
$strcomment = get_string('commentorgrade', 'quiz');
- $commentlink = '<div class="commentlink">'.link_to_popup_window ($options->questioncommentlink.'?attempt='.$state->attempt.'&question='.$question->id,
+ $question_to_comment = isset($question->randomquestionid) ? $question->randomquestionid : $question->id;
+ $commentlink = '<div class="commentlink">'.link_to_popup_window ($options->questioncommentlink.'?attempt='.$state->attempt.'&question='.$question_to_comment,
'commentquestion', $strcomment, 450, 650, $strcomment, 'none', true).'</div>';
}
function print_question(&$question, &$state, &$number, $cmoptions, $options) {
global $QTYPES;
$wrappedquestion = &$state->options->question;
+ $wrappedquestion->randomquestionid = $question->id;
$QTYPES[$wrappedquestion->qtype]
->print_question($wrappedquestion, $state, $number, $cmoptions, $options);
}