quiz / questions: MDL-17919 Bad link edit questions from quiz preview page.

Thanks to Ann Adamcik for noticing this. It was a regression from MDL-6085.
This commit is contained in:
tjhunt
2009-01-16 04:47:35 +00:00
parent 9d06855887
commit 190dddfc0b
4 changed files with 6 additions and 3 deletions
+1
View File
@@ -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 '<form id="responseform" method="post" action="', $quiz->thispageurl . '" enctype="multipart/form-data"' .
' onclick="this.autocomplete=\'off\'" onkeypress="return check_enter(event);">', "\n";
if($quiz->timelimit > 0) {
+1
View File
@@ -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])) {
+1
View File
@@ -99,6 +99,7 @@
$baseurl = $CFG->wwwroot . '/mod/quiz/reviewquestion.php?question=' . $question->id . '&amp;number=' . $number . '&amp;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;
+3 -3
View File
@@ -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 .= '&amp;cmid=' . $cmoptions->id;
if (!empty($cmoptions->cmid)) {
$linkurl .= '&amp;cmid=' . $cmoptions->cmid;
} else if (!empty($cmoptions->course)) {
$linkurl .= '&amp;courseid=' . $cmoptions->course;
} else {