Move pagination to fieldset

This commit is contained in:
Jakub Vrana 2018-02-13 22:17:59 +01:00
parent 8b157a673e
commit 30d0060b96

View file

@ -478,15 +478,28 @@ if (!$columns && support("table")) {
}
}
if ($limit != "" && ($found_rows === false || $found_rows > $limit || $page)) {
echo "<p>\n";
$pagination = ($limit != "" && ($found_rows === false || $found_rows > $limit || $page));
if ($pagination) {
echo (($found_rows === false ? count($rows) + 1 : $found_rows - $page * $limit) > $limit
? '<p><a href="' . h(remove_from_uri("page") . "&page=" . ($page + 1)) . '" class="loadmore">' . lang('Load more data') . '</a>'
. script("qsl('a').onclick = partial(selectLoadMore, " . (+$limit) . ", '" . lang('Loading') . "...');", "")
: ''
);
echo "\n";
}
}
echo "<div class='footer'><div>\n";
if ($rows || $page) {
if ($pagination) {
// display first, previous 4, next 4 and last page
$max_page = ($found_rows === false
? $page + (count($rows) >= $limit ? 2 : 1)
: floor(($found_rows - 1) / $limit)
);
echo "<fieldset>";
if ($jush != "simpledb") {
echo '<a href="' . h(remove_from_uri("page")) . '">' . lang('Page') . "</a>:";
echo "<legend><a href='" . h(remove_from_uri("page")) . "'>" . lang('Page') . "</a></legend>";
echo script("qsl('a').onclick = function () { pageClick(this.href, +prompt('" . lang('Page') . "', '" . ($page + 1) . "')); return false; };");
echo pagination(0, $page) . ($page > 5 ? " ..." : "");
for ($i = max(1, $page - 4); $i < min($max_page, $page + 5); $i++) {
@ -499,23 +512,15 @@ if (!$columns && support("table")) {
: " <a href='" . h(remove_from_uri("page") . "&page=last") . "' title='~$max_page'>" . lang('last') . "</a>"
);
}
echo (($found_rows === false ? count($rows) + 1 : $found_rows - $page * $limit) > $limit
? ' <a href="' . h(remove_from_uri("page") . "&page=" . ($page + 1)) . '" class="loadmore">' . lang('Load more data') . '</a>'
. script("qsl('a').onclick = partial(selectLoadMore, " . (+$limit) . ", '" . lang('Loading') . "...');", "")
: ''
);
} else {
echo lang('Page') . ":";
echo "<legend>" . lang('Page') . "</legend>";
echo pagination(0, $page) . ($page > 1 ? " ..." : "");
echo ($page ? pagination($page, $page) : "");
echo ($max_page > $page ? pagination($page + 1, $page) . ($max_page > $page + 1 ? " ..." : "") : "");
}
echo "\n";
echo "</fieldset>\n";
}
}
echo "<div class='footer'><div>\n";
if ($rows || $page) {
echo "<fieldset>";
echo "<legend>" . lang('Whole result') . "</legend>";
$display_rows = ($exact_count ? "" : "~ ") . $found_rows;