Initial commit
This commit is contained in:
67
playarea/templates/productCategory/pagination.php
Normal file
67
playarea/templates/productCategory/pagination.php
Normal file
@@ -0,0 +1,67 @@
|
||||
<?php
|
||||
|
||||
$current_page = $variables["current_page"];
|
||||
$items_per_page = $variables["items_per_page"];
|
||||
$items_count = $variables["items_count"];
|
||||
|
||||
$space = 4;
|
||||
|
||||
$delta = intval($items_count / $items_per_page);
|
||||
$pages_max = $delta > 0 ? $items_count % $items_per_page > 0 ? $delta + 1: $delta: 1;
|
||||
|
||||
$last_page = $current_page > 1 ? $current_page - 1 : $current_page;
|
||||
$next_page = $current_page < $pages_max ? $current_page + 1 : $current_page;
|
||||
|
||||
$first_pages = min($pages_max, $space);
|
||||
if($current_page == $space || $current_page == $space + 1) $first_pages++;
|
||||
|
||||
$last_pages = $pages_max - ($space - 1);
|
||||
if($last_pages == $current_page || $last_pages - 1 == $current_page) $last_pages--;
|
||||
|
||||
?>
|
||||
|
||||
<ul id="pagination" class="article-rew__list list-digits row">
|
||||
<li class="list-digits__item col-auto">
|
||||
<a href="<?= $b->router_format_get_params(array("page" => $last_page), true, array("b_event")); ?>" data-href="<?= $b->router_format_get_params(array("page" => $last_page), true, array("b_event")); ?>" class="list-digits__arrow" data-category-update="true" data-category-params='<?= json_encode($b->router_edit_get_params(array("page" => $last_page), true)); ?>'>
|
||||
<svg class="list-digits__image">
|
||||
<use xlink:href="<?= $b->pa_get_assets_dir() ?>main/images/icons/sprite.svg#pag-prev"></use>
|
||||
</svg>
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<?php for($i = 1; $i <= $first_pages; $i++) { ?>
|
||||
<li class="list-digits__item <?= $i == $current_page ? "active" : ""; ?> col-auto">
|
||||
<a href="<?= $b->router_format_get_params(array("page" => $i), true, array("b_event")); ?>" data-href="<?= $b->router_format_get_params(array("page" => $i), true, array("b_event")); ?>" class="list-digits__link" data-category-update="true" data-category-params='<?= json_encode($b->router_edit_get_params(array("page" => $i), true)); ?>'><?= $i; ?></a>
|
||||
</li>
|
||||
<?php } ?>
|
||||
|
||||
<?php if($current_page < $last_pages && $current_page > $first_pages) { ?>
|
||||
<li class="list-digits__item col-auto">
|
||||
<div class="list-digits__link">...</div>
|
||||
</li>
|
||||
<?php for($i = $current_page - 1; $i <= $current_page + 1; $i++) { ?>
|
||||
<li class="list-digits__item <?= $i == $current_page ? "active" : ""; ?> col-auto">
|
||||
<a href="<?= $b->router_format_get_params(array("page" => $i), true, array("b_event")); ?>" data-href="<?= $b->router_format_get_params(array("page" => $i), true, array("b_event")); ?>" class="list-digits__link" data-category-update="true" data-category-params='<?= json_encode($b->router_edit_get_params(array("page" => $i), true)); ?>'><?= $i; ?></a>
|
||||
</li>
|
||||
<?php } ?>
|
||||
<?php } ?>
|
||||
|
||||
<?php if($pages_max > $space * 2) { ?>
|
||||
<li class="list-digits__item col-auto">
|
||||
<div class="list-digits__link">...</div>
|
||||
</li>
|
||||
<?php for($i = $last_pages; $i <= $pages_max; $i++) { ?>
|
||||
<li class="list-digits__item <?= $i == $current_page ? "active" : ""; ?> col-auto">
|
||||
<a href="<?= $b->router_format_get_params(array("page" => $i), true, array("b_event")); ?>" data-href="<?= $b->router_format_get_params(array("page" => $i), true, array("b_event")); ?>" class="list-digits__link" data-category-update="true" data-category-params='<?= json_encode($b->router_edit_get_params(array("page" => $i), true)); ?>'><?= $i; ?></a>
|
||||
</li>
|
||||
<?php } ?>
|
||||
<?php } ?>
|
||||
|
||||
<li class="list-digits__item col-auto">
|
||||
<a href="<?= $b->router_format_get_params(array("page" => $next_page), true, array("b_event")); ?>" data-href="<?= $b->router_format_get_params(array("page" => $next_page), true, array("b_event")); ?>" class="list-digits__arrow" data-category-update="true" data-category-params='<?= json_encode($b->router_edit_get_params(array("page" => $next_page), true)); ?>'>
|
||||
<svg class="list-digits__image">
|
||||
<use xlink:href="<?= $b->pa_get_assets_dir() ?>main/images/icons/sprite.svg#pag-next"></use>
|
||||
</svg>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
Reference in New Issue
Block a user