1
0
mirror of https://github.com/e107inc/e107.git synced 2025-01-29 10:38:08 +01:00

Fixes #2413 - Pagination issue with empty records.

This commit is contained in:
Cameron 2017-02-12 07:58:42 -08:00
parent 45b7f1eeb1
commit 84a4cc36e5
3 changed files with 41 additions and 2 deletions

View File

@ -286,6 +286,9 @@ function nextprev_shortcode($parm = '')
}
}
// Add 'first', 'previous' navigation
if($show_prev)
{
@ -306,6 +309,21 @@ function nextprev_shortcode($parm = '')
}
}
if($tprefix === 'basic_' && $show_prev === false)
{
if(!empty($tmpl[$tprefix.'nav_prev']))
{
$e_vars->url = '#';
$e_vars->label = $LAN_NP_PREVIOUS;
$e_vars->url_label = '';
$e_vars->disabled = "disabled";
$ret_array[] = $tp->simpleParse($tmpl[$tprefix.'nav_prev'], $e_vars);
$e_vars->disabled = '';
}
}
$e_vars_loop = new e_vars();
$e_vars_loop->bullet = stripslashes($bullet); // fix magicquotes
$ret_items = array();
@ -353,6 +371,22 @@ function nextprev_shortcode($parm = '')
}
}
if($tprefix === 'basic_' && $show_next === false)
{
if(!empty($tmpl[$tprefix.'nav_next']))
{
$e_vars->url = '#';
$e_vars->label = $LAN_NP_NEXT;
$e_vars->url_label = '';
$e_vars->disabled = "disabled";
$ret_array[] = $tp->simpleParse($tmpl[$tprefix.'nav_next'], $e_vars);
$e_vars->disabled = '';
}
}
$ret .= implode($tmpl[$tprefix.'separator'], $ret_array);
// Nextprev navigation end

View File

@ -95,9 +95,9 @@ $NEXTPREV_TEMPLATE['basic_start'] = '<!-- Start of Next/Prev --><div class="
$NEXTPREV_TEMPLATE['basic_end'] = '</div><!-- End of Next/Prev -->';
$NEXTPREV_TEMPLATE['basic_nav_caption'] = '';
$NEXTPREV_TEMPLATE['basic_nav_first'] = '';
$NEXTPREV_TEMPLATE['basic_nav_prev'] = '<a class="btn btn-default nextprev-item prev" href="{url}" title="{url_label}"><i class="fa fa-backward"></i></a>';
$NEXTPREV_TEMPLATE['basic_nav_prev'] = '<a class="btn btn-default nextprev-item prev" href="{url}" title="{url_label}" {disabled}><i class="fa fa-backward"></i></a>';
$NEXTPREV_TEMPLATE['basic_nav_last'] = '';
$NEXTPREV_TEMPLATE['basic_nav_next'] = '<a class="btn btn-default nextprev-item next " href="{url}" title="{url_label}"><i class="fa fa-forward"></i></a>';
$NEXTPREV_TEMPLATE['basic_nav_next'] = '<a class="btn btn-default nextprev-item next " href="{url}" title="{url_label}" {disabled}><i class="fa fa-forward"></i></a>';
$NEXTPREV_TEMPLATE['basic_items_start'] = '';
$NEXTPREV_TEMPLATE['basic_item'] = '';
$NEXTPREV_TEMPLATE['basic_item_current'] = '<a class="btn btn-default">{label}</a>';

View File

@ -1801,6 +1801,11 @@ class e_form
public function pagination($url='', $total=0, $from=0, $perPage=10, $options=array())
{
if(empty($total))
{
return '';
}
if(!is_numeric($total))
{
return '<ul class="pager"><li><a href="'.$url.'">'.$total.'</a></li></ul>';