Subversion Repositories eFlore/Projets.eflore-projets

Compare Revisions

Ignore whitespace Rev 208 → Rev 209

/trunk/services/bibliotheque/nom/NomDAO.php
50,16 → 50,16
if ($masqueSp = $this->parametres->getMasquePourBdd('sp')) {
$conditions[] = "ns.epithete_sp = $masqueSp";
}
 
$navigation = $this->getNavigation();
$requete = 'SELECT SQL_CALC_FOUND_ROWS ns.*, '.
' nr.nom_sci AS nr_nom_sci, nb.nom_sci AS nb_nom_sci '.
"FROM $table AS ns ".
" LEFT JOIN $table AS nr ON (ns.num_nom_retenu = nr.num_nom) ".
" LEFT JOIN $table AS nb ON (ns.basionyme = nb.num_nom) ".
(count($conditions) > 0 ? 'WHERE ' : '').
implode(' AND ', $conditions).
'ORDER BY ns.nom_sci ASC '.
'LIMIT 0,100';
' nr.nom_sci AS nr_nom_sci, nb.nom_sci AS nb_nom_sci '.
"FROM $table AS ns ".
" LEFT JOIN $table AS nr ON (ns.num_nom_retenu = nr.num_nom) ".
" LEFT JOIN $table AS nb ON (ns.basionyme = nb.num_nom) ".
$this->getWhere($conditions).
implode(' AND ', $conditions).
'ORDER BY ns.nom_sci ASC '.
"LIMIT $navigation ";
$resultats = $this->bdd->recupererTous($requete);
 
return $resultats;
80,15 → 80,16
if ($masqueSp = $this->parametres->getMasquePourBdd('sp')) {
$conditions[] = "ns.epithete_sp LIKE $masqueSp";
}
$navigation = $this->getNavigation();
$requete = 'SELECT SQL_CALC_FOUND_ROWS ns.*, '.
' nr.nom_sci AS nr_nom_sci, nb.nom_sci AS nb_nom_sci '.
"FROM $table AS ns ".
" LEFT JOIN $table AS nr ON (ns.num_nom_retenu = nr.num_nom) ".
" LEFT JOIN $table AS nb ON (ns.basionyme = nb.num_nom) ".
(count($conditions) > 0 ? 'WHERE ' : '').
implode(' AND ', $conditions).
'ORDER BY ns.nom_sci ASC '.
'LIMIT 0,100';
' nr.nom_sci AS nr_nom_sci, nb.nom_sci AS nb_nom_sci '.
"FROM $table AS ns ".
" LEFT JOIN $table AS nr ON (ns.num_nom_retenu = nr.num_nom) ".
" LEFT JOIN $table AS nb ON (ns.basionyme = nb.num_nom) ".
$this->getWhere($conditions).
implode(' AND ', $conditions).
'ORDER BY ns.nom_sci ASC '.
"LIMIT $navigation ";
 
$resultats = $this->bdd->recupererTous($requete);
return $resultats;
97,20 → 98,38
public function rechercherFloue() {
$table = $this->getTable();
$masque = $this->parametres->getMasquePourBdd();
$navigation = $this->getNavigation();
$requete = 'SELECT SQL_CALC_FOUND_ROWS ns.*, '.
' nr.nom_sci AS nr_nom_sci, nb.nom_sci AS nb_nom_sci '.
"FROM $table AS ns ".
" LEFT JOIN $table AS nr ON (ns.num_nom_retenu = nr.num_nom) ".
" LEFT JOIN $table AS nb ON (ns.basionyme = nb.num_nom) ".
($masque ? 'WHERE '.
' nr.nom_sci AS nr_nom_sci, nb.nom_sci AS nb_nom_sci '.
"FROM $table AS ns ".
" LEFT JOIN $table AS nr ON (ns.num_nom_retenu = nr.num_nom) ".
" LEFT JOIN $table AS nb ON (ns.basionyme = nb.num_nom) ".
$this->getWhere().
($masque ?
" (SOUNDEX(ns.nom_sci) = SOUNDEX($masque)) ".
" OR (SOUNDEX(REVERSE(ns.nom_sci)) = SOUNDEX(REVERSE($masque))) " : '').
'ORDER BY ns.nom_sci ASC '.
'LIMIT 0,100';
'ORDER BY ns.nom_sci ASC '.
"LIMIT $navigation ";
$resultats = $this->bdd->recupererTous($requete);
return $resultats;
}
 
private function getNavigation() {
$debut = $this->parametres->get('navigation.depart');
$nbre = $this->parametres->get('navigation.limite');
return "$debut,$nbre";
}
 
private function getWhere($conditions = array()) {
$where = '';
if ($this->ressources->getServiceNom() == 'taxons') {
$where = 'WHERE ns.num_nom = ns.num_nom_retenu ';
} else if (count($conditions) > 0) {
$where = 'WHERE ';
}
return $where;
}
 
public function recupererNombreNomsTotal() {
$requete = 'SELECT FOUND_ROWS() AS nbre';
$nombre = $this->bdd->recuperer($requete);