Separate previous, pages and next buttons.
This commit is contained in:
parent
1c7d48575f
commit
af8ad218be
@ -221,7 +221,6 @@ function parseDateTime($dateTime, $timezone)
|
||||
return DateTime::createFromFormat(jsonDateTimeFormat, $dateTime, $timezone);
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* Converts an interval to minutes, days or months, depending on the size.
|
||||
*
|
||||
@ -250,28 +249,48 @@ function approximateHumanInterval($interval)
|
||||
return $humanString;
|
||||
}
|
||||
|
||||
function echoPageNavigation($page, $maxPage)
|
||||
/**
|
||||
* @param int $page
|
||||
* @return string
|
||||
*/
|
||||
function htmlPreviousLink($page)
|
||||
{
|
||||
$previous = $page != 0;
|
||||
$next = $page != $maxPage;
|
||||
$html = '';
|
||||
|
||||
if ($previous)
|
||||
if ($page != 0)
|
||||
{
|
||||
$vars = $_GET;
|
||||
$vars['page'] = $page - 1;
|
||||
echo '<a href=?' . http_build_query($vars) . '>Previous</a> ';
|
||||
$html = '<a href=?' . http_build_query($vars) . '>Previous</a>';
|
||||
}
|
||||
|
||||
echo ' ' . htmlPageNumbers($page, $maxPage) . ' ';
|
||||
return $html;
|
||||
}
|
||||
|
||||
if ($next)
|
||||
/**
|
||||
* @param int $page
|
||||
* @param int $maxPage
|
||||
* @return string
|
||||
*/
|
||||
function htmlNextLink($page, $maxPage)
|
||||
{
|
||||
$html = '';
|
||||
|
||||
if ($page < $maxPage)
|
||||
{
|
||||
$vars = $_GET;
|
||||
$vars['page'] = $page + 1;
|
||||
echo ' <a href=?' . http_build_query($vars) . '>Next</a>';
|
||||
$html = '<a href=?' . http_build_query($vars) . '>Next</a> ';
|
||||
}
|
||||
|
||||
return $html;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $page
|
||||
* @param int $maxPage
|
||||
* @return string
|
||||
*/
|
||||
function htmlPageNumbers($page, $maxPage)
|
||||
{
|
||||
$html = '';
|
||||
@ -442,7 +461,13 @@ if ($validIdentifier)
|
||||
<?php } ?>
|
||||
</div>
|
||||
<div>
|
||||
<?php echoPageNavigation($page, $maxPage) ?>
|
||||
<?php
|
||||
// TODO separate these into 3 divs aligned bottom-centre
|
||||
// this ensures these links are in the same place every time
|
||||
echo htmlPreviousLink($page);
|
||||
echo htmlPageNumbers($page, $maxPage);
|
||||
echo htmlNextLink($page, $maxPage);
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
<div id="users" class="col-lg-5">
|
||||
|
Loading…
Reference in New Issue
Block a user