Subversion Repositories eFlore/Applications.coel

Rev

Rev 1702 | Rev 1721 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1702 Rev 1704
Line 205... Line 205...
205
        if(isset($qs['pays'])) {
205
        if(isset($qs['pays'])) {
206
            $p['pays'] = array_filter(explode(',', $qs['pays']), create_function('$val', 'return preg_match("/^[A-Z][A-Z]$/", $val);'));
206
            $p['pays'] = array_filter(explode(',', $qs['pays']), create_function('$val', 'return preg_match("/^[A-Z][A-Z]$/", $val);'));
207
            if(!$p['pays']) unset($p['pays']);
207
            if(!$p['pays']) unset($p['pays']);
208
        }
208
        }
Line -... Line 209...
-
 
209
 
-
 
210
        if(isset($qs['regions'])) {
-
 
211
            $p['regions'] = array_filter(explode(',', $qs['regions']), create_function('$val', 'return preg_match("/^[A-Z][A-Z]\.\w\w$/", $val);'));
-
 
212
            if(!$p['regions']) unset($p['regions']);
-
 
213
        }
209
 
214
 
210
		return $p;
215
		return $p;
Line 211... Line 216...
211
	}
216
	}
212
	
217
	
Line 264... Line 269...
264
		if (isset($p['pr'])) {
269
		if (isset($p['pr'])) {
265
			$where[] = "ccap_id_role IN ({$p['pr']})";
270
			$where[] = "ccap_id_role IN ({$p['pr']})";
266
		}
271
		}
Line 267... Line 272...
267
 
272
 
-
 
273
        // par défaut, spécifier un département restreint à la France
268
        // par défaut, spécifier un département restreint à la France
274
        // TODO: INNER JOIN
269
		if (isset($p['str-d'])) {
275
		if (isset($p['str-d'])) {
270
            $join[] = 'LEFT JOIN coel_meta_liste_valeur cv ON cv.cmlv_id_valeur = cs_ce_truk_pays';
276
            $join[] = 'LEFT JOIN coel_meta_liste_valeur cv ON cv.cmlv_id_valeur = cs_ce_truk_pays';
271
			$where[] = 'cv.cmlv_abreviation = "FR"';
277
			$where[] = 'cv.cmlv_abreviation = "FR"';
272
			$where[] = sprintf("cs_code_postal REGEXP '^(%s).*'", implode('|', $p['str-d']));
278
			$where[] = sprintf("cs_code_postal REGEXP '^(%s).*'", implode('|', $p['str-d']));
Line -... Line 279...
-
 
279
		}
-
 
280
 
-
 
281
        // http://download.geonames.org/export/dump/admin1CodesASCII.txt
-
 
282
		if (isset($p['regions'])) {
-
 
283
            $join[] = 'LEFT JOIN coel_meta_liste_valeur cv ON cv.cmlv_id_valeur = cs_ce_truk_region';
-
 
284
			$where[] = sprintf('cv.cmlv_abreviation IN ("%s")', implode('","', $p['regions']));
273
		}
285
		}
274
 
286
 
275
		if (isset($p['pays'])) {
287
		if (isset($p['pays'])) {
276
            $join[] = 'LEFT JOIN coel_meta_liste_valeur cv ON cv.cmlv_id_valeur = cs_ce_truk_pays';
288
            $join[] = 'LEFT JOIN coel_meta_liste_valeur cv ON cv.cmlv_id_valeur = cs_ce_truk_pays';