]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-14198 "Make it clear which student attempt gives the final grade, if the scoring...
authorjamiesensei <jamiesensei>
Thu, 8 May 2008 09:35:08 +0000 (09:35 +0000)
committerjamiesensei <jamiesensei>
Thu, 8 May 2008 09:35:08 +0000 (09:35 +0000)
Merged from 1.9 branch.

lang/en_utf8/quiz_overview.php
mod/quiz/report/overview/report.php
mod/quiz/report/reportlib.php

index 0fa8ca95abd15acb8bf2ff1f94bbcc0e0b8c11e4..1bb41d4156622898c8d4e5a9170232f6495330dd 100644 (file)
@@ -3,11 +3,14 @@
 
 
 $string['allattempts'] = 'Show all attempts';
+$string['allattemptscontributetograde'] = 'All attempts contribute to final grade for user.';
 $string['allstudents'] = 'Show all $a';
 $string['attemptsonly'] = 'Show $a with attempts only';
 $string['attemptsprepage'] = 'Attempts shown per page';
 $string['deleteselected'] = 'Delete selected attempts';
+$string['highlightinggraded'] = 'The user attempt that contributes to final grade is highlighted.';
 $string['noattemptsonly'] = 'Show $a with no attempts only';
+$string['onlyoneattemptallowed'] = 'Only one attempt per user allowed on this quiz.';
 $string['optallattempts'] = 'all attempts';
 $string['optallstudents'] = 'all \'$a\'';
 $string['optattemptsonly'] = '\'$a\' with attempts only';
@@ -22,5 +25,7 @@ $string['preferencespage'] = 'Preferences just for this page';
 $string['preferencessave'] = 'Save preferences';
 $string['preferencesuser'] = 'Your preferences for this report';
 $string['show'] = 'Show';
+$string['showinggraded'] = 'Showing only the attempt graded for each user.';
+$string['showinggradedandungraded'] = 'Showing graded and ungraded attempts for each user. The one attempt for each user that is graded is highlighted. The grading method for this quiz is $a.';
 $string['showdetailedmarks'] = 'Show marks for each question';
 ?>
index 181c282c4718fb5a180dad6f8720267644bd8573..8b22adf37b883ae7db4f91ffc74b973a28431b17 100644 (file)
@@ -65,7 +65,7 @@ class quiz_report extends quiz_default_report {
         $pageoptions['mode'] = 'overview';
 
         $reporturl = new moodle_url($CFG->wwwroot.'/mod/quiz/report.php', $pageoptions);
-        $qmsubselect = quiz_report_qm_filter_subselect($quiz->grademethod);
+        $qmsubselect = quiz_report_qm_filter_subselect($quiz);
         $mform = new mod_quiz_report_overview_settings($reporturl, compact('qmsubselect'));
         if ($fromform = $mform->get_data()){
             $attemptsmode = $fromform->attemptsmode;
@@ -117,6 +117,14 @@ class quiz_report extends quiz_default_report {
             }
         }
 
+        // Print information on the grading method and whether we are displaying
+        // 
+        if (!$download) { //do not print notices when downloading
+            if ($strattempthighlight = quiz_report_highlighting_grading_method($quiz, $qmsubselect, $qmfilter)) {
+                echo '<div class="quizattemptcounts">' . $strattempthighlight . '</div>';
+            }
+        }
+
         // Now check if asked download of data
         if ($download) {
             $filename = clean_filename("$course->shortname ".format_string($quiz->name,true));
index b6d069edfd81004a4652b2edbdca582edd126093..0ece6be42809a2eb6d737e79a5fd74433017eee8 100644 (file)
@@ -78,10 +78,13 @@ function quiz_report_load_questions($quiz){
  * one attempt that will be graded for each user. Or return 
  * empty string if all attempts contribute to final grade.
  */
-function quiz_report_qm_filter_subselect($quizgrademethod){
+function quiz_report_qm_filter_subselect($quiz){
     global $CFG;
+    if ($quiz->attempts == 1) {//only one attempt allowed on this quiz
+        return '';
+    }
     $qmfilterattempts = true;
-    switch ($quizgrademethod) {
+    switch ($quiz->grademethod) {
     case QUIZ_GRADEHIGHEST :
         $qmorderby = 'sumgrades DESC, timestart ASC';
         break;
@@ -119,5 +122,16 @@ function quiz_report_grade_bands($bands, $quizid, $useridlist){
     ksort($data);
     return $data;
 }
-
+function quiz_report_highlighting_grading_method($quiz, $qmsubselect, $qmfilter){
+    if ($quiz->attempts == 1) {//only one attempt allowed on this quiz
+        return "<p>".get_string('onlyoneattemptallowed', "quiz_overview")."</p>";
+    } else if (!$qmsubselect){
+        return "<p>".get_string('allattemptscontributetograde', "quiz_overview")."</p>";
+    } else if ($qmfilter){
+        return "<p>".get_string('showinggraded', "quiz_overview")."</p>";
+    }else {
+        return "<p>".get_string('showinggradedandungraded', "quiz_overview",
+                ('<span class="highlight">'.quiz_get_grading_option_name($quiz->grademethod).'</span>'))."</p>";
+    }
+}
 ?>
\ No newline at end of file