From c0605295bd95fb5d0ce888ce9c6461677a6c8196 Mon Sep 17 00:00:00 2001 From: stronk7 Date: Sat, 26 Apr 2003 19:35:27 +0000 Subject: [PATCH] Changed to dimm non-visible grades (mods). Bug #378. Done a bit more: - Show dimmed entire column. - Difference html (for web) and text (for .xls and .txt export) in many variables. - Using the dimmed_text style to dimm. --- course/grades.php | 35 +++++++++++++++++++++++++++++------ 1 file changed, 29 insertions(+), 6 deletions(-) diff --git a/course/grades.php b/course/grades.php index 9ec3244170..269f77abf6 100644 --- a/course/grades.php +++ b/course/grades.php @@ -37,6 +37,7 @@ foreach ($students as $student) { $grades[$student->id] = array(); // Collect all grades in this array + $gradeshtml[$student->id] = array(); // Collect all grades html formatted in this array $totals[$student->id] = array(); // Collect all totals in this array } $columns = array(); // Accumulate column names in this array. @@ -65,26 +66,48 @@ if ($modgrades = $gradefunction($mod->instance)) { if (!empty($modgrades->maxgrade)) { - $maxgrade = "
$strmax: $modgrades->maxgrade"; + if ($mod->visible) { + $maxgrade = "$strmax: $modgrades->maxgrade"; + $maxgradehtml = "
$strmax: $modgrades->maxgrade"; + } else { + $maxgrade = "$strmax: $modgrades->maxgrade"; + $maxgradehtml = "
$strmax: $modgrades->maxgrade"; + } } else { $maxgrade = ""; + $maxgradehtml = ""; } $image = "wwwroot/mod/$mod->modname/view.php?id=$mod->id\"". " TITLE=\"$mod->modfullname\">". "modname/icon.gif\" ". "HEIGHT=16 WIDTH=16 ALT=\"$mod->modfullname\">"; - $columnhtml[] = "$image ". - "wwwroot/mod/$mod->modname/view.php?id=$mod->id\">". - "$instance->name". - "$maxgrade"; + if ($mod->visible) { + $columnhtml[] = "$image ". + "wwwroot/mod/$mod->modname/view.php?id=$mod->id\">". + "$instance->name". + "$maxgradehtml"; + } else { + $columnhtml[] = "$image ". + "wwwroot/mod/$mod->modname/view.php?id=$mod->id\">". + "$instance->name". + "$maxgradehtml"; + } $columns[] = "$mod->modfullname: $instance->name - $maxgrade"; foreach ($students as $student) { if (!empty($modgrades->grades[$student->id])) { $grades[$student->id][] = $currentstudentgrade = $modgrades->grades[$student->id]; + if ($mod->visible) { + $gradeshtml[$student->id][] = $modgrades->grades[$student->id]; + } else { + $gradeshtml[$student->id][] = "". + $modgrades->grades[$student->id]. + ""; + } } else { $grades[$student->id][] = $currentstudentgrade = ""; + $gradeshtml[$student->id][] = ""; } if (!empty($modgrades->maxgrade)) { $totals[$student->id] = (float)($totals[$student->id]) + (float)($currentstudentgrade); @@ -190,7 +213,7 @@ $table->align[] = "CENTER"; foreach ($students as $key => $student) { - $studentgrades = $grades[$student->id]; + $studentgrades = $gradeshtml[$student->id]; $picture = print_user_picture($student->id, $course->id, $student->picture, false, true); $name = array ("$picture", "$student->firstname", "$student->lastname"); $total = array ($totals[$student->id]); -- 2.39.5