Function Reference: geodir_payment_invoices_pagination

Summary

This function has not been documented yet.

Source Code

function geodir_payment_invoices_pagination($total_items, $per_page, $pageno, $before = '', $after = '', $prelabel = '', $nxtlabel = '', $pages_to_show = 5, $always_show = false) {
    if (empty($prelabel)) {
        $prelabel = '<strong>&laquo;</strong>';
    }

    if (empty($nxtlabel)) {
        $nxtlabel = '<strong>&raquo;</strong>';
    }

    $half_pages_to_show = round($pages_to_show / 2);

	$numitems = $total_items;

	$max_page = ceil($numitems / $per_page);

	if (empty($pageno)) {
		$pageno = 1;
	}

	ob_start();
	if ($max_page > 1 || $always_show) {
		// Extra pagination info
		$geodir_pagination_more_info = get_option('geodir_pagination_advance_info');
		$start_no = ( $pageno - 1 ) * $per_page + 1;
		$end_no = min($pageno * $per_page, $numitems);
		
		if ($geodir_pagination_more_info != '') {
			$pagination_info = '<div class="gd-pagination-details">' . wp_sprintf(__('Showing items %d-%d of %d', 'geodir_payments'), $start_no, $end_no, $numitems) . '</div>';
			
			if ($geodir_pagination_more_info == 'before') {
				$before = $before . $pagination_info;
			} else if ($geodir_pagination_more_info == 'after') {
				$after = $pagination_info . $after;
			}
		}
			
		echo "$before <div class='Navi geodir-ajax-pagination'>";		
		if ($pageno > 1) {
			echo '<a class="gd-page-sc-fst" href="javascript:void(0);" onclick="gd_invoice_gopage(this, 1);">&laquo;</a>&nbsp;';
		}
		
		if (($pageno - 1) > 0) {
			echo '<a class="gd-page-sc-prev" href="javascript:void(0);" onclick="gd_invoice_gopage(this, ' . (int)($pageno - 1) . ');">' . $prelabel . '</a>&nbsp;';
		}
		
		for ($i = $pageno - $half_pages_to_show; $i <= $pageno + $half_pages_to_show; $i++) {
			if ($i >= 1 && $i <= $max_page) {
				if ($i == $pageno) {
					echo "<strong class='on' class='gd-page-sc-act'>$i</strong>";
				} else {
					echo ' <a class="gd-page-sc-no" href="javascript:void(0);" onclick="gd_invoice_gopage(this, ' . (int)$i . ');">' . $i . '</a> ';
				}
			}
		}
		
		if (($pageno + 1) <= $max_page) {
			echo '&nbsp;<a class="gd-page-sc-nxt" href="javascript:void(0);" onclick="gd_invoice_gopage(this, ' . (int)($pageno + 1) . ');">' . $nxtlabel . '</a>';
		}
		
		if ($pageno < $max_page) {
			echo '&nbsp;<a class="gd-page-sc-lst" href="javascript:void(0);" onclick="gd_invoice_gopage(this, ' . (int)$max_page . ');">&raquo;</a>';
		}
		echo "</div> $after";
	}
	$output = ob_get_contents();
    ob_end_clean();

    return trim($output);
}