Correction pagination recherche
This commit is contained in:
parent
dbaa3a7aee
commit
5cd16adb94
@ -160,6 +160,7 @@ class RechercheController extends Zend_Controller_Action
|
||||
}
|
||||
|
||||
$page = $request->getParam('page', 1);
|
||||
if ($page==0) $page = 1;
|
||||
|
||||
//Criteres recherche entreprise
|
||||
if ($type=='ent'){
|
||||
@ -244,7 +245,6 @@ class RechercheController extends Zend_Controller_Action
|
||||
$ws = new WsScores();
|
||||
$position = $page-1;
|
||||
$reponse = $ws->rechercheEntreprise($type, $criteres, $position);
|
||||
Zend_Registry::get('firebug')->info($reponse);
|
||||
if ($reponse !== false) {
|
||||
|
||||
$etabs = $reponse->result->item;
|
||||
@ -260,14 +260,17 @@ class RechercheController extends Zend_Controller_Action
|
||||
$nbReponsesTotal = $reponse->nbReponsesTotal;
|
||||
if ($nbReponses < $nbReponsesTotal) {
|
||||
$totPage = ceil($nbReponsesTotal/$nbReponses);
|
||||
$curPage = ceil($position/$nbReponses)+1;
|
||||
$curPage = $position+1;
|
||||
} else {
|
||||
$totPage = $curPage = 1;
|
||||
}
|
||||
|
||||
$liste = array();
|
||||
foreach($etabs as $i => $etab) { //@todo provoque un Warning quand pas de critères.
|
||||
if (count($etabs)>0) {
|
||||
foreach($etabs as $i => $etab) {
|
||||
Zend_Registry::get('firebug')->info($etabs);
|
||||
$item = array();
|
||||
$item['position'] = (($curPage-1)*$nbReponses)+$i+1;
|
||||
$item['position'] = ($position*$nbReponses)+$i+1;
|
||||
$item['id'] = $etab->id;
|
||||
$item['siren'] = $etab->Siren;
|
||||
$item['siret'] = $etab->Siren.$etab->Nic;
|
||||
@ -330,14 +333,15 @@ class RechercheController extends Zend_Controller_Action
|
||||
$item['InfoForme'] = $forme;
|
||||
|
||||
$activite = '';
|
||||
if (trim($item->NafEnt)!='')
|
||||
if (trim($etab->NafEnt)!='')
|
||||
{
|
||||
$activite = '<i>Activité : '.$item->NafEntLib.' ('.$item->NafEnt.')</i><br/>';
|
||||
$activite = '<i>Activité : '.$etab->NafEntLib.' ('.$etab->NafEnt.')</i><br/>';
|
||||
}
|
||||
$item['InfoActivite'] = $activite;
|
||||
$liste[] = $item;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
require_once 'Scores/Utilisateur.php';
|
||||
$user = new Utilisateur();
|
||||
|
Loading…
x
Reference in New Issue
Block a user