quiz reports MDL-25206 Make it more obvious how to review the students responses.
authorTim Hunt <T.J.Hunt@open.ac.uk>
Mon, 15 Nov 2010 16:41:42 +0000 (16:41 +0000)
committerTim Hunt <T.J.Hunt@open.ac.uk>
Mon, 15 Nov 2010 16:41:42 +0000 (16:41 +0000)
mod/quiz/lang/en/quiz.php
mod/quiz/report/overview/overview_table.php
mod/quiz/report/overview/report.php
mod/quiz/report/responses/report.php
mod/quiz/report/responses/responses_table.php
mod/quiz/styles.css

index a0989b7..db20f5b 100644 (file)
@@ -713,6 +713,7 @@ $string['reverttodefaults'] = 'Revert to quiz defaults';
 $string['review'] = 'Review';
 $string['reviewafter'] = 'Allow review after quiz is closed';
 $string['reviewalways'] = 'Allow review at any time';
+$string['reviewattempt'] = 'Review attempt';
 $string['reviewbefore'] = 'Allow review while quiz is open';
 $string['reviewclosed'] = 'After the quiz is closed';
 $string['reviewimmediately'] = 'Immediately after the attempt';
index 92fbb80..2e1bb06 100644 (file)
@@ -129,31 +129,26 @@ class quiz_report_overview_table extends table_sql {
         return $OUTPUT->user_picture($user);
     }
 
+    function col_fullname($attempt){
+        $html = parent::col_fullname($attempt);
+        if ($this->is_downloading()) {
+            return $html;
+        }
+
+        return $html . '<br /><a class="reviewlink" href="review.php?q='.$this->quiz->id.'&amp;attempt='.$attempt->attempt.
+                '">'.get_string('reviewattempt', 'quiz').'</a>';
+    }
 
     function col_timestart($attempt){
         if ($attempt->attempt) {
-            $startdate = userdate($attempt->timestart, $this->strtimeformat);
-            if (!$this->is_downloading()) {
-                return  '<a href="review.php?q='.$this->quiz->id.'&amp;attempt='.$attempt->attempt.'">'.$startdate.'</a>';
-            } else {
-                return  $startdate;
-            }
+            return userdate($attempt->timestart, $this->strtimeformat);
         } else {
             return  '-';
         }
     }
     function col_timefinish($attempt){
-        if ($attempt->attempt) {
-            if ($attempt->timefinish) {
-                $timefinish = userdate($attempt->timefinish, $this->strtimeformat);
-                if (!$this->is_downloading()) {
-                    return '<a href="review.php?q='.$this->quiz->id.'&amp;attempt='.$attempt->attempt.'">'.$timefinish.'</a>';
-                } else {
-                    return $timefinish;
-                }
-            } else {
-                return  '-';
-            }
+        if ($attempt->attempt && $attempt->timefinish) {
+            return userdate($attempt->timefinish, $this->strtimeformat);
         } else {
             return  '-';
         }
@@ -168,37 +163,40 @@ class quiz_report_overview_table extends table_sql {
             return '-';
         }
     }
+
     function col_sumgrades($attempt){
-        if ($attempt->timefinish) {
-            $grade = quiz_rescale_grade($attempt->sumgrades, $this->quiz);
-            if (!$this->is_downloading()) {
-                if (isset($this->regradedqs[$attempt->attemptuniqueid])){
-                    $newsumgrade = 0;
-                    $oldsumgrade = 0;
-                    foreach ($this->questions as $question){
-                        if (isset($this->regradedqs[$attempt->attemptuniqueid][$question->id])){
-                            $newsumgrade += $this->regradedqs[$attempt->attemptuniqueid][$question->id]->newgrade;
-                            $oldsumgrade += $this->regradedqs[$attempt->attemptuniqueid][$question->id]->oldgrade;
-                        } else {
-                            $newsumgrade += $this->gradedstatesbyattempt[$attempt->attemptuniqueid][$question->id]->grade;
-                            $oldsumgrade += $this->gradedstatesbyattempt[$attempt->attemptuniqueid][$question->id]->grade;
-                        }
-                    }
-                    $newsumgrade = quiz_rescale_grade($newsumgrade, $this->quiz);
-                    $oldsumgrade = quiz_rescale_grade($oldsumgrade, $this->quiz);
-                    $grade = "<del>$oldsumgrade</del><br />$newsumgrade";
-                }
-                $gradehtml = '<a href="review.php?q='.$this->quiz->id.'&amp;attempt='.$attempt->attempt.'">'.$grade.'</a>';
-                if ($this->qmsubselect && $attempt->gradedattempt){
-                    $gradehtml = '<div class="highlight">'.$gradehtml.'</div>';
+        if (!$attempt->timefinish) {
+            return '-';
+        }
+
+        $grade = quiz_rescale_grade($attempt->sumgrades, $this->quiz);
+        if ($this->is_downloading()) {
+            return $grade;
+        }
+
+        if (isset($this->regradedqs[$attempt->attemptuniqueid])){
+            $newsumgrade = 0;
+            $oldsumgrade = 0;
+            foreach ($this->questions as $question){
+                if (isset($this->regradedqs[$attempt->attemptuniqueid][$question->id])){
+                    $newsumgrade += $this->regradedqs[$attempt->attemptuniqueid][$question->id]->newgrade;
+                    $oldsumgrade += $this->regradedqs[$attempt->attemptuniqueid][$question->id]->oldgrade;
+                } else {
+                    $newsumgrade += $this->gradedstatesbyattempt[$attempt->attemptuniqueid][$question->id]->grade;
+                    $oldsumgrade += $this->gradedstatesbyattempt[$attempt->attemptuniqueid][$question->id]->grade;
                 }
-                return $gradehtml;
-            } else {
-                return $grade;
             }
-        } else {
-            return '-';
+            $newsumgrade = quiz_rescale_grade($newsumgrade, $this->quiz);
+            $oldsumgrade = quiz_rescale_grade($oldsumgrade, $this->quiz);
+            $grade = "<del>$oldsumgrade</del><br />$newsumgrade";
+        }
+
+        $gradehtml = '<a href="review.php?q='.$this->quiz->id.'&amp;attempt='.$attempt->attempt.
+                '" title="'.get_string('reviewattempt', 'quiz').'">'.$grade.'</a>';
+        if ($this->qmsubselect && $attempt->gradedattempt){
+            $gradehtml = '<div class="highlight">'.$gradehtml.'</div>';
         }
+        return $gradehtml;
     }
 
     /**
index 5d858ad..0ef2a32 100644 (file)
@@ -378,10 +378,6 @@ class quiz_overview_report extends quiz_default_report {
 
             $table->collapsible(true);
 
-            $table->column_suppress('picture');
-            $table->column_suppress('fullname');
-            $table->column_suppress('idnumber');
-
             $table->no_sorting('feedbacktext');
 
             $table->column_class('picture', 'picture');
index 5f69e57..b73ccfd 100644 (file)
@@ -315,10 +315,6 @@ class quiz_responses_report extends quiz_default_report {
 
             $table->collapsible(true);
 
-            $table->column_suppress('picture');
-            $table->column_suppress('fullname');
-            $table->column_suppress('idnumber');
-
             $table->no_sorting('feedbacktext');
 
             $table->column_class('picture', 'picture');
index 5bb8d74..f7a906d 100644 (file)
@@ -85,6 +85,15 @@ class quiz_report_responses_table extends table_sql {
         return $OUTPUT->user_picture($user);
     }
 
+    function col_fullname($attempt){
+        $html = parent::col_fullname($attempt);
+        if ($this->is_downloading()) {
+            return $html;
+        }
+
+        return $html . '<br /><a class="reviewlink" href="review.php?q='.$this->quiz->id.'&amp;attempt='.$attempt->attempt.
+                '">'.get_string('reviewattempt', 'quiz').'</a>';
+    }
 
     function col_timestart($attempt){
         if ($attempt->attempt) {
@@ -126,21 +135,23 @@ class quiz_report_responses_table extends table_sql {
     }
 
     function col_sumgrades($attempt){
-        if ($attempt->timefinish) {
-            $grade = quiz_rescale_grade($attempt->sumgrades, $this->quiz);
-            if (!$this->is_downloading()) {
-                $gradehtml = '<a href="review.php?q='.$this->quiz->id.'&amp;attempt='.$attempt->attempt.'">'.$grade.'</a>';
-                if ($this->qmsubselect && $attempt->gradedattempt){
-                    $gradehtml = '<div class="highlight">'.$gradehtml.'</div>';
-                }
-                return $gradehtml;
-            } else {
-                return $grade;
-            }
-        } else {
+        if (!$attempt->timefinish) {
             return '-';
         }
+
+        $grade = quiz_rescale_grade($attempt->sumgrades, $this->quiz);
+        if ($this->is_downloading()) {
+            return $grade;
+        }
+
+        $gradehtml = '<a href="review.php?q='.$this->quiz->id.'&amp;attempt='.$attempt->attempt.
+                '" title="'.get_string('reviewattempt', 'quiz').'">'.$grade.'</a>';
+        if ($this->qmsubselect && $attempt->gradedattempt){
+            $gradehtml = '<div class="highlight">'.$gradehtml.'</div>';
+        }
+        return $gradehtml;
     }
+
     function other_cols($colname, $attempt){
         global $QTYPES, $OUTPUT;
         static $states =array();
@@ -170,7 +181,7 @@ class quiz_report_responses_table extends table_sql {
                 if ($summary){
                     $link = new moodle_url("/mod/quiz/reviewquestion.php?attempt=$attempt->attempt&question=$question->id");
                     $action = new popup_action('click', $link, 'reviewquestion', array('height' => 450, 'width' => 650));
-                    $summary = $OUTPUT->action_link($link, $summary, $action, array('title'=>$question->formattedname));
+                    $summary = $OUTPUT->action_link($link, $summary, $action, array('title'=>get_string('reviewresponsetoq', 'quiz', $question->formattedname)));
 
                     if (question_state_is_graded($stateforqinattempt)
                                 && ($question->maxgrade > 0)){
index 47933ff..c264a4f 100644 (file)
@@ -122,6 +122,7 @@ table#categoryquestions td,
 #page-mod-quiz-report fieldset.felement.fgroup {margin: 0;}
 #page-mod-quiz-report #cachingnotice {margin-bottom: 1em; padding: 0.2em; }
 #page-mod-quiz-report #cachingnotice .singlebutton {margin: 0.5em 0 0;}
+#page-mod-quiz-report .bold .reviewlink {font-weight: normal;}
 
 /** Mod quiz grading **/
 #page-mod-quiz-grading table#grading {width: 80%;margin: 20px auto;}