Skip to content
Browse files

Don't show column grade when there's nothing to show

  • Loading branch information...
1 parent caadf00 commit 4db9d14dad0f9a92cc468b92dbf48f8cf185c879 moodler committed Oct 21, 2002
Showing with 29 additions and 22 deletions.
  1. +21 −20 course/grades.php
  2. +6 −0 mod/forum/lib.php
  3. +2 −2 mod/forum/mod.html
View
41 course/grades.php
@@ -61,28 +61,29 @@
require_once($libfile);
$gradefunction = $mod->modname."_grades";
if (function_exists($gradefunction)) { // Skip modules without grade function
- $modgrades = $gradefunction($mod->instance);
+ if ($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>";
- $columnhtml[] = "$image ".
- "<A HREF=\"$CFG->wwwroot/mod/$mod->modname/view.php?id=$mod->id\">".
- "$instance->name".
- "</A>$maxgrade";
- $columns[] = "$mod->modfullname: $instance->name - $modgrades->maxgrade";
-
- foreach ($students as $student) {
- $grades[$student->id][] = $modgrades->grades[$student->id]; // may be empty, that's ok
if ($modgrades->maxgrade) {
- $totals[$student->id] = (float)($totals[$student->id]) + (float)($modgrades->grades[$student->id]);
+ $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>";
+ $columnhtml[] = "$image ".
+ "<A HREF=\"$CFG->wwwroot/mod/$mod->modname/view.php?id=$mod->id\">".
+ "$instance->name".
+ "</A>$maxgrade";
+ $columns[] = "$mod->modfullname: $instance->name - $modgrades->maxgrade";
+
+ foreach ($students as $student) {
+ $grades[$student->id][] = $modgrades->grades[$student->id]; // may be empty, that's ok
+ if ($modgrades->maxgrade) {
+ $totals[$student->id] = (float)($totals[$student->id]) + (float)($modgrades->grades[$student->id]);
+ }
}
}
}
View
6 mod/forum/lib.php
@@ -366,6 +366,12 @@ function forum_grades($forumid) {
/// Must return an array of grades, indexed by user, and a max grade.
global $FORUM_POST_RATINGS;
+ if (!$forum = get_record("forum", "id", $forumid)) {
+ return false;
+ }
+ if (!$forum->assessed) {
+ return false;
+ }
if ($ratings = get_records_sql_menu("SELECT p.user, r.rating
FROM forum_discussions d, forum_posts p, forum_ratings r
WHERE d.forum = '$forumid'
View
4 mod/forum/mod.html
@@ -34,8 +34,8 @@
<tr valign=top>
<td align=right><P><B><? print_string("allowdiscussions", "forum", strtolower("$course->student")) ?>:</B></P></TD>
<td>
- <? choose_from_menu($FORUM_OPEN_MODES, "open", $form->open, ""); ?>
- <? helpbutton("allowdiscussions", get_string("allowdiscussions", "forum"), "forum") ?>
+ <? choose_from_menu($FORUM_OPEN_MODES, "open", $form->open, ""); ?>
+ <? helpbutton("allowdiscussions", get_string("allowdiscussions", "forum", strtolower("$course->student")), "forum") ?>
</td>
</tr>

0 comments on commit 4db9d14

Please sign in to comment.
Something went wrong with that request. Please try again.