From 7e18269f38816b557574a6782a5043ebb6b9e77d Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Mon, 22 Aug 2005 00:58:19 +0000 Subject: [PATCH] r359: Added pagination to the tracker home --- index.php | 16 +++++++++++++--- templates/trackerhome.tpl | 8 ++++++++ 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/index.php b/index.php index 9d1b493..fdec8da 100644 --- a/index.php +++ b/index.php @@ -12,7 +12,9 @@ $fetchtemplates = array( 'TRACKERHOME', - 'trackerhome_bits' + 'trackerhome_bits', + 'pagenav', + 'pagenav_bit' ); define('SVN', '$Id$'); @@ -20,6 +22,7 @@ define('SVN', '$Id$'); $focus['index'] = 'focus'; require_once('./global.php'); +require_once('./includes/class_pagination.php'); if (!can_perform('canviewbugs')) { @@ -28,7 +31,10 @@ if (!can_perform('canviewbugs')) // ################################################################### -// #*# pagination needs to be done here +$pagination = new Pagination('p', 'pp'); +$count = $db->query_first("SELECT COUNT(*) AS count FROM " . TABLE_PREFIX . "bug" . (!can_perform('canviewhidden') ? "WHERE !hidden" : "")); +$pagination->total = $count['count']; +$pagination->split_pages(); $bugs_fetch = $db->query(" SELECT bug.*, user1.displayname AS firstreport, user2.displayname AS lastpost, user3.displayname AS hiddenlastpost @@ -40,7 +46,8 @@ $bugs_fetch = $db->query(" LEFT JOIN user AS user3 ON (bug.hiddenlastpostby = user3.userid)" . ((!can_perform('canviewhidden')) ? " WHERE !hidden" : "") . " - ORDER BY bug." . ((can_perform('canviewhidden')) ? "lastposttime" : "hiddenlastposttime") . " DESC" + ORDER BY bug." . ((can_perform('canviewhidden')) ? "lastposttime" : "hiddenlastposttime") . " DESC + LIMIT " . $pagination->fetch_limit($pagination->page - 1) . ", " . $pagination->perpage ); while ($bug = $db->fetch_array($bugs_fetch)) @@ -63,6 +70,9 @@ while ($bug = $db->fetch_array($bugs_fetch)) $db->free_result($bugs_fetch); +$show['pagenav'] = (($pagination->pagecount > 1) ? true : false); +$pagenav = $pagination->construct_page_nav('index.php'); + eval('$template->flush("' . $template->fetch('TRACKERHOME') . '");'); /*=====================================================================*\ diff --git a/templates/trackerhome.tpl b/templates/trackerhome.tpl index e6dd4ca..33052a5 100644 --- a/templates/trackerhome.tpl +++ b/templates/trackerhome.tpl @@ -18,4 +18,12 @@ $header $bugs + + +
+$pagenav +
+ +
+ $footer \ No newline at end of file -- 2.43.5