From ac962a4f1f1158ddc11b3ed5567dadb7bedf7158 Mon Sep 17 00:00:00 2001 From: Christian Fowler Date: Fri, 9 Dec 2005 07:07:05 +0000 Subject: clean up admin for getList function --- admin/index.php | 39 ++++++++------------------------------- 1 file changed, 8 insertions(+), 31 deletions(-) (limited to 'admin') diff --git a/admin/index.php b/admin/index.php index cb67726..5a98885 100644 --- a/admin/index.php +++ b/admin/index.php @@ -1,6 +1,6 @@ assign('info', $info); } -if ( empty( $_REQUEST["sort_mode"] ) ) { - $sort_mode = 'created_desc'; -} else { - $sort_mode = $_REQUEST["sort_mode"]; -} - -if (!isset($_REQUEST["offset"])) { - $offset = 0; -} else { - $offset = $_REQUEST["offset"]; -} - -$gBitSmarty->assign_by_ref('offset', $offset); - -if (isset($_REQUEST["find"])) { - $find = $_REQUEST["find"]; -} else { - $find = ''; -} - -$gBitSmarty->assign('find', $find); - -$gBitSmarty->assign_by_ref('sort_mode', $sort_mode); -$channels = $nllib->list_newsletters($offset, $maxRecords, $sort_mode, $find); +$channels = $nllib->getList( $listHash ); -$cant_pages = ceil($channels["cant"] / $maxRecords); +$cant_pages = ceil( $channels["cant"] / $listHash['max_records'] ); $gBitSmarty->assign_by_ref('cant_pages', $cant_pages); -$gBitSmarty->assign('actual_page', 1 + ($offset / $maxRecords)); +$gBitSmarty->assign( 'actual_page', 1 + ( $listHash['offset'] / $listHash['max_records'] ) ); -if ($channels["cant"] > ($offset + $maxRecords)) { - $gBitSmarty->assign('next_offset', $offset + $maxRecords); +if( $channels["cant"] > ( $listHash['offset'] + $listHash['max_records'] ) ) { + $gBitSmarty->assign( 'next_offset', $offset + $listHash['max_records'] ); } else { $gBitSmarty->assign('next_offset', -1); } // If offset is > 0 then prev_offset -if ($offset > 0) { - $gBitSmarty->assign('prev_offset', $offset - $maxRecords); +if( $listHash['offset'] > 0) { + $gBitSmarty->assign('prev_offset', $listHash['offset'] - $listHash['max_records']); } else { $gBitSmarty->assign('prev_offset', -1); } -- cgit v1.3