pagination.php 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. <?php
  2. /**
  3. * @var \App\View\AppView $this
  4. */
  5. if (!isset($separator)) {
  6. if (defined('PAGINATOR_SEPARATOR')) {
  7. $separator = PAGINATOR_SEPARATOR;
  8. } else {
  9. $separator = '';
  10. }
  11. }
  12. if (empty($first)) {
  13. $first = __d('tools', 'first');
  14. }
  15. if (empty($last)) {
  16. $last = __d('tools', 'last');
  17. }
  18. if (empty($prev)) {
  19. $prev = __d('tools', 'previous');
  20. }
  21. if (empty($next)) {
  22. $next = __d('tools', 'next');
  23. }
  24. if (!isset($format)) {
  25. $format = __d('tools', 'Page {{page}} of {{pages}}, showing {{current}} record(s) out of {{count}} total');
  26. }
  27. if (!empty($reverse)) {
  28. $tmp = $first;
  29. $first = $last;
  30. $last = $tmp;
  31. $tmp = $prev;
  32. $prev = $next;
  33. $next = $tmp;
  34. }
  35. if (!empty($addArrows)) {
  36. $prev = '« ' . $prev;
  37. $next .= ' »';
  38. }
  39. $escape = isset($escape) ? $escape : true;
  40. ?>
  41. <div class="paginator paging row">
  42. <div class="col-lg-6">
  43. <ul class="pagination">
  44. <?php echo $this->Paginator->first($first, ['escape' => $escape]);?>
  45. <?php echo $separator; ?>
  46. <?php echo $this->Paginator->prev($prev, ['escape' => $escape, 'disabledTitle' => false]);?>
  47. <?php echo $separator; ?>
  48. <?php echo $this->Paginator->numbers(['escape' => $escape, 'separator' => $separator]);?>
  49. <?php echo $separator; ?>
  50. <?php echo $this->Paginator->next($next, ['escape' => $escape, 'disabledTitle' => false]);?>
  51. <?php echo $separator; ?>
  52. <?php echo $this->Paginator->last($last, ['escape' => $escape]);?>
  53. </ul>
  54. </div>
  55. <div class="col-lg-6">
  56. <p class="paging-description">
  57. <?php echo $this->Paginator->counter($format); ?>
  58. </p>
  59. </div>
  60. </div>
  61. <?php if (!empty($options['ajaxPagination'])) {
  62. $ajaxContainer = !empty($options['paginationContainer']) ? $options['paginationContainer'] : '.page';
  63. $script = "$(document).ready(function() {
  64. $('div.pagination a').live('click', function () {
  65. $('$ajaxContainer').fadeTo(300, 0);
  66. var thisHref = $(this).attr('href');
  67. $('$ajaxContainer').load(thisHref, function() {
  68. $(this).fadeTo(200, 1);
  69. $('html, body').animate({
  70. scrollTop: $('$ajaxContainer').offset().top
  71. }, 200);
  72. });
  73. return false;
  74. });
  75. });";
  76. if (isset($this->Js)) {
  77. $this->Js->buffer($script);
  78. }
  79. } ?>