issue #0000642 : Pagination dans la liste des événements

This commit is contained in:
Michael RICOIS 2014-02-25 15:58:08 +00:00
parent c67f73adf4
commit d8891e9fb6
3 changed files with 93 additions and 37 deletions

View File

@ -974,22 +974,41 @@ class IdentiteController extends Zend_Controller_Action
*/
public function evenementsAction()
{
$siren = substr($this->siret,0,9);
$request = $this->getRequest();
$siren = substr($this->siret,0,9);
$this->view->headTitle()->prepend('Evènements - Siren '.$siren);
$nbReponses = 50;
$page = $request->getParam('page', 1);
if ($page == 0) $page = 1;
$page = $page - 1;
$position = $page * $nbReponses;
$session = new Scores_Session_Entreprise($this->siret, $this->id);
$ws = new WsScores();
$infos = $ws->getListeEvenements($siren);
$infos = $ws->getListeEvenements($siren, 0, $position, $nbReponses);
$evens = $infos->result->item;
$this->view->assign('evens', $evens);
$this->view->assign('siren', $siren);
$this->view->assign('siret', $this->siret);
$this->view->assign('id', $this->id);
$this->view->assign('raisonSociale', $session->getRaisonSociale());
$this->view->assign('evens', $evens);
$this->view->assign('exportObjet', $evens);
$nbReponsesTotal = $infos->nbReponses;
if ($nbReponses < $nbReponsesTotal) {
$totPage = ceil($nbReponsesTotal/$nbReponses);
$curPage = $page + 1;
} else {
$totPage = $curPage = 1;
}
$this->view->assign('totPage', $totPage);
$this->view->assign('curPage', $curPage);
$this->view->assign('nbReponses', empty($nbReponses) ? 0 : $nbReponses);
$this->view->assign('nbReponsesTotal', empty($nbReponsesTotal) ? 0 : $nbReponsesTotal);
}
/**

View File

@ -2,39 +2,43 @@
<h1>LISTE DES &Eacute;V&Eacute;NEMENTS</h1>
<div class="paragraph">
<table class="identite">
<tr>
<tr>
<td width="30">&nbsp;</td>
<td width="200" class="StyleInfoLib">
Num&eacute;ro identifiant Siren
</td>
<td width="350" class="StyleInfoData">
<?=$this->SirenTexte($this->siren)?>
</td>
</tr>
<tr>
<td width="200" class="StyleInfoLib">Num&eacute;ro identifiant Siren</td>
<td width="350" class="StyleInfoData"><?=$this->SirenTexte($this->siren)?></td>
</tr>
<tr>
<td width="30">&nbsp;</td>
<td width="200" class="StyleInfoLib">Dénomination Sociale</td>
<td width="350" class="StyleInfoData"><?=$this->raisonSociale?></td>
</tr>
<tr>
</tr>
<tr>
<td width="30">&nbsp;</td>
<td colspan="2" width="550" class="StyleInfoData">
<?=$this->action('infos','surveillance', null, array(
'source' => 'insee',
'siret' => $this->siret
))?>
</td>
</tr>
<?=$this->action('infos','surveillance',null,array('source' => 'insee','siret'=>$this->siret))?>
</td>
</tr>
</table>
</div>
<h2>&Eacute;v&eacute;nements INSEE</h2>
<?php if ( count($this->evens)==0 ) { ?>
<div class="paragraph">
<table class="data">
<tr>
<td class="StyleInfoData" width="580">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
Aucun &eacute;v&egrave;nement n'est pr&eacute;sent dans notre base
</td>
</tr>
</table>
</div>
<?php } else { ?>
<div class="paragraph">
<table class="data">
<?php
if (count($this->evens)>0) {
foreach ($this->evens as $i=>$even)
{
foreach ($this->evens as $i=>$even) {
if ($even->Siege==1) $type='siège';
else $type='établissement';
$lien = '<a title="Voir la fiche d\'identité" href="'.$this->url(array(
@ -68,20 +72,24 @@ if (count($this->evens)>0) {
?>
</td>
</tr>
<?php
}
} elseif ( count($evens)==0 ) {
?>
<tr>
<td class="StyleInfoData" width="580">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
Aucun &eacute;v&egrave;nement n'est pr&eacute;sent dans notre base
</td>
</tr>
<?php }?>
<?php }?>
</table>
</div>
<?php if ($this->totPage>1) {?>
<div class="paragraph">
<div class="pagination clearfix">
<a class="first" href="<?=$this->url(array('page'=>1))?>">&laquo;</a>
<a class="previous" href="<?=$this->url(array('page'=>$this->curPage-1))?>">&lsaquo;</a>
<span>Page <?=$this->curPage?>/<?=$this->totPage?></span>
<a class="next" href="<?=$this->url(array('page'=>$this->curPage+1))?>">&rsaquo;</a>
<a class="last" href="<?=$this->url(array('page'=>$this->totPage))?>">&raquo;</a>
</div>
</div>
<?php }?>
<?php }?>
<?php if (empty($this->AutrePage)) {?>
<?=$this->render('cgu.phtml', $this->cgu)?>
</div>

View File

@ -453,6 +453,37 @@ div.ui-state-highlight p {margin: 10px;}
div.ui-state-highlight a {text-decoration: underline;}
.noborder {border:0;}
img {vertical-align:middle;}
.pagination {border:1px solid #CDCDCD;border-radius:3px;width:224px;margin:0 auto;}
.pagination span {
border: medium none;
float: left;
height: 26px;
font-size: 14px;
line-height: 24px;
outline: medium none;
padding: 0;
text-align: center;
vertical-align: middle;
width: 120px;
}
.pagination a:first-child {border: medium none;border-radius: 2px 0 0 2px;}
.pagination a:last-child {border:medium none;border-radius:0 2px 2px 0;}
.pagination a {border-left: 1px solid #CDCDCD; border-right: 1px solid #CDCDCD;}
.pagination a {
background: -moz-linear-gradient(center top , #F3F3F3 0%, #D3D3D3 100%) repeat scroll 0 0 rgba(0, 0, 0, 0);
color: #555555;
display: block;
float: left;
font-family: Times,'Times New Roman',Georgia,Palatino;
font-size: 18px;
font-weight: bold;
height: 26px;
outline: medium none;
text-align: center;
text-decoration: none;
vertical-align: middle;
width: 25px;
}
/* Menu
----------------------------------*/
@ -659,8 +690,6 @@ div.blocdegrade .echelleright{float:right;}
#formSurveillance input.search {border:1px solid; padding:3px 5px;width:200px;}
#formSurveillance input.search:focus {border:1px solid #4D90FE;}
#formSurveillance input.submit {font-weight:bold;padding:2px 5px; background-color:#4D90FE; border:1px solid #3079ED;color:#ffffff; }
.pagination {background: none repeat scroll 0 0 transparent; border: 0 none; font-weight: bold; margin: 0; min-width: 1.5em; padding: 0.3em 0.5em;}
.pagination:hover {background: black repeat scroll 0 0;color:white;}
/* Pieces
----------------------------------*/