]> git.mjollnir.org Git - moodle.git/commitdiff
I'm getting wierd numbers of records returned on moodle.org.
authormoodler <moodler>
Mon, 28 Apr 2003 16:13:46 +0000 (16:13 +0000)
committermoodler <moodler>
Mon, 28 Apr 2003 16:13:46 +0000 (16:13 +0000)
This fix makes the page a bit more robust even if this is
happening.

user/index.php

index b92f058b654f30acbfdff933c60c7559d2e6d1e4..7681e775072af67cf9b4cd2947ad923aaadb5615 100644 (file)
@@ -68,6 +68,8 @@
         $limit = "";
     }
 
+    $numstudentsall = count_records("user_students", "course", $course->id);
+
     if ($students = get_course_students($course->id, "$dsort $dir $limit")) {
         $numstudents = count($students);
         echo "<h2 align=center>$numstudents $course->students</h2>";
             }
             print_table($table);
 
-            if ($numstudents == USER_LARGE_CLASS and !$showall) {
-                $numstudents = count_records("user_students", "course", $course->id);
-                $moreinfo->count  = USER_LARGE_CLASS;
+            if ($numstudents < $numstudentsall and !$showall) {
+                $moreinfo->count  = $numstudents;
                 $moreinfo->things = strtolower($course->students);
                 echo "<center><p>".get_string("displayingfirst", "", $moreinfo);
-                echo " (<a href=\"index.php?id=$course->id&sort=$sort&dir=$dir&showall=1\">".get_string("showall", "", $numstudents)."</a>)";
+                echo " (<a href=\"index.php?id=$course->id&sort=$sort&dir=$dir&showall=1\">".get_string("showall", "", $numstudentsall)."</a>)";
                 echo "</p></center>";
             }