diff --git a/application/Bootstrap.php b/application/Bootstrap.php
index 54b6b4fd..9ced02c1 100644
--- a/application/Bootstrap.php
+++ b/application/Bootstrap.php
@@ -8,26 +8,27 @@ class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
$view = $this->getResource('view');
$pathStyle = '/themes/default/styles';
$pathScript = '/themes/default/scripts';
-
+
$view->setEncoding('UTF-8');
$view->doctype('XHTML1_STRICT');
-
+
$view->headMeta()
->appendHttpEquiv('Content-Type', 'text/html; charset=UTF-8')
->appendHttpEquiv('Content-Language', 'fr-FR');
-
+
$view->headLink()
->appendStylesheet($pathStyle.'/jquery.qtip.css', 'all')
->appendStylesheet('/themes/jstree/default/style.css')
->appendStylesheet('/themes/jqueryui/jquery-ui.css', 'all')
->appendStylesheet($pathStyle.'/main.css', 'all');
-
+
$view->headScript()
->appendFile($pathScript.'/jquery.js', 'text/javascript')
->appendFile($pathScript.'/jquery.bgiframe.js', 'text/javascript')
->appendFile($pathScript.'/jquery.cookie.js', 'text/javascript')
->appendFile($pathScript.'/jquery-ui.js', 'text/javascript')
->appendFile($pathScript.'/jquery.qtip.js', 'text/javascript')
+ ->appendFile($pathScript.'/upload.js', 'text/javascript')
->appendFile($pathScript.'/scripts.js', 'text/javascript');
$view->headTitle()->setSeparator(' - ');
diff --git a/application/modules/frontend/controllers/EnrichissementController.php b/application/modules/frontend/controllers/EnrichissementController.php
index a2bbc2aa..718fffba 100644
--- a/application/modules/frontend/controllers/EnrichissementController.php
+++ b/application/modules/frontend/controllers/EnrichissementController.php
@@ -106,7 +106,7 @@ class EnrichissementController extends Zend_Controller_Action
//Récupération des SIRET
require_once 'Scores/Ciblage.php';
$ciblage = new Ciblage($values);
- $infosExtraction = $ciblage->extract();
+ $infosExtraction = $ciblage->execute(true);
//Attention calcul uniteInsee réelle
//car si donnée insee alors toutes les lignes doivent être comptés en unité insee
@@ -125,7 +125,6 @@ class EnrichissementController extends Zend_Controller_Action
);
$identifiantsM = new Table_EnrichissementIdentifiants();
$idIdentifiant = $identifiantsM->insert($data);
-
}
/**
diff --git a/application/modules/frontend/controllers/ExtractController.php b/application/modules/frontend/controllers/ExtractController.php
new file mode 100644
index 00000000..d1666228
--- /dev/null
+++ b/application/modules/frontend/controllers/ExtractController.php
@@ -0,0 +1,22 @@
+_helper->layout()->disableLayout();
+ $this->_helper->viewRenderer->setNoRender(true);
+ require_once 'Scores/Ciblage.php';
+ require_once 'Scores/Field.php';
+
+ $field = new Fields();
+ $ciblage = new Ciblage($field->getValues());
+
+ $ciblage->extract();
+ }
+
+ public function batchAction()
+ {
+ $action = $this->getRequest();
+ $request = $action->getParam('reference');
+ }
+}
\ No newline at end of file
diff --git a/application/modules/frontend/controllers/GeographiqueController.php b/application/modules/frontend/controllers/GeographiqueController.php
index 9d18b064..b58e4f0e 100644
--- a/application/modules/frontend/controllers/GeographiqueController.php
+++ b/application/modules/frontend/controllers/GeographiqueController.php
@@ -54,7 +54,7 @@ class GeographiqueController extends Libs_Controller
foreach ($result as $item) {
$output[] = array(
'label' => $item->libdep . $separator . $item->numdep,
- 'value' => 'D'.$item->numdep
+ 'value' => $item->numdep
);
}
return ($output);
@@ -62,8 +62,9 @@ class GeographiqueController extends Libs_Controller
protected function completedVil($q)
{
- $table = new Table_Codepostauxs();
-
+ $table = new Table_Codepostauxs();
+ $separator = ' ';
+
$sql = $table->select()->where('Commune LIKE "'.$q.'%"');
$result = $table->fetchAll($sql);
foreach ($result as $item) {
@@ -77,15 +78,16 @@ class GeographiqueController extends Libs_Controller
protected function completedReg($q)
{
- $table = new Table_Regions();
-
+ $table = new Table_Regions();
+ $separator = ' ';
+
$sql = $table->select()
->where('NCCENR LIKE "%'.$q.'%"');
$result = $table->fetchAll($sql);
foreach ($result as $item) {
$output[] = array(
'label' => $item->NCCENR . $separator . $item->REGION,
- 'value' => 'R'.$item->REGION
+ 'value' => $item->REGION
);
}
return ($output);
diff --git a/application/modules/frontend/controllers/IndexController.php b/application/modules/frontend/controllers/IndexController.php
index 5b540b15..b55dc090 100644
--- a/application/modules/frontend/controllers/IndexController.php
+++ b/application/modules/frontend/controllers/IndexController.php
@@ -32,7 +32,7 @@ Class IndexController extends Libs_Controller
$this->view->field = new Fields();
$this->view->criteres = $session->getCriteres();
}
-
+
public function removeAction()
{
require_once('Scores/SessionCiblage.php');
diff --git a/application/modules/frontend/models/Objects/Codepostaux.php b/application/modules/frontend/models/Objects/Codepostaux.php
index ece37e20..1f0db321 100644
--- a/application/modules/frontend/models/Objects/Codepostaux.php
+++ b/application/modules/frontend/models/Objects/Codepostaux.php
@@ -24,26 +24,27 @@ class Object_Codepostaux extends Libs_Row
$in = array();
foreach($valeurs as $valeur) {
+ $type = explode(':', $valeur);
if($niveau == 0) {
- if ($valeur[0] == 'D'){
- $valeur = substr($valeur, 1, strlen($valeur));
+ if ($type[0] == 'adr_dept'){
+ $valeur = $type[1];
$insee = $table->fetchAll($table->select('departements', array('codeRegionInsee'))
->where('numdep = ?', substr($valeur, 0, 2)))->toArray();
foreach ($insee as $code)
- $in[] = 'R'.$code['codeRegionInsee'];
+ $in[] = 'adr_reg:'.$code['codeRegionInsee'];
} else{
- $valeur = substr($valeur, 0, strlen($valeur));
+ $valeur = $type[1];
$insee = $table->fetchAll($table->select('departements', array('codeRegionInsee'))
->where('numdep = ?', substr($valeur, 0, 2)))->toArray();
foreach ($insee as $code)
- $in[] = 'R'.$code['codeRegionInsee'];
+ $in[] = 'adr_reg:'.$code['codeRegionInsee'];
}
} else if ($niveau == 1) {
- $valeur = substr($valeur, 0, strlen($valeur));
+ $valeur = $type[1];
$insee = $table->fetchAll($table->select('departements', array('codeRegionInsee'))
->where('numdep = ?', substr($valeur, 0, 2)))->toArray();
foreach ($insee as $code)
- $in[] = 'D'.$code['numdep'];
+ $in[] = 'adr_dept:'.$code['numdep'];
}
}
return ($in);
@@ -67,9 +68,9 @@ class Object_Codepostaux extends Libs_Row
foreach($regions as $nom) {
$structure[] = array(
'data' => $nom['NCCENR'],
- 'attr' => array('id' => 'R'.$nom['REGION'],
+ 'attr' => array('id' => 'adr_reg:'.$nom['REGION'],
'niveau' => 0,
- 'class' => $this->_getClass('R'.$nom['REGION'], 0)
+ 'class' => $this->_getClass('adr_reg:'.$nom['REGION'], 0)
),
'state' => 'closed',
'children' => array()
@@ -81,17 +82,18 @@ class Object_Codepostaux extends Libs_Row
public function _getDepartements($codeRegionInsee)
{
+ $code = explode(':', $codeRegionInsee);
$departement = new Table_Departements();
$departements = $departement->fetchAll($departement->select()
- ->where('codeRegionInsee ='.substr($codeRegionInsee, 1, strlen($codeRegionInsee))))->toArray();
+ ->where('codeRegionInsee ='.$code[1]))->toArray();
$structure = array();
foreach($departements as $nom) {
$structure[] = array(
'data' => $nom['libdep'],
- 'attr' => array('id' => 'D'.$nom['numdep'],
+ 'attr' => array('id' => 'adr_dept:'.$nom['numdep'],
'niveau' => 1,
- 'class' => $this->_getClass('D'.$nom['numdep'], 1)
+ 'class' => $this->_getClass('adr_dept:'.$nom['numdep'], 1)
),
'state' => 'closed',
'children' => array()
@@ -103,17 +105,17 @@ class Object_Codepostaux extends Libs_Row
public function _getCommunes($numdep)
{
- $numdep = substr($numdep, 1, strlen($numdep));
+ $numdep = explode(':', $numdep);
$codepostau = new Table_Codepostauxs();
- $codepostaux = $codepostau->fetchAll($codepostau->select()->where('codepos LIKE "'.$numdep.'%"'))->toArray();
+ $codepostaux = $codepostau->fetchAll($codepostau->select()->where('codepos LIKE "'.$numdep[1].'%"'))->toArray();
$structure = array();
foreach($codepostaux as $nom) {
$structure[] = array(
'data' => $nom['Commune'],
- 'attr' => array('id'=> $nom['INSEE'],
+ 'attr' => array('id'=> 'adr_com:'.$nom['INSEE'],
'niveau' => 2,
- 'class' => $this->_getClass($nom['INSEE'], 2)
+ 'class' => $this->_getClass('adr_com:'.$nom['INSEE'], 2)
),
'state' => 'closed',
'children' => array()
diff --git a/application/modules/frontend/models/Objects/Comptage.php b/application/modules/frontend/models/Objects/Comptage.php
index c61fa2e2..b57941dd 100644
--- a/application/modules/frontend/models/Objects/Comptage.php
+++ b/application/modules/frontend/models/Objects/Comptage.php
@@ -66,24 +66,35 @@ class Object_Comptage extends Libs_Row
$session->setCritere($key, $valeur);
if($valeur[strlen($valeur)] == ',')
$valeur = substr($valeur, 0, strlen($valeur) -1);
- if($key == 'reg' or $key == 'vil' or $key == 'dep') {
+ if($key == 'vil' or $key == 'adr_reg' or $key == 'adr_dept') {
$key = 'adr_com';
- if($session->getCritere('reg')){
- $reg = trim($session->getCritere('reg'));
- }
if($session->getCritere('vil')){
- $vil = trim($session->getCritere('vil'));
+ $valeurs = explode(',', $session->getCritere('vil'));
+ foreach($valeurs as $valeur) {
+ $vil .= 'adr_com:'.trim($valeur).',';
+ }
+ $vil = substr($vil, 0, strlen($vil)-1);
}
- if($session->getCritere('dep')){
- $dep = trim($session->getCritere('dep'));
+ if($session->getCritere('adr_reg')) {
+ $valeurs = explode(',', $session->getCritere('adr_reg'));
+ foreach($valeurs as $valeur) {
+ $reg .= 'adr_reg:'.trim($valeur).',';
+ }
+ $reg = substr($reg, 0, strlen($reg)-1);
}
- $valeur = implode('', array($reg, $vil, $dep));
+ if($session->getCritere('adr_dept')) {
+ $valeurs = explode(',', $session->getCritere('adr_dept'));
+ foreach($valeurs as $valeur) {
+ $dept .= 'adr_dept:'.trim($valeur).',';
+ }
+ $dept = substr($dept, 0, strlen($dept)-1);
+ }
+ $valeur = implode('', array($vil, $reg, $dept));
$session->setCritere($key, $valeur);
}
-
require_once 'Scores/Field.php';
$field = new Fields();
-
+
//Comptage
require_once 'Scores/Ciblage.php';
$ciblage = new Ciblage($field->getValues());
diff --git a/application/modules/frontend/views/helpers/Field.php b/application/modules/frontend/views/helpers/Field.php
index 6572714f..c6119ff8 100644
--- a/application/modules/frontend/views/helpers/Field.php
+++ b/application/modules/frontend/views/helpers/Field.php
@@ -51,7 +51,7 @@ Class Zend_View_Helper_Field extends Zend_View_Helper_Abstract
}
$html.= $this->structureHTML(
$label,
- $this->textHTML($name, $field, $name));
+ $this->textHTML($name, $field, $name), $field['help'][ucfirst($name)]);
break;
case 'textarea':
$html.= $this->structureHTML(
@@ -74,11 +74,11 @@ Class Zend_View_Helper_Field extends Zend_View_Helper_Abstract
return $html;
}
- private function structureHTML($label, $html, $liens = array())
+ private function structureHTML($label, $html, $help = null)
{
$out = '';
- $out.= $this->structureLabel($label);
- $out.= '
'.$html.$this->structureLink($liens).'
';
+ $out.= $this->structureLabel($label, $help);
+ $out.= ''.$html.'
';
return $out;
}
@@ -86,28 +86,16 @@ Class Zend_View_Helper_Field extends Zend_View_Helper_Abstract
* Définition du label
* @param unknown_type $label
*/
- private function structureLabel($label)
+ private function structureLabel($label, $help)
{
- return '';
+ $return = '';
+ if($help)
+ $return .= ''.$help.'
';
+
+
+ return ($return);
}
-
- /**
- * Définition des liens
- */
- private function structureLink($liens = array())
- {
- $html = '';
- if (count($liens)>0) {
- foreach($liens as $lien){
- $html.= ''.$lien['lib'].'';
- }
- }
- if (!empty($html)) {
- return ''.$html.'';
- }
- return '';
- }
-
+
private function intervalSelectHTML($name, $field)
{
$session = new SessionCiblage();
@@ -133,7 +121,6 @@ Class Zend_View_Helper_Field extends Zend_View_Helper_Abstract
private function selectMultipleHTML($name, $field)
{
$session = new SessionCiblage();
-
$return = '