]> git.mjollnir.org Git - moodle.git/commitdiff
Improvements to response history. Three small bug fixes.
authorgustav_delius <gustav_delius>
Thu, 6 Apr 2006 19:59:02 +0000 (19:59 +0000)
committergustav_delius <gustav_delius>
Thu, 6 Apr 2006 19:59:02 +0000 (19:59 +0000)
lang/en_utf8/quiz.php
lib/questionlib.php
mod/quiz/reviewquestion.php
question/type/match/questiontype.php
question/type/multichoice/questiontype.php
question/type/question.html
question/type/questiontype.php
theme/standard/styles_fonts.css

index 6d3962c40407aa68dbf46a75b1a88eb511f8b0be..9f31bb092aa92cd9207f4b8446397e6b2f6d6e8c 100644 (file)
@@ -204,6 +204,7 @@ $string['gradingdetailsadjustment'] = 'With previous penalties this gives <stron
 $string['gradingdetailspenalty'] = 'This submission attracted a penalty of $a. ';
 $string['gradingdetailszeropenalty'] = 'You were not penalized for this submission. ';
 $string['guestsno'] = 'Sorry, guests cannot see or attempt quizzes';
+$string['history'] = 'History of Responses: ';
 $string['hotpot'] = 'Hot Potatoes format';
 $string['illegalformulasyntax'] = 'Illegal formula syntax starting with \'$a\'';
 $string['imagedisplay'] = 'Image to display';
index 920b3fe3cc75ad8f5cd081135cab963d8da1046a..1c8ee86728a21284d6d3aedc3dfdfd69fcbdc3c3 100644 (file)
@@ -912,7 +912,7 @@ function question_process_responses(&$question, &$state, $action, $cmoptions, &$
     }
 
     // make sure these are gone!
-    unset($action->responses['mark'], $action->responses['validate']);
+    unset($action->responses['submit'], $action->responses['validate']);
 
     // Check the question session is still open
     if (question_state_is_closed($state)) {
index b61e5e3e89dccec7d7255cacb909cde08fd33c30..8b6e20e37b3d878b292f5750bca8f70cb037ed9a 100644 (file)
@@ -70,7 +70,7 @@
             error(get_string("noreview", "quiz"));
         }
         if ((time() - $attempt->timefinish) > 120) { // always allow review right after attempt
-            if (!$quiz->timeclose or time() < $quiz->timeclose and !($quiz->review & QUIZ_REVIEW_OPEN)) {
+            if ((!$quiz->timeclose or time() < $quiz->timeclose) and !($quiz->review & QUIZ_REVIEW_OPEN)) {
                 error(get_string("noreviewuntil", "quiz", userdate($quiz->timeclose)));
             }
             if ($quiz->timeclose and time() >= $quiz->timeclose and !($quiz->review & QUIZ_REVIEW_CLOSED)) {
 
     $options = quiz_get_reviewoptions($quiz, $attempt, $isteacher);
     $options->validation = ($state->event == QUESTION_EVENTVALIDATE);
-    $options->history = 'all';
+    $options->history = ($isteacher and !$attempt->preview) ? 'all' : 'graded';
     // Provide the links to this question review script
     $options->questionreviewlink = '/mod/quiz/reviewquestion.php';
 
index d8cb0602cf1d0b9063fcb108de85acd628bc9ea3..6538198e4efc3db1bc2554379d946fd9ab44166b 100644 (file)
@@ -328,7 +328,7 @@ class question_match_qtype extends default_questiontype {
        foreach ($subquestions as $key => $sub) {
            foreach ($responses as $ind => $code) {
                if (isset($sub->options->answers[$code])) {
-                   $results[$ind] =  $subquestions[$ind]->questiontext . " : " . $sub->options->answers[$code]->answer;
+                   $results[$ind] =  $subquestions[$ind]->questiontext . ":" . $sub->options->answers[$code]->answer;
                }
            }
        }
@@ -337,7 +337,7 @@ class question_match_qtype extends default_questiontype {
 
     function response_summary($question, $state, $length=80) {
         // This should almost certainly be overridden
-        return substr(implode(',', $this->get_actual_response($question, $state)), 0, $length);
+        return substr(implode(', ', $this->get_actual_response($question, $state)), 0, $length);
     }
     
 /// BACKUP FUNCTIONS ////////////////////////////
index 99d2bc6969cb37ebceab440cc006e2459f14d558..e5edafdb6b997b1d58761d1aa701b4a7f6adc3a0 100644 (file)
@@ -362,8 +362,7 @@ class question_multichoice_qtype extends default_questiontype {
         $answers = $question->options->answers;
         if (!empty($state->responses)) {
             foreach ($state->responses as $aid =>$rid){
-                $answer = $rid ? $answers[$rid]->answer : '';
-                $responses[] = $answer;
+                $responses[] = (!empty($answers[$rid]) ? $answers[$rid]->answer : '');
             }
         } else {
             $responses[] = '';
index 2de4aa6f23122ce86582ad69c20ff300d2de03a4..f6ac34a2abc194c2dbca40ef17aa392ca0c1f704 100644 (file)
   </div>
   <div class="grading">
     <?php $this->print_question_grading_details($question, $state, $cmoptions, $options); ?>
+  </div>
+  <?php if ($history) { ?>
+       <div class="history">
+         <?php
+        print_string('history', 'quiz');
+        echo $history;
+      ?>
        </div>
-       <?php if ($history) { ?>
-               <div class="history">
-                       <?php echo $history; ?>
-               </div>
-       <?php } ?>
+  <?php } ?>
 </td></tr></table>
index ba3bcbee76658f446a70b74580d700ad772de1d0..6e3b4c04dbbdd960f088b8970940fda5e6ffc9ef 100644 (file)
@@ -489,10 +489,10 @@ class default_questiontype {
         if(isset($options->history) and $options->history) {
             if ($options->history == 'all') {
                 // show all states
-                $states = get_records_select('question_states', "attempt = '$state->attempt' AND question = '$question->id' AND event > '0'", 'seq_number DESC');
+                $states = get_records_select('question_states', "attempt = '$state->attempt' AND question = '$question->id' AND event > '0'", 'seq_number ASC');
             } else {
                 // show only graded states
-                $states = get_records_select('question_states', "attempt = '$state->attempt' AND question = '$question->id' AND event IN (".QUESTION_EVENTGRADE.','.QUESTION_EVENTCLOSEANDGRADE.")", 'seq_number DESC');
+                $states = get_records_select('question_states', "attempt = '$state->attempt' AND question = '$question->id' AND event IN (".QUESTION_EVENTGRADE.','.QUESTION_EVENTCLOSEANDGRADE.")", 'seq_number ASC');
             }
             if (count($states) > 1) {
                 $strreviewquestion = get_string('reviewresponse', 'quiz');
@@ -702,7 +702,7 @@ class default_questiontype {
     */
     function response_summary($question, $state, $length=80) {
         // This should almost certainly be overridden
-        return substr($state->answer, 0, $length);
+        return substr(implode(',', $this->get_actual_response($question, $state)), 0, $length);
     }
 
     /**
index 7d59ede553dfcea89cda7231925220e2f7aee067..de8c87451ca31151f119a13e4952da662def1240 100644 (file)
@@ -578,6 +578,9 @@ body#grade-index .grades .header {
 .que .grade {
        font-size: 0.8em;
 }
+.que .history {
+    font-size:75%;
+}
 
 /***
  *** Tabs