]> git.mjollnir.org Git - moodle.git/commitdiff
Changed to dimm non-visible grades (mods). Bug #378.
authorstronk7 <stronk7>
Sat, 26 Apr 2003 19:35:27 +0000 (19:35 +0000)
committerstronk7 <stronk7>
Sat, 26 Apr 2003 19:35:27 +0000 (19:35 +0000)
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

index 9ec3244170db87d952ba24b7f70b5f72e465d481..269f77abf64ec846326eed6a9002c18a6063971d 100644 (file)
@@ -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.
                             if ($modgrades = $gradefunction($mod->instance)) {
 
                                 if (!empty($modgrades->maxgrade)) {
-                                    $maxgrade = "<BR>$strmax: $modgrades->maxgrade";
+                                    if ($mod->visible) {
+                                        $maxgrade = "$strmax: $modgrades->maxgrade";
+                                        $maxgradehtml = "<BR>$strmax: $modgrades->maxgrade";
+                                    } else {
+                                        $maxgrade = "$strmax: $modgrades->maxgrade";
+                                        $maxgradehtml = "<BR><FONT class=\"dimmed_text\">$strmax: $modgrades->maxgrade</FONT>";
+                                    }
                                 } else {
                                     $maxgrade = "";
+                                    $maxgradehtml = "";
                                 }
     
                                 $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>";
-                                $columnhtml[] = "$image ".
-                                             "<A HREF=\"$CFG->wwwroot/mod/$mod->modname/view.php?id=$mod->id\">".
-                                             "$instance->name".
-                                             "</A>$maxgrade";
+                                if ($mod->visible) {
+                                    $columnhtml[] = "$image ".
+                                                 "<A HREF=\"$CFG->wwwroot/mod/$mod->modname/view.php?id=$mod->id\">".
+                                                 "$instance->name".
+                                                 "</A>$maxgradehtml";
+                                } else {
+                                    $columnhtml[] = "$image ".
+                                                 "<A CLASS=\"dimmed\" HREF=\"$CFG->wwwroot/mod/$mod->modname/view.php?id=$mod->id\">".
+                                                 "$instance->name".
+                                                 "</A>$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][] = "<FONT class=\"dimmed_text\">".
+                                                                           $modgrades->grades[$student->id].
+                                                                           "</FONT>";
+                                        }
                                     } else {
                                         $grades[$student->id][] = $currentstudentgrade = "";
+                                        $gradeshtml[$student->id][] = "";
                                     }
                                     if (!empty($modgrades->maxgrade)) {
                                         $totals[$student->id] = (float)($totals[$student->id]) + (float)($currentstudentgrade);
         $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]);