mirror of
https://github.com/moodle/moodle.git
synced 2025-08-04 08:26:37 +02:00
Now includes maximum grades
This commit is contained in:
parent
d0ac6bc236
commit
858deff0b4
3 changed files with 22 additions and 8 deletions
|
@ -18,6 +18,7 @@
|
|||
|
||||
$strgrades = get_string("grades");
|
||||
$strgrade = get_string("grade");
|
||||
$strmax = get_string("maximumshort");
|
||||
|
||||
|
||||
/// Otherwise fill and print the form.
|
||||
|
@ -56,6 +57,14 @@
|
|||
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\" ".
|
||||
|
@ -63,12 +72,10 @@
|
|||
$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 $student->lastname");
|
||||
|
||||
|
||||
$table->data[] = array_merge($name, $gradelist);
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue