Correction gestion des pages

This commit is contained in:
Michael RICOIS 2011-09-12 09:20:03 +00:00
parent 05c5af5b1e
commit cd54fa78fb

View File

@ -309,9 +309,6 @@ class RechercheController extends Zend_Controller_Action
$params = $recherche['params'];
}
Zend_Registry::get('firebug')->info($type);
Zend_Registry::get('firebug')->info($params);
//Giant
if( !empty($params['pays']) && $type == 'ent' ){
Zend_Registry::get('firebug')->info('RECHERCHE GIANT');
@ -319,12 +316,17 @@ class RechercheController extends Zend_Controller_Action
//Recherche
} else {
require_once 'Scores/Utilisateur.php';
$user = new Utilisateur();
$page = $request->getParam('page', 1);
if ($page==0) $page = 1;
$page = $page-1;
$position = $page*$user->getNbRep();
require_once 'Scores/WsScores.php';
$ws = new WsScores();
$position = $page-1;
//Criteres recherche entreprise
if ($type=='ent'){
@ -364,9 +366,7 @@ class RechercheController extends Zend_Controller_Action
$criteres['naf'] = $naf;
$criteres['siege'] = false;
$criteres['actif'] = false;
if(empty($params['pays']))
$reponse = $ws->searchEntreprise($criteres, $position);
Zend_Registry::get('firebug')->info($reponse);
//Criteres recherche dirigeants
} else if ($type=='dir') {
@ -422,9 +422,6 @@ class RechercheController extends Zend_Controller_Action
Zend_Registry::get('firebug')->info($reponse);
}
require_once 'Scores/Utilisateur.php';
$user = new Utilisateur();
if (is_object($reponse) && $reponse !== false)
{
$etabs = $reponse->result->item;
@ -445,8 +442,8 @@ class RechercheController extends Zend_Controller_Action
$nbReponses = $reponse->nbReponses;
$nbReponsesTotal = $reponse->nbReponsesTotal;
if ($nbReponses < $nbReponsesTotal) {
$totPage = ceil($nbReponsesTotal/$nbReponses);
$curPage = $position+1;
$totPage = ceil($nbReponsesTotal/$user->getNbRep());
$curPage = $page+1;
} else {
$totPage = $curPage = 1;
}
@ -454,9 +451,8 @@ class RechercheController extends Zend_Controller_Action
$liste = array();
if (count($etabs)>0) {
foreach($etabs as $i => $etab) {
Zend_Registry::get('firebug')->info($etabs);
$item = array();
$item['position'] = ($position*$nbReponses)+$i+1;
$item['position'] = ($position)+$i+1;
$item['id'] = $etab->id;
$item['siren'] = $etab->Siren;
$item['siret'] = $etab->Siren.$etab->Nic;