Created
August 24, 2010 20:38
-
-
Save thiagosf/548271 to your computer and use it in GitHub Desktop.
Helper para facilitar na exibição da paginação padrão em admin
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
App::import('Paginator'); | |
/** | |
* Helper para facilitar na exibição da paginação padrão em admin | |
*/ | |
class PaginatorCustomHelper extends PaginatorHelper | |
{ | |
var $helpers = array('Html'); | |
// Exibe paginacao | |
function show () { | |
$count = $this->counter('%count% registro(s)'); | |
$info_page = $this->counter('Página %page% de %pages%'); | |
$first = $this->first('Primeira'); | |
$prev = $this->prev('Anterior'); | |
$numbers = $this->numbers(); | |
$next = $this->next('Próxima'); | |
$last = $this->last('Última'); | |
$return = '<div class="paginator">'; | |
$return .= $this->Html->tag('span', $count, array('class' => 'count')); | |
$return .= $this->Html->tag('span', $info_page, array('class' => 'info_page')); | |
$return .= '<span class="navigation">'; | |
$return .= $first; | |
$return .= ($this->pageCount() > 1) ? $prev : ''; | |
$return .= ($numbers) ? $this->Html->tag('span', $numbers, array('class' => 'numbers')) : ''; | |
$return .= ($this->pageCount() > 1) ? $next : ''; | |
$return .= $last; | |
$return .= '</span>'; | |
$return .= '</div>'; | |
return $return; | |
} | |
// Total de paginas | |
function pageCount() { | |
$options = array('model' => $this->defaultModel()); | |
$paging = $this->params($options['model']); | |
return $paging['pageCount']; | |
} | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment