quiz & qbank MDL-24453 some more return URLs that I missed the first time.
authorTim Hunt <T.J.Hunt@open.ac.uk>
Mon, 18 Oct 2010 15:53:54 +0000 (15:53 +0000)
committerTim Hunt <T.J.Hunt@open.ac.uk>
Mon, 18 Oct 2010 15:53:54 +0000 (15:53 +0000)
Also, fix a double-escaping bug when cancelling the form.

mod/quiz/report/statistics/statistics_table.php
question/question.php

index ae54a69..508da38 100644 (file)
@@ -91,7 +91,7 @@ class quiz_report_statistics_table extends flexible_table {
         if (!$this->is_downloading()){
             if ($question->qtype!='random'){
                 $tooltip = get_string('detailedanalysis', 'quiz_statistics');
-                $url = $this->baseurl .'&amp;qid='.$question->id;
+                $url = $this->baseurl .'qid='.$question->id;
                 $html = "<a title=\"$tooltip\" href=\"$url\">".$question->name."</a>";
             } else {
                 $html = $question->name;
@@ -132,7 +132,11 @@ class quiz_report_statistics_table extends flexible_table {
         }
     }
     function col_actions($question){
-        return quiz_question_action_icons($this->quiz, $this->cmid, $question, $this->baseurl);
+        global $CFG;
+        $editreturnurl = str_replace($CFG->wwwroot, '', $this->baseurl);
+        $editreturnurl = str_replace('&amp;', '&', $editreturnurl);
+        $editreturnurl = preg_replace('/&$/', '', $editreturnurl);
+        return quiz_question_action_icons($this->quiz, $this->cmid, $question, $editreturnurl);
     }
     function col_qtype($question){
         return get_string($question->qtype,'quiz');
index 3ce6211..8402cbb 100644 (file)
@@ -206,11 +206,10 @@ if ($mform->is_cancelled()){
     if ($inpopup) {
         close_window();
     } else {
-        $nexturl = new moodle_url($returnurl);
         if (!empty($question->id)) {
-            $nexturl->param('lastchanged', $question->id);
+            $returnurl->param('lastchanged', $question->id);
         }
-        redirect($nexturl->out());
+        redirect($returnurl->out(false));
     }
 } elseif ($fromform = $mform->get_data()) {
     /// If we are saving as a copy, break the connection to the old question.