2011-01-06 08:37:20 +00:00
|
|
|
<?php
|
|
|
|
class RechercheController extends Zend_Controller_Action
|
|
|
|
{
|
|
|
|
|
|
|
|
public function init()
|
2011-04-11 14:19:14 +00:00
|
|
|
{
|
|
|
|
$this->view->headLink()->appendStylesheet('/themes/default/styles/recherche.css', 'all');
|
|
|
|
}
|
2011-01-06 08:37:20 +00:00
|
|
|
|
|
|
|
public function indexAction()
|
|
|
|
{
|
|
|
|
$this->_forward('entreprise');
|
|
|
|
}
|
|
|
|
|
2011-01-07 17:16:07 +00:00
|
|
|
public function entrepriseAction()
|
|
|
|
{
|
2011-04-11 14:19:14 +00:00
|
|
|
|
2011-01-07 17:16:07 +00:00
|
|
|
$this->view->headTitle()->append('Recherche Entreprise');
|
2011-04-11 14:19:14 +00:00
|
|
|
|
|
|
|
//@todo : champs definis avec les valeurs en sessions ou en get, post
|
|
|
|
|
2011-04-11 14:32:37 +00:00
|
|
|
require_once 'Web/Forms/RechercheEntreprise.php';
|
2011-01-07 17:16:07 +00:00
|
|
|
$form = new Form_RechercheEntreprise();
|
|
|
|
$this->view->form = $form;
|
|
|
|
}
|
2011-02-16 15:47:05 +00:00
|
|
|
|
2011-04-11 15:51:41 +00:00
|
|
|
public function dirigeantAction()
|
|
|
|
{
|
2011-04-11 14:19:14 +00:00
|
|
|
$this->view->headTitle()->append('Recherche Dirigeant');
|
2011-04-13 12:53:09 +00:00
|
|
|
require_once 'Web/Forms/RechercheDirigeant.php';
|
|
|
|
$form = new Form_RechercheDirigeant();
|
|
|
|
$this->view->assign('form', $form);
|
2011-04-11 14:19:14 +00:00
|
|
|
}
|
|
|
|
|
2011-04-11 15:51:41 +00:00
|
|
|
public function annonceAction()
|
|
|
|
{
|
2011-04-11 14:19:14 +00:00
|
|
|
|
|
|
|
$this->view->headTitle()->append('Recherche Annonce');
|
|
|
|
}
|
2011-02-16 15:47:05 +00:00
|
|
|
|
|
|
|
public function internationaleAction(){}
|
|
|
|
|
2011-04-11 14:19:14 +00:00
|
|
|
public function lastAction()
|
|
|
|
{
|
|
|
|
$this->view->headTitle()->append('Liste des dernières recherches');
|
2011-01-06 08:37:20 +00:00
|
|
|
|
2011-04-11 14:19:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public function enqueteAction()
|
|
|
|
{
|
|
|
|
$this->view->headTitle()->append('Enquête');
|
|
|
|
require_once 'Scores/Utilisateur.php';
|
|
|
|
$user = new Utilisateur();
|
|
|
|
if (!$user->checkPerm('INVESTIG')){
|
2011-04-11 15:51:41 +00:00
|
|
|
$this->renderScript('error/error-perms.phtml');
|
|
|
|
}
|
|
|
|
|
|
|
|
$request = $this->getRequest();
|
|
|
|
if ($request->isPost()){
|
|
|
|
//Erreur pas d'adresse email
|
|
|
|
|
|
|
|
//Ok - email envoyé
|
|
|
|
|
|
|
|
//Ok - email non envoyé
|
2011-04-11 14:19:14 +00:00
|
|
|
}
|
2011-04-11 15:51:41 +00:00
|
|
|
//Affichage formulaire
|
|
|
|
require_once 'Web/Forms/RechercheEnquete.php';
|
|
|
|
require_once 'Scores/Utilisateur.php';
|
|
|
|
|
|
|
|
$form = new Form_RechercheEnquete();
|
|
|
|
$user = new Utilisateur();
|
|
|
|
$data = array(
|
|
|
|
'email' => $user->getEmail(),
|
|
|
|
);
|
|
|
|
$form->populate($data);
|
2011-04-11 14:19:14 +00:00
|
|
|
|
2011-04-11 15:51:41 +00:00
|
|
|
$this->view->assign('form', $form);
|
2011-04-11 14:19:14 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
public function listeAction()
|
|
|
|
{
|
|
|
|
$request = $this->getRequest();
|
2011-04-11 14:32:37 +00:00
|
|
|
$params = $request->getParams();
|
|
|
|
|
2011-04-15 12:40:29 +00:00
|
|
|
//Giant
|
|
|
|
$pays = $request->getParam('pays', '');
|
|
|
|
if( !empty($pays) )
|
|
|
|
$this->_forward('search', 'giant');
|
|
|
|
|
2011-04-11 14:32:37 +00:00
|
|
|
|
|
|
|
$type = $request->getParam('type');
|
2011-04-11 14:19:14 +00:00
|
|
|
//Criteres recherche entreprise
|
|
|
|
if ($type=='ent'){
|
|
|
|
$criteres = array();
|
2011-04-19 14:28:47 +00:00
|
|
|
$criteres['identifiant'] = $request->getParam('siret');
|
2011-04-11 14:19:14 +00:00
|
|
|
$criteres['raisonSociale'] = $request->getParam('raisonSociale');
|
|
|
|
$criteres['adresse'] = '';
|
|
|
|
$criteres['codePostal']= '';
|
|
|
|
$criteres['ville'] = '';
|
|
|
|
$criteres['telFax'] = $request->getParam('telFax');
|
|
|
|
$criteres['naf'] = '';
|
|
|
|
$criteres['siege'] = false;
|
|
|
|
$criteres['actif'] = false;
|
|
|
|
//Criteres recherche dirigeants
|
|
|
|
} else if ($type=='dir') {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
require_once 'Scores/WsScores.php';
|
|
|
|
$ws = new WsScores();
|
|
|
|
//@todo : Set position
|
|
|
|
$reponse = $ws->rechercheEntreprise($type, $criteres, 0);
|
|
|
|
|
|
|
|
if ($reponse !== false) {
|
|
|
|
|
|
|
|
$etabs = $reponse->results->reponses->item;
|
|
|
|
$criteresTexte = '';
|
|
|
|
//@todo : selection des critères à afficher
|
|
|
|
foreach ($reponse->results->criteres as $value){
|
|
|
|
if (!empty($value)) $criteresTexte.= $value.' ';
|
|
|
|
}
|
|
|
|
$criteresTexte = trim($criteresTexte);
|
|
|
|
$criteresLien = $this->view->url($params);
|
|
|
|
$info = $reponse->results->info;
|
|
|
|
$nbReponses = $reponse->results->nbReponses;
|
|
|
|
$nbReponsesTotal = $reponse->results->nbReponsesTotal;
|
|
|
|
if ($nbReponses < $nbReponsesTotal) {
|
|
|
|
$position = 0;
|
|
|
|
$totPage = ceil($nbReponsesTotal/$nbReponses);
|
|
|
|
$curPage = ceil($position/$nbReponses)+1;
|
|
|
|
} else {
|
|
|
|
$totPage = $curPage = 1;
|
|
|
|
}
|
|
|
|
$liste = array();
|
|
|
|
foreach($etabs as $i => $etab) {
|
|
|
|
$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;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
require_once 'Scores/Utilisateur.php';
|
|
|
|
$user = new Utilisateur();
|
|
|
|
$this->view->assign('blockInvestig', $user->checkPerm('INVESTIG'));
|
|
|
|
|
|
|
|
if ($type=='dir') {
|
|
|
|
$this->view->assign('blockDirToEntreprise', true);
|
|
|
|
$this->view->assign('searchDirToEntrepriseTxt', trim($critere['nom'].' '.$criteres['prenom']));
|
|
|
|
$this->view->assign('searchDirToEntrepriseLien', $this->view->url(array(
|
|
|
|
'action' => 'list',
|
|
|
|
'type' => 'ent',
|
|
|
|
'raisonSociale' => trim($critere['nom'].' '.$criteres['prenom'])
|
|
|
|
)));
|
|
|
|
} else {
|
|
|
|
$this->view->assign('blockDirToEntreprise', false);
|
|
|
|
}
|
|
|
|
|
|
|
|
$this->view->assign('liste', $liste);
|
|
|
|
$this->view->assign('totPage', $totPage);
|
|
|
|
$this->view->assign('curPage', $curPage);
|
|
|
|
$this->view->assign('nbReponses', $nbReponses);
|
|
|
|
$this->view->assign('nbReponsesTotal', $nbReponsesTotal);
|
|
|
|
$this->view->assign('criteresTexte', $criteresTexte);
|
|
|
|
$this->view->assign('criteresLien', $criteresLien);
|
|
|
|
$this->view->assign('info', $info);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function ipariAction()
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
2011-01-06 08:37:20 +00:00
|
|
|
}
|