diff options
| author | 2012-10-21 18:47:57 +0200 | |
|---|---|---|
| committer | 2012-10-21 18:47:57 +0200 | |
| commit | fb57be5a5af3a2fb46b2dbf2b503ffe78eb5cf49 (patch) | |
| tree | 9440fc7846d8a56a7005b9ef029669c96ad959aa /app/views/helpers/pagination.phtml | |
First commit
Diffstat (limited to 'app/views/helpers/pagination.phtml')
| -rwxr-xr-x | app/views/helpers/pagination.phtml | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/app/views/helpers/pagination.phtml b/app/views/helpers/pagination.phtml new file mode 100755 index 000000000..fe9feb0e8 --- /dev/null +++ b/app/views/helpers/pagination.phtml @@ -0,0 +1,34 @@ +<?php + $c = Request::controllerName (); + $a = Request::actionName (); + $params = Request::params (); +?> + +<?php if ($this->nbPage > 1) { ?> +<ul class="pagination"> + <?php if ($this->currentPage > 1) { ?> + <?php $params[$getteur] = 1; ?> + <li class="pager-first"><a href="<?php echo Url::display (array ('c' => $c, 'a' => $a, 'params' => $params)); ?>">« Début</a></li> + <?php $params[$getteur] = $this->currentPage - 1; ?> + <li class="pager-previous"><a href="<?php echo Url::display (array ('c' => $c, 'a' => $a, 'params' => $params)); ?>">‹ Précédent</a></li> + <?php } ?> + + <?php for ($i = $this->currentPage - 2; $i <= $this->currentPage + 2; $i++) { ?> + <?php if($i > 0 && $i <= $this->nbPage) { ?> + <?php if ($i != $this->currentPage) { ?> + <?php $params[$getteur] = $i; ?> + <li class="pager-item"><a href="<?php echo Url::display (array ('c' => $c, 'a' => $a, 'params' => $params)); ?>"><?php echo $i; ?></a></li> + <?php } else { ?> + <li class="pager-current"><?php echo $i; ?></li> + <?php } ?> + <?php } ?> + <?php } ?> + + <?php if ($this->currentPage < $this->nbPage) { ?> + <?php $params[$getteur] = $this->currentPage + 1; ?> + <li class="pager-next"><a href="<?php echo Url::display (array ('c' => $c, 'a' => $a, 'params' => $params)); ?>">Suivant ›</a></li> + <?php $params[$getteur] = $this->nbPage; ?> + <li class="pager-last"><a href="<?php echo Url::display (array ('c' => $c, 'a' => $a, 'params' => $params)); ?>">Fin »</a></li> + <?php } ?> +</ul> +<?php } ?> |
