Correction pagination recherche
This commit is contained in:
parent
dbaa3a7aee
commit
5cd16adb94
@ -159,7 +159,8 @@ class RechercheController extends Zend_Controller_Action
|
||||
$this->_forward('search', 'giant');
|
||||
}
|
||||
|
||||
$page = $request->getParam('page', 1);
|
||||
$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,82 +260,86 @@ 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.
|
||||
$item = array();
|
||||
$item['position'] = (($curPage-1)*$nbReponses)+$i+1;
|
||||
$item['id'] = $etab->id;
|
||||
$item['siren'] = $etab->Siren;
|
||||
$item['siret'] = $etab->Siren.$etab->Nic;
|
||||
$item['InfoSiret'] = $etab->Siren.' '.$etab->Nic;
|
||||
$item['InfoNom'] = $etab->Nom;
|
||||
|
||||
$nomDetail = '';
|
||||
if ($etab->Nom2<>'' || $etab->Enseigne<>'' || $etab->Sigle<>'') {
|
||||
$nomDetail.= '<i>';
|
||||
if ($etab->Nom2!='') $nomDetail.= $etab->Nom2.'<br/>';
|
||||
if ($etab->Enseigne<>'') $nomDetail.= 'Enseigne : '.$etab->Enseigne.' ';
|
||||
if ($etab->Sigle<>'') $nomDetail.= 'Sigle : '.$etab->Sigle;
|
||||
$nomDetail.= '</i><br/>';
|
||||
}
|
||||
$item['InfoNomDetail'] = $nomDetail;
|
||||
$item['InfoSiret'] = substr($etab->Siren,0,3).' '.
|
||||
substr($etab->Siren,3,3).' '.
|
||||
substr($etab->Siren,6,3).' '.
|
||||
$etab->Nic;
|
||||
$infoEtab = '';
|
||||
if ($etab->Siege==1){
|
||||
$infoEtab.= 'Établissement siège ';
|
||||
} else {
|
||||
$infoEtab.= 'Établissement secondaire ';
|
||||
}
|
||||
if ($etab->Actif==1){
|
||||
$infoEtab.= 'actif';
|
||||
} else {
|
||||
$infoEtab.= 'inactif';
|
||||
}
|
||||
if (intval($etab->Nic)==0 || intval($item->Nic)>=99990) {
|
||||
$infoEtab.=' provisoire';
|
||||
}
|
||||
|
||||
if ($etab->Siege!=1 || ($etab->Siege==1 && $etab->Actif!=1)) {
|
||||
$url = $this->view->url(array(
|
||||
'controller'=>'identite',
|
||||
'action'=>'fiche',
|
||||
'id' => $etab->id,
|
||||
'siren' => $etab->Siren,
|
||||
));
|
||||
$infoEtab.= ' <a title="Voir la fiche d\'identité du siège de cette entreprise"'.
|
||||
' href="'.$url.'">(Accès siège)</a>';
|
||||
}
|
||||
$item['InfoEtab'] = $infoEtab;
|
||||
|
||||
$adresse = $etab->Adresse.'<br/>';
|
||||
if (isset($etab->Adresse2) && $etab->Adresse2 != '') {
|
||||
$adresse.= $etab->Adresse2.'<br/>';
|
||||
}
|
||||
$adresse.= "<b>".$etab->CP." ".$etab->Ville."</b>";
|
||||
$item['InfoAdresse'] = $adresse;
|
||||
|
||||
|
||||
$forme = '';
|
||||
if (trim($etab->FJ)!='')
|
||||
{
|
||||
$forme = '<i>Forme : '.$etab->FJLib.' ('.$etab->FJ.')</i><br/>';
|
||||
}
|
||||
$item['InfoForme'] = $forme;
|
||||
|
||||
$activite = '';
|
||||
if (trim($item->NafEnt)!='')
|
||||
{
|
||||
$activite = '<i>Activité : '.$item->NafEntLib.' ('.$item->NafEnt.')</i><br/>';
|
||||
}
|
||||
$item['InfoActivite'] = $activite;
|
||||
$liste[] = $item;
|
||||
if (count($etabs)>0) {
|
||||
foreach($etabs as $i => $etab) {
|
||||
Zend_Registry::get('firebug')->info($etabs);
|
||||
$item = array();
|
||||
$item['position'] = ($position*$nbReponses)+$i+1;
|
||||
$item['id'] = $etab->id;
|
||||
$item['siren'] = $etab->Siren;
|
||||
$item['siret'] = $etab->Siren.$etab->Nic;
|
||||
$item['InfoSiret'] = $etab->Siren.' '.$etab->Nic;
|
||||
$item['InfoNom'] = $etab->Nom;
|
||||
|
||||
$nomDetail = '';
|
||||
if ($etab->Nom2<>'' || $etab->Enseigne<>'' || $etab->Sigle<>'') {
|
||||
$nomDetail.= '<i>';
|
||||
if ($etab->Nom2!='') $nomDetail.= $etab->Nom2.'<br/>';
|
||||
if ($etab->Enseigne<>'') $nomDetail.= 'Enseigne : '.$etab->Enseigne.' ';
|
||||
if ($etab->Sigle<>'') $nomDetail.= 'Sigle : '.$etab->Sigle;
|
||||
$nomDetail.= '</i><br/>';
|
||||
}
|
||||
$item['InfoNomDetail'] = $nomDetail;
|
||||
$item['InfoSiret'] = substr($etab->Siren,0,3).' '.
|
||||
substr($etab->Siren,3,3).' '.
|
||||
substr($etab->Siren,6,3).' '.
|
||||
$etab->Nic;
|
||||
$infoEtab = '';
|
||||
if ($etab->Siege==1){
|
||||
$infoEtab.= 'Établissement siège ';
|
||||
} else {
|
||||
$infoEtab.= 'Établissement secondaire ';
|
||||
}
|
||||
if ($etab->Actif==1){
|
||||
$infoEtab.= 'actif';
|
||||
} else {
|
||||
$infoEtab.= 'inactif';
|
||||
}
|
||||
if (intval($etab->Nic)==0 || intval($item->Nic)>=99990) {
|
||||
$infoEtab.=' provisoire';
|
||||
}
|
||||
|
||||
if ($etab->Siege!=1 || ($etab->Siege==1 && $etab->Actif!=1)) {
|
||||
$url = $this->view->url(array(
|
||||
'controller'=>'identite',
|
||||
'action'=>'fiche',
|
||||
'id' => $etab->id,
|
||||
'siren' => $etab->Siren,
|
||||
));
|
||||
$infoEtab.= ' <a title="Voir la fiche d\'identité du siège de cette entreprise"'.
|
||||
' href="'.$url.'">(Accès siège)</a>';
|
||||
}
|
||||
$item['InfoEtab'] = $infoEtab;
|
||||
|
||||
$adresse = $etab->Adresse.'<br/>';
|
||||
if (isset($etab->Adresse2) && $etab->Adresse2 != '') {
|
||||
$adresse.= $etab->Adresse2.'<br/>';
|
||||
}
|
||||
$adresse.= "<b>".$etab->CP." ".$etab->Ville."</b>";
|
||||
$item['InfoAdresse'] = $adresse;
|
||||
|
||||
|
||||
$forme = '';
|
||||
if (trim($etab->FJ)!='')
|
||||
{
|
||||
$forme = '<i>Forme : '.$etab->FJLib.' ('.$etab->FJ.')</i><br/>';
|
||||
}
|
||||
$item['InfoForme'] = $forme;
|
||||
|
||||
$activite = '';
|
||||
if (trim($etab->NafEnt)!='')
|
||||
{
|
||||
$activite = '<i>Activité : '.$etab->NafEntLib.' ('.$etab->NafEnt.')</i><br/>';
|
||||
}
|
||||
$item['InfoActivite'] = $activite;
|
||||
$liste[] = $item;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user