Subversion Repositories eFlore/Archives.eflore-consultation-v2

Rev

Rev 123 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
123 jpm 1
<?php
2
class TAXON_RECHERCHE extends macroElement {
3
    function getSQL()
4
    {
5
        $contexte = array();
6
        if (array_key_exists('nvp', $this->contexteRef) and
7
            array_key_exists('rg', $this->contexteRef)  and
8
            array_key_exists('od', $this->contexteRef)) {
9
 
10
            $contexte['nvp'] = $this->contexteRef['nvp'];
11
            $contexte['rg'] = $this->contexteRef['rg'];
12
            $contexte['od'] = $this->contexteRef['od'];
13
            if (!empty($contexte['nvp']) && !empty($contexte['rg']) && !empty($contexte['od'])) {
14
                $requete =
15
                'SELECT DISTINCT
16
                nom.en_id_nom,
17
                intitule.eni_intitule_nom,
18
                selection.esn_id_taxon,
19
                selection.esn_id_version_projet_taxon
20
 
21
                FROM
22
                eflore_nom AS nom,
23
                eflore_nom_intitule AS intitule,
24
                eflore_selection_nom AS selection
25
 
26
                WHERE
27
                nom.en_id_nom = intitule.eni_id_nom
28
                AND intitule.eni_id_categorie_format = 3
29
                AND intitule.eni_id_valeur_format = 4
30
                AND selection.esn_id_nom = nom.en_id_nom
31
                AND selection.esn_ce_statut = 3
32
                AND selection.esn_id_version_projet_taxon = '.$contexte['nvp'].' ';
33
                switch ($contexte['od']) {
34
                    case 'sup' :
35
                        $requete .= 'AND nom.en_ce_rang < '.$contexte['rg'].' ';
36
                        break;
37
                    case 'ega' :
38
                        $requete .= 'AND nom.en_ce_rang = '.$contexte['rg'].' ';
39
                        break;
40
                    case 'inf' :
41
                        $requete .= 'AND nom.en_ce_rang > '.$contexte['rg'].' ';
42
                        break;
43
                }
133 jpm 44
                $requete .= 'ORDER BY intitule.eni_intitule_nom ASC';
123 jpm 45
                return $requete;
46
            }
47
        }
48
        return null;
49
    }
50
}
51
?>