Subversion Repositories eFlore/Archives.eflore-consultation-v2

Compare Revisions

Ignore whitespace Rev 122 → Rev 123

/trunk/serveur/eflore_mv/modeles/macro_elements/TAXON_RECHERCHE_ALPHABET.php
New file
0,0 → 1,55
<?php
class TAXON_RECHERCHE_ALPHABET extends macroElement {
function getSQL()
{
$contexte = array();
if (array_key_exists('nvp', $this->contexteRef) and
array_key_exists('rg', $this->contexteRef) and
array_key_exists('od', $this->contexteRef) and
array_key_exists('le', $this->contexteRef)) {
$contexte['nvp'] = $this->contexteRef['nvp'];
$contexte['rg'] = $this->contexteRef['rg'];
$contexte['od'] = $this->contexteRef['od'];
$contexte['le'] = $this->contexteRef['le'];
if (!empty($contexte['nvp']) && !empty($contexte['rg']) && !empty($contexte['od']) && !empty($contexte['le'])) {
$requete =
'SELECT DISTINCT
nom.en_id_nom,
intitule.eni_intitule_nom,
selection.esn_id_taxon,
selection.esn_id_version_projet_taxon
FROM
eflore_nom AS nom,
eflore_nom_intitule AS intitule,
eflore_selection_nom AS selection
WHERE
intitule.eni_intitule_nom LIKE "'.$contexte['le'].'%"
AND nom.en_id_nom = intitule.eni_id_nom
AND intitule.eni_id_categorie_format = 3
AND intitule.eni_id_valeur_format = 4
AND nom.en_id_nom = selection.esn_id_nom
AND selection.esn_ce_statut = 3
AND selection.esn_id_version_projet_taxon = '.$contexte['nvp'].' ';
switch ($contexte['od']) {
case 'sup' :
$requete .= 'AND nom.en_ce_rang < '.$contexte['rg'].' ';
break;
case 'ega' :
$requete .= 'AND nom.en_ce_rang = '.$contexte['rg'].' ';
break;
case 'inf' :
$requete .= 'AND nom.en_ce_rang > '.$contexte['rg'].' ';
break;
}
$requete .= 'ORDER BY intitule.eni_intitule_nom ASC';
return $requete;
}
}
return null;
}
}
?>