Subversion Repositories eFlore/Applications.del

Rev

Rev 1490 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1490 Rev 1494
Line 407... Line 407...
407
			$req['where'][] = sprintf('vdi.nom_referentiel LIKE %s', $db->proteger($p['masque.referentiel'].'%'));
407
	    $req['where'][] = sprintf('vdi.nom_referentiel LIKE %s', $db->proteger($p['masque.referentiel'].'%'));
408
		}
408
	}
409
		if(!empty($p['masque.commune'])) {
409
	if(!empty($p['masque.commune'])) {
410
			$req['where'][] = 'vdi.zone_geo LIKE '.$db->proteger($p['masque.commune'].'%');
410
	    $req['where'][] = 'vdi.zone_geo LIKE '.$db->proteger($p['masque.commune'].'%');
411
		}
411
	}
412
		if(!empty($p['masque.tag'])) {
-
 
413
			// TODO: remove LOWER() lorsqu'on est sur que les tags sont uniformés en minuscule
-
 
414
			// i_mots_cles_texte provient de la VIEW v_del_image
-
 
415
			if(isset($p['masque.tag']['AND'])) {
-
 
416
                /* Lorsque nous interprêtons la chaîne provenant du masque général (cf: buildTagsAST($p['masque'], 'OR', ' ') dans sqlAddMasqueConstraint()),
-
 
417
                   nous sommes splittés par espace. Cependant, assurons que si une virgule à été saisie, nous n'aurons pas le motif
-
 
418
                   " AND CONCAT(mots_cles_texte, i_mots_cles_texte) REGEXP ',' " dans notre requête.
-
 
419
                   XXX: Au 12/11/2013, une recherche sur tag depuis le masque général implique un OU, donc le problème ne se pose pas ici */
-
 
420
				$subwhere = array();
-
 
421
				foreach($p['masque.tag']['AND'] as $tag) {
-
 
422
                    if(trim($tag) == ',') continue;
-
 
423
 
-
 
424
					$subwhere[] = sprintf(
-
 
425
						'LOWER(CONCAT(%s)) REGEXP %s',
-
 
426
						DelTk::sqlAddIfNullPourConcat(array('vdi.mots_cles_texte', 'vdi.i_mots_cles_texte')),
-
 
427
						$db->proteger(strtolower($tag)));
-
 
428
				}
-
 
429
				$req['where'][] = '(' . implode(' AND ', $subwhere) . ')';
-
 
430
			}
-
 
431
			else {
-
 
432
				$req['where'][] = sprintf(
-
 
433
					'LOWER(CONCAT(%s)) REGEXP %s',
-
 
434
					DelTk::sqlAddIfNullPourConcat(array('vdi.mots_cles_texte', 'vdi.i_mots_cles_texte')),
-
 
435
					$db->proteger(strtolower(implode('|', $p['masque.tag']['OR']))));
-
 
436
			}
-
 
437
		}
-
 
438
    }
412
    }
Line 439... Line -...
439
 
-
 
440
 
-
 
441
 
-
 
442
 
-
 
443
 
413
 
444
 
414
 
445
 
415
 
446
    // formatage de réponse HTTP
416
    // formatage de réponse HTTP
Line 473... Line 443...
473
			'limite' => $params['navigation.limite'],
443
	    'limite' => $params['navigation.limite'],
474
			'href.precedent' => $prev_url,
444
	    'href.precedent' => $prev_url,
475
			'href.suivant' => $next_url
445
	    'href.suivant' => $next_url
476
		);
446
	);
477
	}
447
    }
478
 
-
 
479
}
448
}
480
449