Guest User

Untitled

a guest
Oct 18th, 2018
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.37 KB | None | 0 0
  1. <?php
  2. if (!isset($modules)) {
  3. $modulus = 11;
  4. }
  5. if (!isset($model)) {
  6. $models = ClassRegistry::keys();
  7. $model = Inflector::camelize(current($models));
  8. }
  9. ?>
  10. <div class="pagination">
  11. <ul>
  12. <?php echo $this->Paginator->prev('&laquo;', array(
  13. 'tag' => 'li',
  14. 'class' => 'prev',
  15. 'escape' => false
  16. ), $this->Paginator->link('&laquo;', array(), array('escape' => false)), array(
  17. 'tag' => 'li',
  18. 'escape' => false,
  19. 'class' => 'prev disabled',
  20. )); ?>
  21. <?php
  22. $page = $this->params['paging'][$model]['page'];
  23. $pageCount = $this->params['paging'][$model]['pageCount'];
  24. if ($modulus > $pageCount) {
  25. $modulus = $pageCount;
  26. }
  27. $start = $page - intval($modulus / 2);
  28. if ($start < 1) {
  29. $start = 1;
  30. }
  31. $end = $start + $modulus;
  32. if ($end > $pageCount) {
  33. $end = $pageCount + 1;
  34. $start = $end - $modulus;
  35. }
  36. for ($i = $start; $i < $end; $i++) {
  37. $url = array('page' => $i);
  38. $class = null;
  39. if ($i == $page) {
  40. $url = array();
  41. $class = 'active';
  42. }
  43. echo $this->Html->tag('li', $this->Paginator->link($i, $url), array(
  44. 'class' => $class,
  45. ));
  46. }
  47. ?>
  48. <?php echo $this->Paginator->next('&raquo;', array(
  49. 'tag' => 'li',
  50. 'class' => 'next',
  51. 'escape' => false
  52. ), $this->Paginator->link('&raquo;', array(), array('escape' => false)), array(
  53. 'tag' => 'li',
  54. 'escape' => false,
  55. 'class' => 'next disabled',
  56. )); ?>
  57. </ul>
  58. </div>
Add Comment
Please, Sign In to add comment