issue #0001772 : Pagination

This commit is contained in:
Michael RICOIS 2013-11-15 13:57:55 +00:00
parent 32bac23c79
commit 72886462ca
2 changed files with 41 additions and 1 deletions

View File

@ -1293,6 +1293,38 @@ class FinanceController extends Zend_Controller_Action
} elseif (is_string($infos)) {
$this->view->assign('msg', $infos);
} else {
$p = $request->getParam('p', 1);
$this->view->assign('p', $p);
$nbMax = 100;
$nbReponses = $infos->nbReponses;
$nbPages = ceil($nbReponses/$nbMax);
if ( $p <= 1 ) {
$lienPagePrecedente = false;
} else {
$lienPagePrecedente = $this->view->url(array(
'controller' => 'finance',
'action' => 'subventions',
'p' => $p-1
));
}
if ( $p+1 > $nbPages ) {
$lienPageSuivante = false;
} else {
$lienPageSuivante = $this->view->url(array(
'controller' => 'finance',
'action' => 'subventions',
'p' => $p+1
));
}
$this->view->assign('nbPages',$nbPages);
$this->view->assign('lienPagePrecedente',$lienPagePrecedente);
$this->view->assign('lienPageSuivante',$lienPageSuivante);
$this->view->assign('Millesime',$infos->Millesime);
$this->view->assign('Budget',$infos->Budget);
$this->view->assign('AssoSiren',$infos->AssoSiren);

View File

@ -61,7 +61,15 @@ Aucune subvention.
</div>
<div class="paragraph">
Pagination
<?php if ($this->lienPagePrecedente) { ?>
<a href="<?=$this->lienPagePrecedente?>" title="Page précédente...">&lt;&lt;</a>
<?php }?>
<?php if ($this->nbPages>1) { ?>
<span>Page <?=$this->p?>/<?=$this->nbPages?></span>
<?php } ?>
<?php if ($this->lienPageSuivante) {?>
<a href="<?=$this->lienPageSuivante?>" title="Page suivante...">&gt;&gt;</a>
<?php }?>
</div>
</div>