From 30578cd087fb5dc953ce3d071cbc395e65c50ddd Mon Sep 17 00:00:00 2001 From: Michael RICOIS Date: Thu, 29 Dec 2011 21:06:17 +0000 Subject: [PATCH] Modification --- .../controllers/ComptageController.php | 25 +++++++------- library/Scores/SessionCiblage.php | 34 +++++++++++++++---- 2 files changed, 39 insertions(+), 20 deletions(-) diff --git a/application/controllers/ComptageController.php b/application/controllers/ComptageController.php index 1228d3d5..20d40862 100644 --- a/application/controllers/ComptageController.php +++ b/application/controllers/ComptageController.php @@ -5,10 +5,16 @@ class ComptageController extends Zend_Controller_Action { $this->_helper->layout()->disableLayout(); $this->_helper->viewRenderer->setNoRender(true); - $explode = array('dateCrea_etab', 'dateCrea_ent', 'dateImmat', 'nbEtab', 'teff_entrep', 'teff_etab', - 'teff_entrep', 'teff_etab', 'eff_etab', 'eff_entrep', 'adr_dep', 'adr_cp', 'nbMPubli', - 'nbPart', 'nbActio', 'capital', 'bilAnnee', 'bilCloture', 'bilEE', 'bilFL', 'bilFK', - 'bilFR', 'bilGF', 'bilGP', 'bilGU', 'bilGW', 'bilHD', 'bilHH', 'bilHL', 'bilHM', 'bilHN', 'bilYP', 'adr_com' + /* + * @todo : Créer une classe pour gérer les champs, leurs paramètres, les options + * et les sortir de la session + * + */ + $explode = array( + 'dateCrea_etab', 'dateCrea_ent', 'dateImmat', 'nbEtab', 'teff_entrep', 'teff_etab', + 'teff_entrep', 'teff_etab', 'eff_etab', 'eff_entrep', 'adr_dep', 'adr_cp', 'nbMPubli', + 'nbPart', 'nbActio', 'capital', 'bilAnnee', 'bilCloture', 'bilEE', 'bilFL', 'bilFK', + 'bilFR', 'bilGF', 'bilGP', 'bilGU', 'bilGW', 'bilHD', 'bilHH', 'bilHL', 'bilHM', 'bilHN', 'bilYP', 'adr_com' ); $request = $this->getRequest(); $key = $request->getParam('cle'); @@ -29,8 +35,8 @@ class ComptageController extends Zend_Controller_Action $total = $ciblage->execute(); $insee = $ciblage->calculeRedevanceInsee(); - $session->setCritere('total', $total); - $session->setCritere('insee', $insee); + $session->setNb('total', $total); + $session->setNb('insee', $insee); //Retour comptage, unité Insee $result = array( @@ -51,16 +57,9 @@ class ComptageController extends Zend_Controller_Action $criteres = $session->getCriteres(); - - - - $resultat = ''; $nbInsee = ''; - - - } diff --git a/library/Scores/SessionCiblage.php b/library/Scores/SessionCiblage.php index 1384250e..ce3836a3 100644 --- a/library/Scores/SessionCiblage.php +++ b/library/Scores/SessionCiblage.php @@ -1,24 +1,32 @@ valeur = $session->ciblage; + if (isset($this->valeur['NB']['total'])){ $this->total = $this->valeur['NB']['total']; } + if (isset($this->valeur['NB']['insee'])){ $this->insee = $this->valeur['NB']['insee']; } + if (isset($this->valeur['NB'])){ unset($this->valeur['NB']); } } protected function setSession() { - $session = new Zend_Session_Namespace('ciblage'); - $session->ciblage = $this->valeur; + $session = new Zend_Session_Namespace('ciblage'); + $this->valeur['NB']['total'] = $this->total; + $this->valeur['NB']['insee'] = $this->insee; + $session->ciblage = $this->valeur; } public function setCritere($key, $value) @@ -51,4 +59,16 @@ class SessionCiblage { return $this->valeur; } + + public function setNb($element, $nb) + { + $this->{$element} = $nb; + $this->setSession(); + } + + public function getNb($element) + { + return $this->{$element}; + } + } \ No newline at end of file