Skip to content

Commit

Permalink
Now includes maximum grades
Browse files Browse the repository at this point in the history
  • Loading branch information
moodler committed Oct 17, 2002
1 parent d0ac6bc commit 858deff
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 8 deletions.
17 changes: 13 additions & 4 deletions course/grades.php
Expand Up @@ -18,6 +18,7 @@

$strgrades = get_string("grades");
$strgrade = get_string("grade");
$strmax = get_string("maximumshort");


/// Otherwise fill and print the form.
Expand Down Expand Up @@ -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
}
}
}
Expand All @@ -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);
}

Expand Down
6 changes: 4 additions & 2 deletions mod/assignment/lib.php
Expand Up @@ -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;
}

//////////////////////////////////////////////////////////////////////////////////////
Expand Down
7 changes: 5 additions & 2 deletions mod/quiz/lib.php
Expand Up @@ -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;
}


Expand Down

0 comments on commit 858deff

Please sign in to comment.