From 786fb119446f7f5b611195d168b5f9551824d120 Mon Sep 17 00:00:00 2001 From: Lester Caine Date: Sun, 23 Mar 2008 12:09:56 +0000 Subject: Tidy user content list pagination --- index.php | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) (limited to 'index.php') diff --git a/index.php b/index.php index 01d5641..d18b9a7 100644 --- a/index.php +++ b/index.php @@ -1,8 +1,8 @@ isValid() && (( $gBitUser->hasPe $browserTitle = $userHomeTitle; if( $gBitUser->hasPermission( 'p_liberty_list_content' ) ) { + // some content specific offsets and pagination settings if( !empty( $_REQUEST['sort_mode'] ) ) { $content_sort_mode = $_REQUEST['sort_mode']; - $gBitSmarty->assign( 'sort_mode', $content_sort_mode ); } $max_content = $gBitSystem->getConfig( 'max_records' ); - $offset_content = !empty( $_REQUEST['offset'] ) ? $_REQUEST['offset'] : 0; - $gBitSmarty->assign( 'curPage', $page = !empty( $_REQUEST['page'] ) ? $_REQUEST['page'] : 1 ); - $offset_content = ( $page - 1 ) * $gBitSystem->getConfig( 'max_records' ); // set the user_id to only display content viewing user - $_REQUEST['user_id'] = $gBitUser->mUserId; $_REQUEST['user_id'] = $gQueryUserId; $gBitSmarty->assign( 'user_id', $gQueryUserId); // now that we have all the offsets, we can get the content list include_once( LIBERTY_PKG_PATH.'get_content_list_inc.php' ); - // calculate page number - $numPages = ceil( $contentList['cant'] / $gBitSystem->getConfig( 'max_records' ) ); - $gBitSmarty->assign( 'numPages', $numPages ); - //$gBitSmarty->assign_by_ref('offset', $offset); $gBitSmarty->assign( 'contentSelect', $contentSelect ); $gBitSmarty->assign( 'contentTypes', $contentTypes ); $gBitSmarty->assign( 'contentList', $contentList['data'] ); - $gBitSmarty->assign( 'contentCount', $contentList['cant'] ); // needed by pagination - $contentList['listInfo']['parameters']['content_type_guid'] = $contentSelect; - $contentList['listInfo']['parameters']['user_id'] = $gQueryUserId; + $contentList['listInfo']['ihash']['content_type_guid'] = $contentSelect; + $contentList['listInfo']['ihash']['user_id'] = $gQueryUserId; + $contentList['listInfo']['ihash']['find_objects'] = $contentList['listInfo']['find']; $gBitSmarty->assign( 'listInfo', $contentList['listInfo'] ); $gBitSmarty->assign( 'display_content_list', 1 ); -- cgit v1.3