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  $halfRange = floor($this->paginationPagesCount/2);
17 
18  $start = $current - $halfRange;
19  $end = $current + $halfRange;
20  if ($start < 0) {
21  $start = 0;
22  }
23  if ($end > $total) {
24  $end = $total;
25  }
26  ?>
27  <?php if ($current > 0): ?>
28  <div class="pagination-previous">
29  <?php echo CHtml::link(CommentsModule::t("Previous"), $this->createPaginationUrl($current - 1))?>
30  </div>
31  <?php endif?>
32 
33  <?php for ($i = $start; $i <= $end; $i++): ?>
34  <div class="pagination-<?php echo $i == $current ? 'current' : 'item'?>">
35  <?php echo CHtml::link($i + 1, $this->createPaginationUrl($i))?>
36  </div>
37  <?php endfor ?>
38 
39  <?php if ($current < $total): ?>
40  <div class="pagination-next">
41  <?php echo CHtml::link(CommentsModule::t('Next'), $this->createPaginationUrl($current + 1))?>
42  </div>
43  <?php endif?>
44 
45  <div class="pagination-last">
46  <?php echo CHtml::link(CommentsModule::t('Last'), $this->createPaginationUrl($total))?>
47  </div>
48 </div>
49 <?php endif ?>