]> git.mjollnir.org Git - moodle.git/commitdiff
Fixed the links to the question review script.
authorgustav_delius <gustav_delius>
Wed, 22 Mar 2006 21:30:00 +0000 (21:30 +0000)
committergustav_delius <gustav_delius>
Wed, 22 Mar 2006 21:30:00 +0000 (21:30 +0000)
mod/quiz/review.php
mod/quiz/reviewquestion.php
question/questiontypes/questiontype.php

index a73fa1ef770ae941ceb628f017fe3d353ac90afc..6dea7c363aeeda663e2a4b12f87fe904e2fd4a11 100644 (file)
         $options = quiz_get_reviewoptions($quiz, $attempt, $isteacher);
         $options->validation = QUESTION_EVENTVALIDATE === $states[$i]->event;
         $options->history = ($isteacher and !$attempt->preview) ? 'all' : 'graded';
+        // Provide the links to the question review script
+        $options->questionreviewlink = '/mod/quiz/reviewquestion.php';
         // Print the question
         if ($i > 0) {
             echo "<br />\n";
index 43fbd1ad2ddbb8ae8f840dd36b40aae02ecce11d..be9c077e3b48466a2426db99ba3ad645247b60c7 100644 (file)
     $options = quiz_get_reviewoptions($quiz, $attempt, $isteacher);
     $options->validation = ($state->event == QUESTION_EVENTVALIDATE);
     $options->history = 'all';
+    // Provide the links to this question review script
+    $options->questionreviewlink = '/mod/quiz/reviewquestion.php';
 
 /// Print infobox
     $table->align  = array("right", "left");
index 745b3ecf2ca1de2694f19f1f96f56eeac6ccf644..84cf838f3442669aac69395d8d45ff5e777f9d6c 100644 (file)
@@ -474,6 +474,17 @@ class default_questiontype {
             $grade .= $question->maxgrade;
         }
 
+        $history = $this->history($question, $state, $number, $cmoptions, $options);
+
+        include "$CFG->dirroot/question/questiontypes/question.html";
+    }
+
+    /*
+     * Print history of responses
+     *
+     * Used by print_question()
+     */
+    function history($question, $state, $number, $cmoptions, $options) {
         $history = '';
         if(isset($options->history) and $options->history) {
             if ($options->history == 'all') {
@@ -501,8 +512,18 @@ class default_questiontype {
                 foreach ($states as $st) {
                     $b = ($state->id == $st->id) ? '<b>' : '';
                     $be = ($state->id == $st->id) ? '</b>' : '';
+                    if ($state->id == $st->id) {
+                        $link = '<b>'.$st->seq_number.'</b>';
+                    } else {
+                        if(isset($options->questionreviewlink)) {
+                            $link = link_to_popup_window ($options->questionreviewlink.'?state='.$st->id.'&amp;number='.$number,
+                             'reviewquestion', $st->seq_number, 450, 650, $strreviewquestion, 'none', true);
+                        } else {
+                            $link = $st->seq_number;
+                        }
+                    }
                     $table->data[] = array (
-                        ($state->id == $st->id) ? '<b>'.$st->seq_number.'</b>' : link_to_popup_window ('/question/reviewquestion.php?state='.$st->id.'&amp;number='.$number, 'reviewquestion', $st->seq_number, 450, 650, $strreviewquestion, 'none', true),
+                        $link,
                         $b.get_string('event'.$st->event, 'quiz').$be,
                         $b.$this->response_summary($st).$be,
                         $b.userdate($st->timestamp, get_string('timestr', 'quiz')).$be,
@@ -514,7 +535,7 @@ class default_questiontype {
                 $history = make_table($table);
             }
         }
-        include "$CFG->dirroot/question/questiontypes/question.html";
+        return $history;
     }