]> git.mjollnir.org Git - moodle.git/commitdiff
D'oh - counting $totalcount wrongly (duplicate courses are ignored)
authorthepurpleblob <thepurpleblob>
Wed, 21 Feb 2007 13:09:17 +0000 (13:09 +0000)
committerthepurpleblob <thepurpleblob>
Wed, 21 Feb 2007 13:09:17 +0000 (13:09 +0000)
course/search.php

index 1fbccb1439f709c8ee07a88f8f0db742cb8c628d..d8b1667b432c270a25321c27449c40389d9bd5a2 100644 (file)
 
         // run through blocks and get (unique) courses
         $courses = array();
-        $totalcount = 0;
         foreach ($blocks as $block) {
             $courseid = $block->pageid;
             if ($courseid==0) {
                 error( "Could not read data for courseid=$courseid" );
             }
             $courses[$courseid] = $course;
-            $totalcount++;
         }
+        $totalcount = count( $courses );
     }
     // get list of courses containing modules if required
     elseif (!empty($modulelist) and confirm_sesskey()) {
 
         // run through modules and get (unique) courses
         $courses = array();
-        $totalcount = 0;
         foreach ($modules as $module) {
             $courseid = $module->course;
             if ($courseid==0) {
                 error( "Could not read data for courseid=$courseid" );
             }
             $courses[$courseid] = $course;
-            $totalcount++;
         }
+        $totalcount = count($courses);
     }
     else {
         $courses = get_courses_search($searchterms, "fullname ASC",