Gentics Portal.Node PHP API
 All Classes Namespaces Functions Variables Pages
_pagination.php
1 <?php
2 /**
3  *
4  */
5 
6 ?>
7 
8 <?php if ($commentsTotal > $this->commentsPerPage): ?>
9 <div class="pagination">
10  <div class="pagination-first">
11  <?php echo CHtml::link(CommentsModule::t("First"), $this->createPaginationUrl(0))?>
12  </div>
13  <?php
14  $current = $this->getCurrentPage();
15  $total = floor($commentsTotal / $this->commentsPerPage);
16  $range = $this->paginationPagesCount;
17 
18  $start = $current - $range + 2;
19  if ($start < 0) {
20  $start = 0;
21  $end = min($total, $start + $range - 1);
22  } else {
23  $end = $start + $range - 1;
24  if ($end > $total) {
25  $end = $total;
26  $start = $end - $range;
27  }
28  }
29  ?>
30  <?php if ($current > 0): ?>
31  <div class="pagination-previous">
32  <?php echo CHtml::link(CommentsModule::t("Previous"), $this->createPaginationUrl($current - 1))?>
33  </div>
34  <?php endif?>
35 
36  <?php for ($i = $start; $i <= $end; $i++): ?>
37  <div class="pagination-<?php echo $i == $current ? 'current' : 'item'?>">
38  <?php echo CHtml::link($i + 1, $this->createPaginationUrl($i))?>
39  </div>
40  <?php endfor ?>
41 
42  <?php if ($current < $total): ?>
43  <div class="pagination-next">
44  <?php echo CHtml::link(CommentsModule::t('Next'), $this->createPaginationUrl($current + 1))?>
45  </div>
46  <?php endif?>
47 
48  <div class="pagination-last">
49  <?php echo CHtml::link(CommentsModule::t('Last'), $this->createPaginationUrl($total))?>
50  </div>
51 </div>
52 <?php endif ?>