Subversion Repositories eFlore/Archives.eflore-consultation-v2

Rev

Rev 116 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

<?php
class VERNACULAIRE_RECHERCHE extends macroElement {
    function getSQL()
    {
        $contexte = array();
        if (array_key_exists('radical', $this->contexteRef)) {
            $contexte['radical'] = $this->contexteRef['radical'];
            if(!empty($contexte['radical'])) {
                return 
                'SELECT DISTINCT
                langue.el_nom_langue_principal,
                langue.el_code_langue,
                zg.ezg_intitule_principal_zg,
                zg.ezg_code_zg,
                vernaculaire.ev_id_nom_vernaculaire,
                vernaculaire.ev_intitule_nom_vernaculaire,
                taxon.et_id_version_projet_taxon,
                intitule.eni_intitule_nom,
                nom.en_id_nom
                
                FROM 
                eflore_langue AS langue,
                eflore_zg AS zg,
                eflore_vernaculaire AS vernaculaire,
                eflore_vernaculaire_attribution AS attribution,
                eflore_taxon AS taxon,
                eflore_selection_nom AS selection,
                eflore_selection_nom_statut AS statut,
                eflore_nom AS nom,
                eflore_nom_intitule AS intitule
                
                WHERE 
                intitule.eni_id_categorie_format = 3 
                AND intitule.eni_id_valeur_format = 4 
                AND intitule.eni_id_nom = nom.en_id_nom 
                AND nom.en_id_nom NOT IN 
                    (
                        SELECT nom_relation.enr_id_nom_1 
                        FROM eflore_nom_relation AS nom_relation 
                        WHERE nom_relation.enr_id_nom_1 = nom_relation.enr_id_nom_2 
                        AND nom_relation.enr_id_categorie_relation = 10
                        AND nom_relation.enr_id_valeur_relation = 3
                    )
                AND nom.en_id_nom = selection.esn_id_nom 
                AND selection.esn_id_taxon = taxon.et_id_taxon 
                AND selection.esn_id_version_projet_taxon = taxon.et_id_version_projet_taxon 
                AND selection.esn_ce_statut = statut.esns_id_statut 
                AND statut.esns_id_statut = 3 
                AND taxon.et_id_version_projet_taxon  = attribution.eva_id_version_projet_taxon_ref 
                AND taxon.et_id_taxon = attribution.eva_id_taxon_ref 
                AND attribution.eva_id_nom_vernaculaire = vernaculaire.ev_id_nom_vernaculaire 
                AND vernaculaire.ev_ce_langue = langue.el_id_langue 
                AND vernaculaire.ev_ce_version_projet_langue = langue.el_id_version_projet_langue
                AND attribution.eva_ce_zone_geo = zg.ezg_id_zone_geo 
                AND attribution.eva_ce_version_projet_zg = zg.ezg_id_version_projet_zg 
                AND vernaculaire.ev_intitule_nom_vernaculaire LIKE "'.$contexte['radical'].'" 
                ORDER BY vernaculaire.ev_intitule_nom_vernaculaire ASC';
            }
        }
        return null;
    }
}
?>