Exclusion OK ! geographique

This commit is contained in:
Damien LASSERRE 2012-04-10 13:20:08 +00:00
parent 38922b0fd0
commit da28d19390

View File

@ -82,6 +82,13 @@ Class Ciblage
}
public function execute($need = false)
{
// Si adr_dept vide alors recuper toute la liste des départements
// Les mettres en positifs.
//$this->alpha = '@adr_dept (78 | 92 | 93) -(78)';
// et
//$this->alpha = '@adr_dept (78) @adr_com -(78165)';
// Les deux requetes marches.
//echo $this->alpha;
if($need) {
$return = array();
$limit = 0;
@ -107,8 +114,33 @@ Class Ciblage
protected function setFilterRange($name, $valeur) {
$this->sphinx->SetFilterRange($name, intval($valeur[0]), intval($valeur[1]));
}
private function getListeDepartement()
{
$table = new Table_Departements();
$sql = $table->select();
$result = $table->fetchAll($sql)->toArray();
foreach ($result as $dept) {
$depts .= $dept['numdep'].' | ';
}
$depts = substr($depts, 0, strlen($depts)-2);
return ($depts);
}
protected function writeRequest($name, $valeur, $ex, $or = false) {
$this->alpha .= ((!empty($this->alpha))?' | ':'').'@'.$name . (($ex)?" -":" ").'(';
if(in_array($name, array('adr_com_ex'))) {
if(!strstr($this->alpha, 'adr_dept')) {
$this->alpha .= ' @exclu (ex) ';
}
switch($name) {
case 'adr_com_ex':
$name = 'adr_com';
break;
case 'adr_dept_ex':
$name = 'adr_dept';
break;
}
}
$this->alpha .= ((!empty($this->alpha))?' ':'').'@'.$name . (($ex)?" -":" ").'(';
if(!is_array($valeur)) {
$this->alpha .= $valeur.')';
} else {
@ -155,7 +187,7 @@ Class Ciblage
$this->setAlpha('adr_com', $valeur);
}
protected function adr_com_ex($valeur) {
$this->setAlpha('adr_com', $valeur, true);
$this->setAlpha('adr_com_ex', $valeur, true);
}
protected function adr_dept($valeur) {
$this->setAlpha('adr_dept', $valeur);