issue #0001870 : Pagination control
This commit is contained in:
parent
51c67cc673
commit
74d4d1c5eb
@ -979,11 +979,11 @@ class IdentiteController extends Zend_Controller_Action
|
||||
$siren = substr($this->siret,0,9);
|
||||
$this->view->headTitle()->prepend('Evènements - Siren '.$siren);
|
||||
|
||||
$nbReponses = 50;
|
||||
//Pagination
|
||||
$page = $request->getParam('page', 1);
|
||||
if ($page == 0) $page = 1;
|
||||
$page = $page - 1;
|
||||
$position = $page * $nbReponses;
|
||||
if ( $page <= 0 ) $page = 1;
|
||||
$nbAffichage = 50;
|
||||
$position = ($page - 1 ) * $nbAffichage;
|
||||
|
||||
$session = new Scores_Session_Entreprise($this->siret, $this->id);
|
||||
|
||||
@ -998,15 +998,28 @@ class IdentiteController extends Zend_Controller_Action
|
||||
$this->view->assign('raisonSociale', $session->getRaisonSociale());
|
||||
$this->view->assign('exportObjet', $evens);
|
||||
|
||||
//Calcul pagination
|
||||
$nbReponses = count($evens);
|
||||
$nbReponsesTotal = $infos->nbReponses;
|
||||
if ($nbReponses < $nbReponsesTotal) {
|
||||
$totPage = ceil($nbReponsesTotal/$nbReponses);
|
||||
$curPage = $page + 1;
|
||||
$pageTotal = ceil( $nbReponsesTotal / $nbAffichage );
|
||||
$pageCurrent = $page;
|
||||
$pagePrev = $page - 1;
|
||||
if ($pagePrev < 1) {
|
||||
$pagePrev = 1;
|
||||
}
|
||||
$pageNext = $page + 1;
|
||||
if( $pageNext > $pageTotal ) {
|
||||
$pageNext = $pageTotal;
|
||||
}
|
||||
} else {
|
||||
$totPage = $curPage = 1;
|
||||
$pageTotal = $pageCurrent = 1;
|
||||
}
|
||||
$this->view->assign('totPage', $totPage);
|
||||
$this->view->assign('curPage', $curPage);
|
||||
$this->view->assign('PageTotal', $pageTotal);
|
||||
$this->view->assign('PagePrev', $pagePrev);
|
||||
$this->view->assign('PageNext', $pageNext);
|
||||
$this->view->assign('PageCurrent', $pageCurrent);
|
||||
|
||||
$this->view->assign('nbReponses', empty($nbReponses) ? 0 : $nbReponses);
|
||||
$this->view->assign('nbReponsesTotal', empty($nbReponsesTotal) ? 0 : $nbReponsesTotal);
|
||||
}
|
||||
|
@ -411,10 +411,11 @@ class RechercheController extends Zend_Controller_Action
|
||||
$user = new Scores_Utilisateur();
|
||||
$this->view->assign('IDENTITE', $user->checkPerm('IDENTITE'));
|
||||
|
||||
$page = $request->getParam('page', 1);
|
||||
if ($page==0) $page = 1;
|
||||
$page = $page-1;
|
||||
$position = $page*$user->getNbRep();
|
||||
//Pagination
|
||||
$page = $request->getParam('page', 1);
|
||||
if ( $page <= 0 ) $page = 1;
|
||||
$nbAffichage = $user->getNbRep();
|
||||
$position = ($page - 1 ) * $nbAffichage;
|
||||
|
||||
require_once 'Scores/WsScores.php';
|
||||
$ws = new WsScores();
|
||||
@ -584,15 +585,6 @@ class RechercheController extends Zend_Controller_Action
|
||||
}
|
||||
|
||||
$criteresLien = $this->view->url($params, null, true);
|
||||
$info = $reponse->info;
|
||||
$nbReponses = $reponse->nbReponses;
|
||||
$nbReponsesTotal = $reponse->nbReponsesTotal;
|
||||
if ($nbReponses < $nbReponsesTotal) {
|
||||
$totPage = ceil($nbReponsesTotal/$user->getNbRep());
|
||||
$curPage = $page+1;
|
||||
} else {
|
||||
$totPage = $curPage = 1;
|
||||
}
|
||||
|
||||
$liste = array();
|
||||
if (count($etabs)>0) {
|
||||
@ -793,15 +785,38 @@ class RechercheController extends Zend_Controller_Action
|
||||
$this->view->assign('blockDirToEntreprise', false);
|
||||
}
|
||||
|
||||
$this->view->assign('token', $token);
|
||||
$this->view->assign('liste', $liste);
|
||||
$this->view->assign('totPage', $totPage);
|
||||
$this->view->assign('curPage', $curPage);
|
||||
$this->view->assign('liste', $liste);
|
||||
|
||||
//Calcul pagination
|
||||
$nbReponses = $reponse->nbReponses;
|
||||
$nbReponsesTotal = $reponse->nbReponsesTotal;
|
||||
if ($nbReponses < $nbReponsesTotal) {
|
||||
$pageTotal = ceil( $nbReponsesTotal / $nbAffichage );
|
||||
$pageCurrent = $page;
|
||||
$pagePrev = $page - 1;
|
||||
if ($pagePrev < 1) {
|
||||
$pagePrev = 1;
|
||||
}
|
||||
$pageNext = $page + 1;
|
||||
if( $pageNext > $pageTotal ) {
|
||||
$pageNext = $pageTotal;
|
||||
}
|
||||
} else {
|
||||
$pageTotal = $pageCurrent = 1;
|
||||
}
|
||||
$this->view->assign('PageTotal', $pageTotal);
|
||||
$this->view->assign('PagePrev', $pagePrev);
|
||||
$this->view->assign('PageNext', $pageNext);
|
||||
$this->view->assign('PageCurrent', $pageCurrent);
|
||||
|
||||
$this->view->assign('nbReponses', empty($nbReponses) ? 0 : $nbReponses);
|
||||
$this->view->assign('nbReponsesTotal', empty($nbReponsesTotal) ? 0 : $nbReponsesTotal);
|
||||
|
||||
$this->view->assign('token', $token);
|
||||
|
||||
$this->view->assign('criteresTexte', $criteresTexte);
|
||||
$this->view->assign('criteresLien', $criteresLien);
|
||||
$this->view->assign('info', $info);
|
||||
$this->view->assign('info', $reponse->info);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -274,12 +274,14 @@ class SurveillanceController extends Zend_Controller_Action
|
||||
|
||||
$request = $this->getRequest();
|
||||
|
||||
$page = $request->getParam('page', 1);
|
||||
if ( $page == 0 ) $page = 1;
|
||||
$page = $page - 1;
|
||||
$nbAffichage = 50;
|
||||
$position = $page * $nbAffichage;
|
||||
|
||||
//Pagination
|
||||
$page = $request->getParam('page', 1);
|
||||
if ( $page <= 0 ) $page = 1;
|
||||
$nbAffichage = 50;
|
||||
$position = ($page - 1 ) * $nbAffichage;
|
||||
|
||||
$source = $request->getParam('source', '');
|
||||
|
||||
$tri = $request->getParam('tri', 'siren');
|
||||
@ -370,18 +372,33 @@ class SurveillanceController extends Zend_Controller_Action
|
||||
}
|
||||
|
||||
//Calcul pagination
|
||||
$nbReponses = $infos->nbReponses;
|
||||
$nbSurveillances = $infos->nbReponsesTotal;
|
||||
$totPage = ceil($nbSurveillances/$nbAffichage);
|
||||
$curPage = ceil($position/$nbAffichage)+1;
|
||||
$nbReponses = $infos->nbReponses;
|
||||
$nbReponsesTotal = $infos->nbReponsesTotal;
|
||||
if ($nbReponses < $nbReponsesTotal) {
|
||||
$pageTotal = ceil( $nbReponsesTotal / $nbReponses );
|
||||
$pageCurrent = $page;
|
||||
$pagePrev = $page - 1;
|
||||
if ($pagePrev < 1) {
|
||||
$pagePrev = 1;
|
||||
}
|
||||
$pageNext = $page + 1;
|
||||
if( $pageNext > $pageTotal ) {
|
||||
$pageNext = $pageTotal;
|
||||
}
|
||||
} else {
|
||||
$pageTotal = $pageCurrent = 1;
|
||||
}
|
||||
$this->view->assign('PageTotal', $pageTotal);
|
||||
$this->view->assign('PagePrev', $pagePrev);
|
||||
$this->view->assign('PageNext', $pageNext);
|
||||
$this->view->assign('PageCurrent', $pageCurrent);
|
||||
|
||||
$this->view->assign('nbReponses', empty($nbReponses) ? 0 : $nbReponses);
|
||||
$this->view->assign('nbSurveillances', $nbReponsesTotal);
|
||||
|
||||
$this->view->assign('source', $source);
|
||||
$this->view->assign('selectTri', $selectTri);
|
||||
$this->view->assign('listSources', $permSource);
|
||||
$this->view->assign('nbReponses', $nbReponses);
|
||||
$this->view->assign('nbSurveillances', $nbSurveillances);
|
||||
$this->view->assign('totPage', $totPage);
|
||||
$this->view->assign('curPage', $curPage);
|
||||
$this->view->assign('surveillances', $listTrier);
|
||||
$this->view->assign('source', $source);
|
||||
}
|
||||
|
@ -76,14 +76,14 @@
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<?php if ($this->totPage>1) {?>
|
||||
<?php if ($this->PageTotal>1) {?>
|
||||
<div class="paragraph">
|
||||
<div class="pagination clearfix">
|
||||
<a class="first" href="<?=$this->url(array('page'=>1))?>">«</a>
|
||||
<a class="previous" href="<?=$this->url(array('page'=>$this->curPage-1))?>">‹</a>
|
||||
<span>Page <?=$this->curPage?>/<?=$this->totPage?></span>
|
||||
<a class="next" href="<?=$this->url(array('page'=>$this->curPage+1))?>">›</a>
|
||||
<a class="last" href="<?=$this->url(array('page'=>$this->totPage))?>">»</a>
|
||||
<a class="previous" href="<?=$this->url(array('page'=>$this->PagePrev))?>">‹</a>
|
||||
<span>Page <?=$this->PageCurrent?>/<?=$this->PageTotal?></span>
|
||||
<a class="next" href="<?=$this->url(array('page'=>$this->PageNext))?>">›</a>
|
||||
<a class="last" href="<?=$this->url(array('page'=>$this->PageTotal))?>">»</a>
|
||||
</div>
|
||||
</div>
|
||||
<?php }?>
|
||||
|
@ -6,9 +6,9 @@
|
||||
<?=$this->nbReponsesTotal?> réponse<?php if ($this->nbReponsesTotal>1){?>s<?php }?>
|
||||
avec les critères "<a href="<?php echo $this->criteresLien?>">
|
||||
<?=$this->criteresTexte?></a>".
|
||||
<?php if ($this->totPage!=1) {?>
|
||||
<?php if ($this->PageTotal!=1) {?>
|
||||
<?=$this->nbReponses?> résultats affichés.
|
||||
Page <?=$this->curPage.'/'.$this->totPage.'.';?>
|
||||
Page <?=$this->PageCurrent.'/'.$this->PageTotal.'.';?>
|
||||
<?php }?>
|
||||
|
||||
<?php if ($this->filtres) { ?>
|
||||
@ -27,9 +27,7 @@ $('select[name=filtre]').change(function(e){
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
if (!empty($this->info)) {
|
||||
?>
|
||||
<?php if (!empty($this->info)) { ?>
|
||||
<div style="margin:5px; padding: 0pt 0.7em;" class="ui-state-highlight ui-corner-all">
|
||||
<p><span style="float: left; margin-right: 0.3em;" class="ui-icon ui-icon-info"></span>
|
||||
<?=$this->info?></p>
|
||||
@ -73,26 +71,19 @@ if (!empty($this->info)) {
|
||||
<?php }?>
|
||||
</ol>
|
||||
|
||||
<div id="recherche-page">
|
||||
<?php if ($this->curPage>1) { ?>
|
||||
<a href="<?=$this->url(array('action'=>'liste', 'page'=>$this->curPage-1, 'token'=> $this->token))?>" title="Page précédente...">
|
||||
<img src="/themes/default/images/boutton_precedent_off.gif" />
|
||||
</a>
|
||||
<?
|
||||
}
|
||||
if ($this->curPage!=$this->totPage) {
|
||||
?>
|
||||
<span>Page <?=$this->curPage?>/<?=$this->totPage?></span>
|
||||
<?php
|
||||
}
|
||||
if ($this->curPage<$this->totPage) {
|
||||
?>
|
||||
<a href="<?=$this->url(array('action'=>'liste', 'page'=>$this->curPage+1, 'token'=> $this->token))?>" title="Page suivante...">
|
||||
<img src="/themes/default/images/boutton_suivant_off.gif" />
|
||||
</a>
|
||||
<?php }?>
|
||||
<?php if ($this->PageTotal>1) {?>
|
||||
<div class="paragraph">
|
||||
<div class="pagination clearfix">
|
||||
<a class="first" href="<?=$this->url(array('page'=>1, 'token'=> $this->token))?>">«</a>
|
||||
<a class="previous" href="<?=$this->url(array('page'=>$this->PagePrev, 'token'=> $this->token))?>">‹</a>
|
||||
<span>Page <?=$this->PageCurrent?>/<?=$this->PageTotal?></span>
|
||||
<a class="next" href="<?=$this->url(array('page'=>$this->PageNext, 'token'=> $this->token))?>">›</a>
|
||||
<a class="last" href="<?=$this->url(array('page'=>$this->PageTotal, 'token'=> $this->token))?>">»</a>
|
||||
</div>
|
||||
<br/>
|
||||
</div>
|
||||
<?php }?>
|
||||
|
||||
|
||||
|
||||
<div class="paragraph">
|
||||
<?php if ($this->rechCsv) { ?>
|
||||
|
@ -65,14 +65,14 @@ par
|
||||
|
||||
|
||||
<h2>Liste des surveillances</h2>
|
||||
<?php if ($this->totPage>1) {?>
|
||||
<?php if ($this->PageTotal>1) {?>
|
||||
<div class="paragraph">
|
||||
<div class="pagination clearfix">
|
||||
<a class="first" href="<?=$this->url(array('page'=>1))?>">«</a>
|
||||
<a class="previous" href="<?=$this->url(array('page'=>$this->curPage-1))?>">‹</a>
|
||||
<span>Page <?=$this->curPage?>/<?=$this->totPage?></span>
|
||||
<a class="next" href="<?=$this->url(array('page'=>$this->curPage+1))?>">›</a>
|
||||
<a class="last" href="<?=$this->url(array('page'=>$this->totPage))?>">»</a>
|
||||
<a class="first" href="<?=$this->url(array('page'=>1, 'token'=> $this->token))?>">«</a>
|
||||
<a class="previous" href="<?=$this->url(array('page'=>$this->PagePrev, 'token'=> $this->token))?>">‹</a>
|
||||
<span>Page <?=$this->PageCurrent?>/<?=$this->PageTotal?></span>
|
||||
<a class="next" href="<?=$this->url(array('page'=>$this->PageNext, 'token'=> $this->token))?>">›</a>
|
||||
<a class="last" href="<?=$this->url(array('page'=>$this->PageTotal, 'token'=> $this->token))?>">»</a>
|
||||
</div>
|
||||
</div>
|
||||
<?php }?>
|
||||
@ -223,14 +223,14 @@ par
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<?php if ($this->totPage>1) {?>
|
||||
<?php if ($this->PageTotal>1) {?>
|
||||
<div class="paragraph">
|
||||
<div class="pagination clearfix">
|
||||
<a class="first" href="<?=$this->url(array('page'=>1))?>">«</a>
|
||||
<a class="previous" href="<?=$this->url(array('page'=>$this->curPage))?>">‹</a>
|
||||
<span>Page <?=$this->curPage?>/<?=$this->totPage?></span>
|
||||
<a class="next" href="<?=$this->url(array('page'=>$this->curPage+1))?>">›</a>
|
||||
<a class="last" href="<?=$this->url(array('page'=>$this->totPage))?>">»</a>
|
||||
<a class="previous" href="<?=$this->url(array('page'=>$this->PagePrev))?>">‹</a>
|
||||
<span>Page <?=$this->PageCurrent?>/<?=$this->PageTotal?></span>
|
||||
<a class="next" href="<?=$this->url(array('page'=>$this->PageNext))?>">›</a>
|
||||
<a class="last" href="<?=$this->url(array('page'=>$this->PageTotal))?>">»</a>
|
||||
</div>
|
||||
</div>
|
||||
<?php }?>
|
||||
|
Loading…
Reference in New Issue
Block a user