public/wordpress/wp-content/plugins/wp-courseware/includes/legacy/admin/functions.php
/**
 * Show the section that deals with pagination.
 *
 * @since 1.0.0
 *
 * @param string  $baseURL The URL to use that starts of the paging.
 * @param integer $pageNumber The current page.
 * @param integer $pageCount The number of pages.
 * @param integer $dataCount The number of data rows.
 * @param integer $recordStart The current record number.
 * @param integer $recordEnd The ending record number.
 * @param string  $leftControls The HTML for controls shown on the left.
 */
Show the section that deals with pagination.

@param string  $baseURL The URL to use that starts of the paging.
@param integer $pageNumber The current page.
@param integer $pageCount The number of pages.
@param integer $dataCount The number of data rows.
@param integer $recordStart The current record number.
@param integer $recordEnd The ending record number.
@param string  $leftControls The HTML for controls shown on the left.
Show the section that deals with pagination . @param string $baseURL The URL to use that starts of the paging . @param integer $pageNumber The current page . @param integer $pageCount The number of pages . @param integer $dataCount The number of data rows . @param integer $recordStart The current record number . @param integer $recordEnd The ending record number . @param string $leftControls The HTML for controls shown on the left .
function WPCW_tables_showPagination( $baseURL, $pageNumber, $pageCount, $dataCount, $recordStart, $recordEnd, $leftControls = false ) {
	$html = '<div class="tablenav wpcw_tbl_paging">';
	$html .= '<div class="wpbs_paging tablenav-pages">';
	$html .= sprintf( '<span class="displaying-num">Displaying %s &ndash; %s of %s</span>',
		$recordStart,
		( $dataCount < $recordEnd ? $dataCount : $recordEnd ), 
		$dataCount
	);
		if ( $pageCount > 1 ) {
		if ( $pageNumber > 1 ) {
			$html .= sprintf( '<a href="%s%d" class="prev page-numbers" data-pagenum="%d">&laquo;</a>' . "\n",
				$baseURL,
				$pageNumber - 1,
				$pageNumber - 1
			);
		}
		$pageList = array();
		$pageList[] = 1;
		$pageList[] = $pageCount;
		if ( $pageNumber - 3 > 1 ) {
			$pageList[] = $pageNumber - 3;
		}
		if ( $pageNumber - 2 > 1 ) {
			$pageList[] = $pageNumber - 2;
		}
		if ( $pageNumber - 1 > 1 ) {
			$pageList[] = $pageNumber - 1;
		}
		if ( $pageNumber + 1 < $pageCount ) {
			$pageList[] = $pageNumber + 1;
		}
		if ( $pageNumber + 2 < $pageCount ) {
			$pageList[] = $pageNumber + 2;
		}
		if ( $pageNumber + 3 < $pageCount ) {
			$pageList[] = $pageNumber + 3;
		}
		if ( $pageNumber != $pageCount && $pageNumber != 1 ) {
			$pageList[] = $pageNumber;
		}
		sort( $pageList );
		$previous = 0;
		foreach ( $pageList as $pageLink ) {
			if ( $previous > 0 && ( $pageLink - $previous ) > 1 ) {
				$html .= '<span class="page-numbers dots">...</span>';
			}
			$html .= sprintf( '<a href="%s%d" class="page-numbers %s" data-pagenum="%d">%s</a>',
				$baseURL,
				$pageLink,
				( $pageNumber == $pageLink ? 'current' : '' ),
				$pageLink,
				$pageLink
			);
			$previous = $pageLink;
		}
		if ( $pageCount > $pageNumber ) {
			$html .= sprintf( '<a href="%s%s" class="next page-numbers" data-pagenum="%d">&raquo;</a>',
				$baseURL,
				$pageNumber + 1,
				$pageNumber + 1
			);
		}
	} 
	$html .= '</div>'; 
	$html .= '</div>'; 
	$html .= $leftControls;
	return $html;
}
function WPCW_tables_showPagination ( $ baseURL , $ pageNumber , $ pageCount , $ dataCount , $ recordStart , $ recordEnd , $ leftControls = false ) { $ html = '<div class="tablenav wpcw_tbl_paging">' ; $ html .= '<div class="wpbs_paging tablenav-pages">' ; $ html .= sprintf ( '<span class="displaying-num">Displaying %s &ndash; %s of %s</span>' , $ recordStart , ( $ dataCount < $ recordEnd ? $ dataCount : $ recordEnd ) , $ dataCount ) ; if ( $ pageCount > 1 ) { if ( $ pageNumber > 1 ) { $ html .= sprintf ( '<a href="%s%d" class="prev page-numbers" data-pagenum="%d">&laquo;</a>' . " \n " , $ baseURL , $ pageNumber - 1 , $ pageNumber - 1 ) ; } $ pageList = array ( ) ; $ pageList [ ] = 1 ; $ pageList [ ] = $ pageCount ; if ( $ pageNumber - 3 > 1 ) { $ pageList [ ] = $ pageNumber - 3 ; } if ( $ pageNumber - 2 > 1 ) { $ pageList [ ] = $ pageNumber - 2 ; } if ( $ pageNumber - 1 > 1 ) { $ pageList [ ] = $ pageNumber - 1 ; } if ( $ pageNumber + 1 < $ pageCount ) { $ pageList [ ] = $ pageNumber + 1 ; } if ( $ pageNumber + 2 < $ pageCount ) { $ pageList [ ] = $ pageNumber + 2 ; } if ( $ pageNumber + 3 < $ pageCount ) { $ pageList [ ] = $ pageNumber + 3 ; } if ( $ pageNumber != $ pageCount && $ pageNumber != 1 ) { $ pageList [ ] = $ pageNumber ; } sort ( $ pageList ) ; $ previous = 0 ; foreach ( $ pageList as $ pageLink ) { if ( $ previous > 0 && ( $ pageLink - $ previous ) > 1 ) { $ html .= '<span class="page-numbers dots">...</span>' ; } $ html .= sprintf ( '<a href="%s%d" class="page-numbers %s" data-pagenum="%d">%s</a>' , $ baseURL , $ pageLink , ( $ pageNumber == $ pageLink ? 'current' : '' ) , $ pageLink , $ pageLink ) ; $ previous = $ pageLink ; } if ( $ pageCount > $ pageNumber ) { $ html .= sprintf ( '<a href="%s%s" class="next page-numbers" data-pagenum="%d">&raquo;</a>' , $ baseURL , $ pageNumber + 1 , $ pageNumber + 1 ) ; } } $ html .= '</div>' ; $ html .= '</div>' ; $ html .= $ leftControls ; return $ html ; }
Show the section that deals with pagination.
Show the section that deals with pagination .
// ensure that the upper number of the record matches how many are left. // Got more than 1 page?
 // Always have first and last page linked // Have 3 pages either side of page we're on // Plus we want the current page // Sort pages in order and then render them // Add dots if a large gap between numbers // Want to check what the previous one is // Got pages left at the end // end of it pageCount > 1 // end of tablenav-pages // end of tablenav