]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-9542 - Show final grades from new gradebook in Quiz UI - with help from Petr...
authortjhunt <tjhunt>
Thu, 11 Oct 2007 11:42:49 +0000 (11:42 +0000)
committertjhunt <tjhunt>
Thu, 11 Oct 2007 11:42:49 +0000 (11:42 +0000)
lang/en_utf8/grades.php
lang/en_utf8/quiz.php
mod/quiz/styles.php [deleted file]
mod/quiz/view.php
theme/standard/styles_layout.css

index 42dd9f36f8e9d6e23608022aaa1afcb3cddc5ef5..0462ad931217bd7245536448eda3645fbfbc1eeb 100644 (file)
@@ -320,6 +320,7 @@ $string['overridesitedefaultgradedisplaytype'] = 'Override site defaults';
 $string['overridesitedefaultgradedisplaytypehelp'] = 'Tick this checkbox to enable the overriding of the site defaults for the display of grades in the gradebook. This activates form elements allowing you to define the grade letters and boundaries of your choice.';
 $string['overridden'] = 'Overridden';
 $string['overriddenhelp'] = 'When on, the overridden flag prevents any future attempts to automatically adjust the value of the grade. This flag is often set internally by the gradebook, but can be switched on and off manually using this form element.';
+$string['overriddennotice'] = 'Your final grade from this activity was manually adjusted.';
 $string['overallavg'] = 'Overall average';
 $string['pctoftotalgrade'] = '%% of total grade';
 $string['percent'] = 'Percent';
index c9b76e09e96cd16b581f7618ac9f3db94bdfaace..85a71592260a67a47cd40bf154e0f13c639cbf54 100644 (file)
@@ -542,6 +542,7 @@ $string['stoponerror'] = 'Stop on error';
 $string['subneterror'] = 'Sorry, this quiz has been locked so that it is only accessible from certain locations.  Currently your computer is not one of those allowed to use this quiz.';
 $string['subnetnotice'] = 'This quiz has been locked so that it is only accessible from certain locations. Your computer is not on an allowed subnet. As teacher you are allowed to preview anyway.';
 $string['substitutedby'] = 'will be substituted by';
+$string['summaryofattempts'] = 'Summary of your previous attempts';
 $string['temporaryblocked'] = 'You are temporarily not allowed to re-attempt the quiz.<br /> You will be able to take another attempt on:';
 $string['time'] = 'Time';
 $string['timecompleted'] = 'Completed';
diff --git a/mod/quiz/styles.php b/mod/quiz/styles.php
deleted file mode 100644 (file)
index 861647d..0000000
+++ /dev/null
@@ -1,102 +0,0 @@
-body#mod-quiz-report table#itemanalysis {
-  margin: 20px auto;
-}
-body#mod-quiz-report table#itemanalysis .header,
-body#mod-quiz-report table#itemanalysis .cell
-{
-  padding: 4px;
-}
-body#mod-quiz-report table#itemanalysis .header .commands {
-  display: inline;
-}
-body#mod-quiz-report table#itemanalysis td {
-  border-width: 1px;
-  border-style: solid;
-}
-body#mod-quiz-report table#itemanalysis .header {
-  text-align: left;
-}
-body#mod-quiz-report table#itemanalysis .numcol {
-  text-align: center;
-  vertical-align : middle !important;
-}
-
-body#mod-quiz-report table#itemanalysis .uncorrect {
-  color: red;
-}
-
-body#mod-quiz-report table#itemanalysis .correct {
-  color: blue;
-  font-weight : bold;
-}
-
-body#mod-quiz-report table#itemanalysis .partialcorrect {
-  color: green !important;
-}
-
-body#mod-quiz-report table#itemanalysis .qname {
-  color: green !important;
-}
-
-/* manual grading */
-body#mod-quiz-grading table#grading
-{
-  width: 80%;
-  margin: auto;
-}
-
-body#mod-quiz-grading table#grading
-{
-  margin: 20px auto;
-}
-
-body#mod-quiz-grading table#grading .header,
-body#mod-quiz-grading table#grading .cell
-{
-  padding: 4px;
-}
-
-body#mod-quiz-grading table#grading .header .commands 
-{
-  display: inline;
-}
-
-body#mod-quiz-grading table#grading .picture 
-{
-  width: 40px;
-}
-
-body#mod-quiz-grading table#grading td 
-{
-  border-left-width: 1px;
-  border-right-width: 1px;
-  border-left-style: solid;
-  border-right-style: solid;
-  vertical-align: bottom;
-}
-
-.mod-quiz .quiz-report-title {
-  text-align: center;
-  font-weight : bold;
-}
-
-.mod-quiz .gradingdetails {
-  font-size: small;
-}
-
-#mod-quiz-attempt #page {
-    text-align: center;
-}
-
-#mod-quiz-attempt #timer .generalbox {
-  width:150px
-}
-
-#mod-quiz-attempt #timer {
-  position:absolute;
-  /*top:100px; is set by js*/
-  left:10px
-}
-#question-preview .essay .answer textarea {
-  width: 400px;
-}
index 36cf5bc041c099d4f11cb06e6c52d6010251a918..0c80da7525c87505ba7f0b831d6f92be120bb5dc 100644 (file)
@@ -3,10 +3,11 @@
 // This page prints a particular instance of quiz
 
     require_once("../../config.php");
-    require_once("locallib.php");
     require_once($CFG->libdir.'/blocklib.php');
-    require_once('pagelib.php');
-    
+    require_once($CFG->libdir.'/gradelib.php');
+    require_once($CFG->dirroot.'/mod/quiz/locallib.php');
+    require_once($CFG->dirroot.'/mod/quiz/pagelib.php');
+
     if (!empty($THEME->customcorners)) {
         require_once($CFG->dirroot.'/lib/custom_corners_lib.php');
     }
     }
     $numattempts = count($attempts);
 
+    // Work out the final grade, checking whether it was overridden in the gradebook.
     $mygrade = quiz_get_best_grade($quiz, $USER->id);
+    $mygradeoverridden = false;
+    $gradebookfeedback = '';
+
+    $grading_info = grade_get_grades($course->id, 'mod', 'quiz', $quiz->id, $USER->id);
+    $item = $grading_info->items[0];
+    $grade = $item->grades[$USER->id];
 
+    if ($grade->overridden) {
+        $mygrade = $grade->grade + 0; // Convert to number.
+        $mygradeoverridden = true;
+    }
+    if (!empty($grade->str_feedback)) {
+        $gradebookfeedback = $grade->str_feedback;
+    }
+    
     // Print table with existing attempts
     if ($attempts) {
 
-        print_heading('Summary of your previous attempts');
+        print_heading(get_string('summaryofattempts', 'quiz'));
 
         // Get some strings.
         $strattempt       = get_string("attempt", "quiz");
     }
 
     if ($numattempts && $quiz->sumgrades && !is_null($mygrade)) {
+        $resultinfo = '';
+        
         if ($overallstats) {
             if ($available && $moreattempts) {
                 $a = new stdClass;
                 $a->method = quiz_get_grading_option_name($quiz->grademethod);
                 $a->mygrade = $mygrade;
                 $a->quizgrade = $quiz->grade;
-                print_heading(get_string('gradesofar', 'quiz', $a));
+                $resultinfo .= print_heading(get_string('gradesofar', 'quiz', $a), '', 2, 'main', true);
             } else {
-                print_heading(get_string('yourfinalgradeis', 'quiz', "$mygrade / $quiz->grade"));
+                $resultinfo .= print_heading(get_string('yourfinalgradeis', 'quiz', "$mygrade / $quiz->grade"), '', 2, 'main', true);
+                if ($mygradeoverridden) {
+                    $resultinfo .= '<p class="overriddennotice">'.get_string('overriddennotice', 'grades').'</p>';
+                }
             }
         }
 
+        if ($gradebookfeedback) {
+            $resultinfo .= print_heading(get_string('comment', 'quiz'), '', 3, 'main', true);
+            $resultinfo .= '<p class="quizteacherfeedback">'.$gradebookfeedback.'</p>';
+        }
         if ($overallfeedback) {
-            echo '<p class="quizgradefeedback">'.quiz_feedback_for_grade($mygrade, $quiz->id).'</p>';
+            $resultinfo .= print_heading(get_string('overallfeedback', 'quiz'), '', 3, 'main', true);
+            $resultinfo .= '<p class="quizgradefeedback">'.quiz_feedback_for_grade($mygrade, $quiz->id).'</p>';
+        }
+
+        if ($resultinfo) {
+            print_box($resultinfo, 'generalbox', 'feedback');
         }
     }
 
+
+
     // Print a button to start/continue an attempt, if appropriate.
     if (!$quiz->questions) {
         print_heading(get_string("noquestions", "quiz"));
index 1ef3987f42bfeb999030a5979d3f810975380c6e..850cf1de55c7ad4f3448e49ffe071c1734bd1318 100644 (file)
@@ -3799,6 +3799,25 @@ body#mod-forum-search .introcontent {
 {
   text-align: center;
 }
+#mod-quiz-view #page .quizattemptsummary td p {
+  margin-top: 0;
+}
+#mod-quiz-view .generalbox#feedback {
+  width:70%;
+  margin-left:auto;
+  margin-right:auto;
+  padding-bottom:15px;
+}
+#mod-quiz-view .generalbox#feedback h2 {
+  margin: 0 0;
+}
+body#mod-quiz-view .generalbox#feedback .overriddennotice {
+  text-align: center;
+  font-size: 0.7em;
+}
+#mod-quiz-view .generalbox#feedback h3 {
+  text-align: left;
+}
 
 .generalbox#passwordbox { /* Should probably match .generalbox#intro above */
   width:70%;
@@ -3814,6 +3833,19 @@ body#mod-forum-search .introcontent {
 #mod-quiz-attempt .pagingbar {
   margin: 1.5em auto;
 }
+#mod-quiz-attempt #page {
+    text-align: center;
+}
+
+#mod-quiz-attempt #timer .generalbox {
+  width:150px
+}
+
+#mod-quiz-attempt #timer {
+  position:absolute;
+  /*top:100px; is set by js*/
+  left:10px
+}
 
 body#question-preview .quemodname,
 body#question-preview .controls
@@ -3888,48 +3920,128 @@ table.quizreviewsummary td.cell {
   text-align: center;
 }
 
-body#mod-quiz-report table#attempts,
-body#mod-quiz-report table#commands,
-body#mod-quiz-report table#itemanalysis
+#mod-quiz-report table#attempts,
+#mod-quiz-report table#commands,
+#mod-quiz-report table#itemanalysis
 {
   width: 80%;
   margin: auto;
 }
-body#mod-quiz-report table#attempts,
-body#mod-quiz-report h2.main {
+#mod-quiz-report table#attempts,
+#mod-quiz-report h2.main {
   clear: both;
 }
-body#mod-quiz-report table#attempts {
+#mod-quiz-report table#attempts {
   margin: 20px auto;
 }
-body#mod-quiz-report table#attempts .header,
-body#mod-quiz-report table#attempts .cell
+#mod-quiz-report table#attempts .header,
+#mod-quiz-report table#attempts .cell
 {
   padding: 4px;
 }
-body#mod-quiz-report table#attempts .header .commands {
+#mod-quiz-report table#attempts .header .commands {
   display: inline;
 }
-body#mod-quiz-report table#attempts .picture {
+#mod-quiz-report table#attempts .picture {
   width: 40px;
 }
-body#mod-quiz-report table#attempts td {
+#mod-quiz-report table#attempts td {
   border-left-width: 1px;
   border-right-width: 1px;
   border-left-style: solid;
   border-right-style: solid;
   vertical-align: middle;
 }
-body#mod-quiz-report table#attempts .header {
+#mod-quiz-report table#attempts .header {
   text-align: left;
 }
-body#mod-quiz-report table#attempts .picture {
+#mod-quiz-report table#attempts .picture {
   text-align: center !important;
 }
-body#mod-quiz-report .controls {
+#mod-quiz-report .controls {
   text-align: center;
 }
 
+#mod-quiz-report table#itemanalysis {
+  margin: 20px auto;
+}
+#mod-quiz-report table#itemanalysis .header,
+#mod-quiz-report table#itemanalysis .cell
+{
+  padding: 4px;
+}
+#mod-quiz-report table#itemanalysis .header .commands {
+  display: inline;
+}
+#mod-quiz-report table#itemanalysis td {
+  border-width: 1px;
+  border-style: solid;
+}
+#mod-quiz-report table#itemanalysis .header {
+  text-align: left;
+}
+#mod-quiz-report table#itemanalysis .numcol {
+  text-align: center;
+  vertical-align : middle !important;
+}
+
+#mod-quiz-report table#itemanalysis .uncorrect {
+  color: red;
+}
+
+#mod-quiz-report table#itemanalysis .correct {
+  color: blue;
+  font-weight : bold;
+}
+
+#mod-quiz-report table#itemanalysis .partialcorrect {
+  color: green !important;
+}
+
+#mod-quiz-report table#itemanalysis .qname {
+  color: green !important;
+}
+
+/* manual grading */
+#mod-quiz-grading table#grading
+{
+  width: 80%;
+  margin: auto;
+}
+
+#mod-quiz-grading table#grading
+{
+  margin: 20px auto;
+}
+
+#mod-quiz-grading table#grading .header,
+#mod-quiz-grading table#grading .cell
+{
+  padding: 4px;
+}
+
+#mod-quiz-grading table#grading .header .commands 
+{
+  display: inline;
+}
+
+#mod-quiz-grading table#grading .picture 
+{
+  width: 40px;
+}
+
+#mod-quiz-grading table#grading td 
+{
+  border-left-width: 1px;
+  border-right-width: 1px;
+  border-left-style: solid;
+  border-right-style: solid;
+  vertical-align: bottom;
+}
+
+.mod-quiz .gradingdetails {
+  font-size: small;
+}
 /***
  *** Modules: Resource
  ***/