From 8ef9cb5618c0219d24fa55363ee3dbbe56e69dc6 Mon Sep 17 00:00:00 2001 From: moodler Date: Thu, 21 Aug 2003 09:33:07 +0000 Subject: [PATCH] Some fixes to handle very very big categories. - paging - more efficient SQL --- course/category.php | 8 +++++++- course/lib.php | 7 ++++++- course/search.php | 4 ++-- lib/datalib.php | 47 ++++++++++++++++++++++++++++++++------------- lib/weblib.php | 4 +++- 5 files changed, 52 insertions(+), 18 deletions(-) diff --git a/course/category.php b/course/category.php index c12853c14a..0a556c22b6 100644 --- a/course/category.php +++ b/course/category.php @@ -7,6 +7,8 @@ require_once("lib.php"); require_variable($id); // Category id + optional_variable($page, "0"); // which page to show + optional_variable($perpage, "20"); // how many per page if (!$site = get_site()) { @@ -211,11 +213,15 @@ /// Print out all the courses - if (!$courses = get_courses($category->id)) { + if (!$courses = get_courses($category->id, "sortorder ASC", "c.*", $totalcount, $page*$perpage, $perpage)) { print_heading(get_string("nocoursesyet")); } else { + echo "
"; + print_paging_bar($totalcount, $page, $perpage, "category.php?id=$category->id&perpage=$perpage&"); + echo "
"; + $strcourses = get_string("courses"); $strselect = get_string("select"); $stredit = get_string("edit"); diff --git a/course/lib.php b/course/lib.php index 5857ca499f..c75c24ff84 100644 --- a/course/lib.php +++ b/course/lib.php @@ -899,7 +899,12 @@ function print_category_info($category, $depth) { for ($i=0; $i<$depth;$i++) { echo "