From: thepurpleblob Date: Wed, 21 Feb 2007 13:09:17 +0000 (+0000) Subject: D'oh - counting $totalcount wrongly (duplicate courses are ignored) X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=474991a19d040fc44a8415f5a33481d1cb4d513a;p=moodle.git D'oh - counting $totalcount wrongly (duplicate courses are ignored) --- diff --git a/course/search.php b/course/search.php index 1fbccb1439..d8b1667b43 100644 --- a/course/search.php +++ b/course/search.php @@ -125,7 +125,6 @@ // run through blocks and get (unique) courses $courses = array(); - $totalcount = 0; foreach ($blocks as $block) { $courseid = $block->pageid; if ($courseid==0) { @@ -135,8 +134,8 @@ 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()) { @@ -147,7 +146,6 @@ // run through modules and get (unique) courses $courses = array(); - $totalcount = 0; foreach ($modules as $module) { $courseid = $module->course; if ($courseid==0) { @@ -157,8 +155,8 @@ error( "Could not read data for courseid=$courseid" ); } $courses[$courseid] = $course; - $totalcount++; } + $totalcount = count($courses); } else { $courses = get_courses_search($searchterms, "fullname ASC",