diff --git a/application/configs/application.ini b/application/configs/application.ini
index 03ebffd5a..61c9fc81e 100644
--- a/application/configs/application.ini
+++ b/application/configs/application.ini
@@ -14,7 +14,6 @@ resources.frontController.plugins.Menu = "Application_Controller_Plugin_Menu"
resources.frontController.plugins.Pdf = "Application_Controller_Plugin_Pdf"
resources.frontController.plugins.Pdf = "Application_Controller_Plugin_Xml"
resources.frontController.plugins.Cgu = "Application_Controller_Plugin_Cgu"
-resources.frontController.plugins.Historique = "Application_Controller_Plugin_Historique"
resources.layout.layout = "main"
resources.layout.layoutPath = APPLICATION_PATH "/views/default"
resources.view.basePath = APPLICATION_PATH "/views/default"
diff --git a/application/controllers/RechercheController.php b/application/controllers/RechercheController.php
index e137e5be4..c526152ac 100644
--- a/application/controllers/RechercheController.php
+++ b/application/controllers/RechercheController.php
@@ -7,7 +7,9 @@ class RechercheController extends Zend_Controller_Action
/** Pour Giant **/
if(isset($_SESSION['recherche']['giant']))
unset($_SESSION['recherche']['giant']);
-
+
+ require_once 'Scores/RechercheHistorique.php';
+
$this->view->headLink()->appendStylesheet('/themes/default/styles/recherche.css', 'all');
}
@@ -16,6 +18,9 @@ class RechercheController extends Zend_Controller_Action
$this->_forward('entreprise');
}
+ /**
+ * Affiche le formulaire de recherche entreprise
+ */
public function entrepriseAction()
{
$request = $this->getRequest();
@@ -27,6 +32,9 @@ class RechercheController extends Zend_Controller_Action
$this->view->form = $form;
}
+ /**
+ * Affiche le formulaire de recherche dirigeants
+ */
public function dirigeantAction()
{
$this->view->headTitle()->append('Recherche Dirigeant');
@@ -35,9 +43,12 @@ class RechercheController extends Zend_Controller_Action
$this->view->assign('form', $form);
}
+ /**
+ * Affiche le formulaire de recherche annonces
+ * Enter description here ...
+ */
public function annonceAction()
{
-
$this->view->headTitle()->append('Recherche Annonce');
}
@@ -53,8 +64,8 @@ class RechercheController extends Zend_Controller_Action
public function listAction()
{
$this->view->headTitle()->append('Liste des dernières recherches');
- $session = new Zend_Session_Namespace('Historique');
- $this->view->assign('historique', $session->historique);
+ $rechercheSession = new RechercheHistorique();
+ $this->view->assign('historique', $rechercheSession->liste());
}
public function enqueteAction()
@@ -79,7 +90,7 @@ class RechercheController extends Zend_Controller_Action
$config = new Zend_Config_Ini(APPLICATION_PATH . '/configs/configuration.ini', 'path');
$path = realpath($config->data).'/'.$config->log;
$fp = fopen($path.'/enquetes.csv', 'a');
- fwrite($fp, date('Y/m/d H:i:s').' - '.print_r($form->getValues(),true).print_r($tabInfo,true)."\n");
+ fwrite($fp, date('Y/m/d H:i:s').' - '.print_r($form->getValues(),true)."\n");
fclose($fp);
$message = "Détail de la demande d'investigation
";
foreach($form->getValues() as $key => $value) {
@@ -112,6 +123,9 @@ class RechercheController extends Zend_Controller_Action
}
}
+ /**
+ * Affiche les résultats d'une recherche
+ */
public function listeAction()
{
$request = $this->getRequest();
@@ -121,8 +135,22 @@ class RechercheController extends Zend_Controller_Action
$pays = $request->getParam('pays');
if( !empty($pays) )
$this->_forward('index', 'giant');
+
+ $type = $request->getParam('type', '');
- $type = $request->getParam('type');
+ $rechercheParams = new RechercheHistorique();
+ //Si le formulaire a été soumis alors on enregistre en session et on redirige
+ if ($request->isPost() && !empty($type)) {
+ $rechercheParams->save($type, $params);
+ $this->_redirect('recherche/liste');
+ }
+
+ $page = $request->getParam('page', 1);
+
+ $recherche = $rechercheParams->item(0);
+ $type = $recherche['type'];
+ $params = $recherche['params'];
+
//Criteres recherche entreprise
if ($type=='ent'){
@@ -138,7 +166,7 @@ class RechercheController extends Zend_Controller_Action
}
$libVoie = preg_replace('/[^0-9A-Z]/', ' ', strtoupper($params['voie']));
$cpVille = preg_replace('/ +/',' ',
- preg_replace('/[^0-9A-Z]/', ' ', strtoupper($formR['cpVille'])));
+ preg_replace('/[^0-9A-Z]/', ' ', strtoupper($params['cpVille'])));
if (preg_match("/^([0-9]{2,5})([\D]*)/i", $cpVille, $matches)) {
$cp = trim($matches[1]);
@@ -148,7 +176,9 @@ class RechercheController extends Zend_Controller_Action
$ville = trim($cpVille);
}
- $criteres = array();
+ // Zend_Registry::get('firebug')->info('CP'); Zend_Registry::get('firebug')->info($cp);
+
+ $criteres = array();
$criteres['identifiant'] = $params['siret'];
$criteres['raisonSociale'] = $raisonSociale;
$criteres['adresse'] = $numVoie.' '.$libVoie;
@@ -202,8 +232,8 @@ class RechercheController extends Zend_Controller_Action
require_once 'Scores/WsScores.php';
$ws = new WsScores();
- //@todo : Set position
- $reponse = $ws->rechercheEntreprise($type, $criteres, 0);
+ $position = $page-1;
+ $reponse = $ws->rechercheEntreprise($type, $criteres, $position);
Zend_Registry::get('firebug')->info($reponse);
if ($reponse !== false) {
@@ -219,7 +249,6 @@ class RechercheController extends Zend_Controller_Action
$nbReponses = $reponse->results->nbReponses;
$nbReponsesTotal = $reponse->results->nbReponsesTotal;
if ($nbReponses < $nbReponsesTotal) {
- $position = 0;
$totPage = ceil($nbReponsesTotal/$nbReponses);
$curPage = ceil($position/$nbReponses)+1;
} else {
@@ -315,7 +344,7 @@ class RechercheController extends Zend_Controller_Action
} else {
$this->view->assign('blockDirToEntreprise', false);
}
-
+
$this->view->assign('liste', $liste);
$this->view->assign('totPage', $totPage);
$this->view->assign('curPage', $curPage);
diff --git a/application/views/default/scripts/recherche/list.phtml b/application/views/default/scripts/recherche/list.phtml
index 8d0f3fbc2..dee23b51d 100644
--- a/application/views/default/scripts/recherche/list.phtml
+++ b/application/views/default/scripts/recherche/list.phtml
@@ -1,32 +1,70 @@
RECHERCHE ENTREPRISE :
+ + + Afficher la fiche identite consulter + + + Lancer la recherche + + Afficher le formulaire + + +RECHERCHE DIRIGEANT :
+ + + Afficher la fiche identite consulter + + + Lancer la recherche + + Afficher le formulaire + + + +