]> git.mjollnir.org Git - moodle.git/commitdiff
Now includes maximum grades
authormoodler <moodler>
Thu, 17 Oct 2002 07:55:54 +0000 (07:55 +0000)
committermoodler <moodler>
Thu, 17 Oct 2002 07:55:54 +0000 (07:55 +0000)
course/grades.php
mod/assignment/lib.php
mod/quiz/lib.php

index 6d802211823ef7c9c59247ddfd1cb70b7788ee54..3242f9458e9e0f6b1ecc216de086d93765a9c137 100644 (file)
@@ -18,6 +18,7 @@
 
     $strgrades = get_string("grades");
     $strgrade = get_string("grade");
+    $strmax = get_string("maximumshort");
 
 
 /// Otherwise fill and print the form.
                         require_once($libfile);
                         $gradefunction = $mod->modname."_grades";
                         if (function_exists($gradefunction)) {   // Skip modules without grade function
+                            $modgrades = $gradefunction($mod->instance);
+
+                            if ($modgrades->maxgrade) {
+                                $maxgrade = "<BR>$strmax: $modgrades->maxgrade";
+                            } else {
+                                $maxgrade = "";
+                            }
+
                             $image = "<A HREF=\"$CFG->wwwroot/mod/$mod->modname/view.php?id=$mod->id\"".
                                      "   TITLE=\"$mod->modfullname\">".
                                      "<IMG BORDER=0 VALIGN=absmiddle SRC=\"../mod/$mod->modname/icon.gif\" ".
                             $columns[] = "$image ".
                                          "<A HREF=\"$CFG->wwwroot/mod/$mod->modname/view.php?id=$mod->id\">".
                                          "$instance->name".
-                                         "</A>";
-                            
-                            $modgrades = $gradefunction($mod->instance);
+                                         "</A>$maxgrade";
 
                             foreach ($students as $student) {
-                                $grades[$student->id][] = $modgrades[$student->id]->grade; // may be empty, that's ok
+                                $grades[$student->id][] = $modgrades->grades[$student->id]; // may be empty, that's ok
                             }
                         }
                     }
@@ -90,6 +97,8 @@
         $student = $students[$studentid];
         $picture = print_user_picture($student->id, $course->id, $student->picture, false, true);
         $name = array ("$picture", "$student->firstname&nbsp;$student->lastname");
+
+        
         $table->data[] = array_merge($name, $gradelist);
     }
 
index f067aabfa757d7cbc1e766f5f8c19d053121e386..787142e998f3b08ddf0047491bc8a2b0ac7c9072 100644 (file)
@@ -218,9 +218,11 @@ function assignment_print_recent_activity(&$logs, $isteacher=false) {
 }
 
 function assignment_grades($assignmentid) {
-/// Must return an array of grades, indexed by user.  The grade is called "grade".
+/// Must return an array of grades, indexed by user, and a max grade.
 
-    return get_records("assignment_submissions", "assignment", $assignmentid, "user ASC", "user,grade");
+    $return->grades = get_records_sql_menu("SELECT user,grade FROM assignment_submissions WHERE assignment = '$assignmentid'");
+    $return->maxgrade = get_field("assignment", "grade", "id", "$assignmentid");
+    return $return;
 }
 
 //////////////////////////////////////////////////////////////////////////////////////
index 454389939f6d0480eaaa9a0d99ff65f63fb680eb..f2fce6515ccaf97265bb041b5a11123a453045b2 100644 (file)
@@ -186,8 +186,11 @@ function quiz_cron () {
 }
 
 function quiz_grades($quizid) {
-/// Must return an array of grades, indexed by user.  The grade is called "grade".
-    return get_records("quiz_grades", "quiz", $quizid, "user ASC", "user,grade");
+/// Must return an array of grades, indexed by user, and a max grade.
+
+    $return->grades = get_records_sql_menu("SELECT user,grade FROM quiz_grades WHERE quiz = '$quizid'");
+    $return->maxgrade = get_field("quiz", "grade", "id", "$quizid");
+    return $return;
 }