diff --git a/mod/quiz/attempt.php b/mod/quiz/attempt.php index 9b1e9f0424a..1bd2e4f98b4 100644 --- a/mod/quiz/attempt.php +++ b/mod/quiz/attempt.php @@ -464,6 +464,7 @@ // Start the form $quiz->thispageurl = $CFG->wwwroot . '/mod/quiz/attempt.php?q=' . s($quiz->id) . '&page=' . s($page); + $quiz->cmid = $cm->id; echo '
', "\n"; if($quiz->timelimit > 0) { diff --git a/mod/quiz/review.php b/mod/quiz/review.php index 1ae285e6cfc..9e691679a87 100644 --- a/mod/quiz/review.php +++ b/mod/quiz/review.php @@ -278,6 +278,7 @@ /// Print all the questions $quiz->thispageurl = $CFG->wwwroot . '/mod/quiz/review.php?attempt=' . $attempt->id . $urloptions; + $quiz->cmid = $cm->id; $number = quiz_first_questionnumber($attempt->layout, $pagelist); foreach ($pagequestions as $i) { if (!isset($questions[$i])) { diff --git a/mod/quiz/reviewquestion.php b/mod/quiz/reviewquestion.php index d12ee905891..45da9f1cb84 100644 --- a/mod/quiz/reviewquestion.php +++ b/mod/quiz/reviewquestion.php @@ -99,6 +99,7 @@ $baseurl = $CFG->wwwroot . '/mod/quiz/reviewquestion.php?question=' . $question->id . '&number=' . $number . '&attempt='; $quiz->thispageurl = $baseurl . $attempt->id; + $quiz->cmid = $cm->id; $session = get_record('question_sessions', 'attemptid', $attempt->uniqueid, 'questionid', $question->id); $state->sumpenalty = $session->sumpenalty; diff --git a/question/type/questiontype.php b/question/type/questiontype.php index dc52417d846..d6e500caaf4 100644 --- a/question/type/questiontype.php +++ b/question/type/questiontype.php @@ -877,7 +877,7 @@ class default_questiontype { * @param object $question the question object. * @param object $cmoptions the options from the module. If $cmoptions->thispageurl is set * then the link will be to edit the question in this browser window, then return to - * $cmoptions->thispageurl. Otherwise the link will be to edit in a popup. + * $cmoptions->thispageurl. Otherwise the link will be to edit in a popup. $cmoptions->cmid should also be set. * @return string the HTML of the link, or nothing it the currenty user is not allowed to edit. */ function get_question_edit_link($question, $cmoptions, $options) { @@ -890,8 +890,8 @@ class default_questiontype { /// Work out the right URL. $linkurl = '/question/question.php?id=' . $question->id; - if (!empty($cmoptions->id)) { - $linkurl .= '&cmid=' . $cmoptions->id; + if (!empty($cmoptions->cmid)) { + $linkurl .= '&cmid=' . $cmoptions->cmid; } else if (!empty($cmoptions->course)) { $linkurl .= '&courseid=' . $cmoptions->course; } else {