Exclusions

This commit is contained in:
Damien LASSERRE 2012-04-06 08:29:25 +00:00
parent 5ad2717112
commit b0962b753c
2 changed files with 36 additions and 10 deletions

View File

@ -32,7 +32,7 @@ Class Ciblage
{ {
$this->need = true; $this->need = true;
$configuration = Zend_Registry::get('configuration'); $configuration = Zend_Registry::get('configuration');
print_r($structure);
//Instantiation Sphinx //Instantiation Sphinx
$this->sphinx = new SphinxClient(); $this->sphinx = new SphinxClient();
$this->sphinx->SetServer($configuration->sphinx->host, intval($configuration->sphinx->port)); $this->sphinx->SetServer($configuration->sphinx->host, intval($configuration->sphinx->port));
@ -107,8 +107,8 @@ print_r($structure);
protected function setFilterRange($name, $valeur) { protected function setFilterRange($name, $valeur) {
$this->sphinx->SetFilterRange($name, intval($valeur[0]), intval($valeur[1])); $this->sphinx->SetFilterRange($name, intval($valeur[0]), intval($valeur[1]));
} }
protected function writeRequest($name, $valeur, $or = false, $ex =false) { protected function writeRequest($name, $valeur, $ex, $or = false) {
$this->alpha .= '@'.$name . (($ex)?'-':'').' ('; $this->alpha .= '@'.$name . (($ex)?' -':'').'(';
if(!is_array($valeur)) { if(!is_array($valeur)) {
$this->alpha .= $valeur.')'; $this->alpha .= $valeur.')';
} else { } else {
@ -125,16 +125,17 @@ print_r($structure);
} }
protected function setAlpha($name, $valeur, $ex = false) protected function setAlpha($name, $valeur, $ex = false)
{ {
$or = array('adr_com', 'adr_dept'); $or = array('adr_com', 'adr_dept', 'adr_com_ex');
$and = array('bilType', 'ape_etab','ape_entrep', 'NaceEntrep', 'NaceEtab'); $and = array('bilType', 'ape_etab','ape_entrep', 'NaceEntrep', 'NaceEtab');
if(!empty($this->alpha)) if(!empty($this->alpha))
$this->alpha .= ' '; $this->alpha .= ' ';
if(in_array($name, $or)) { if(in_array($name, $or)) {
if(!empty($valeur)) if(!empty($valeur)) {
$this->writeRequest($name, $valeur, true); $this->writeRequest($name, $valeur, $ex);
}
} else if(in_array($name, $and)) { } else if(in_array($name, $and)) {
if(!empty($valeur)) if(!empty($valeur))
$this->writeRequest($name, $valeur); $this->writeRequest($name, $valeur, $ex);
} }
} }
protected function transformIntval($array) { protected function transformIntval($array) {
@ -154,7 +155,6 @@ print_r($structure);
$this->setAlpha('adr_com', $valeur); $this->setAlpha('adr_com', $valeur);
} }
protected function adr_com_ex($valeur) { protected function adr_com_ex($valeur) {
print_r($valeur);
$this->setAlpha('adr_com', $valeur, true); $this->setAlpha('adr_com', $valeur, true);
} }
protected function adr_dept($valeur) { protected function adr_dept($valeur) {

View File

@ -376,7 +376,7 @@ Class Fields
'title' => 'Localisation' 'title' => 'Localisation'
), ),
'adr_com_ex' => array( 'adr_com_ex' => array(
'label' => 'Code commune Insee', 'label' => 'Localisation Villes (Exclure)',
'fields' => array( 'fields' => array(
'text' => array('value' => null), 'text' => array('value' => null),
'textarea' => array('value' => null) 'textarea' => array('value' => null)
@ -401,6 +401,19 @@ Class Fields
'action' => 'geographique', 'action' => 'geographique',
'title' => 'Localisation' 'title' => 'Localisation'
), ),
'adr_dept_ex' => array(
'label' => 'Liste départements (Exclure)',
'fields' => array(
'text' => array('value' => null),
'textarea' => array('value' => null)
),
'famille' => 'geographique',
'activated' => true,
'type' => 'textarea',
'class' => null,
'action' => 'geographique',
'title' => 'Localisation'
),
'adr_reg' => array( 'adr_reg' => array(
'label' => 'Liste code région', 'label' => 'Liste code région',
'fields' => array( 'fields' => array(
@ -414,6 +427,19 @@ Class Fields
'action' => 'geographique', 'action' => 'geographique',
'title' => 'Localisation' 'title' => 'Localisation'
), ),
'adr_reg_ex' => array(
'label' => 'Liste code région (Exclure)',
'fields' => array(
'text' => array('value' => null),
'textarea' => array('value' => null)
),
'famille' => 'geographique',
'activated' => true,
'type' => 'textarea',
'class' => null,
'action' => 'geographique',
'title' => 'Localisation'
),
'zus' => array( 'zus' => array(
'label' => 'Zones urbaines sensibles', 'label' => 'Zones urbaines sensibles',
'fields' => array( 'fields' => array(
@ -833,7 +859,6 @@ Class Fields
} }
} }
} else { } else {
echo 'ici';exit;
$values[$key] = $item; $values[$key] = $item;
} }
} }
@ -858,6 +883,7 @@ Class Fields
case 'adr_dept': case 'adr_dept':
case 'adr_reg': case 'adr_reg':
case 'adr_com': case 'adr_com':
case 'adr_com_ex':
$valeurs = explode(',', $valeur); $valeurs = explode(',', $valeur);
foreach($valeurs as $element) { foreach($valeurs as $element) {
if(!empty($element)) { if(!empty($element)) {