Permalink
Browse files

Now includes maximum grades

  • Loading branch information...
1 parent d0ac6bc commit 858deff0b4acd0ffd467a06d6a9a0ef8a78d065a moodler committed Oct 17, 2002
Showing with 22 additions and 8 deletions.
  1. +13 −4 course/grades.php
  2. +4 −2 mod/assignment/lib.php
  3. +5 −2 mod/quiz/lib.php
View
17 course/grades.php
@@ -18,6 +18,7 @@
$strgrades = get_string("grades");
$strgrade = get_string("grade");
+ $strmax = get_string("maximumshort");
/// Otherwise fill and print the form.
@@ -56,19 +57,25 @@
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\" ".
"HEIGHT=16 WIDTH=16 ALT=\"$mod->modfullname\"></A>";
$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);
}
View
6 mod/assignment/lib.php
@@ -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;
}
//////////////////////////////////////////////////////////////////////////////////////
View
7 mod/quiz/lib.php
@@ -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;
}

0 comments on commit 858deff

Please sign in to comment.