Subversion Repositories eFlore/Archives.eflore-consultation-v2

Rev

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

Rev Author Line No. Line
123 jpm 1
<?php
2
/*vim: set expandtab tabstop=4 shiftwidth=4: */
3
// +------------------------------------------------------------------------------------------------------+
4
// | PHP version 5.0.3                                                                                    |
5
// +------------------------------------------------------------------------------------------------------+
6
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org)                                         |
7
// +------------------------------------------------------------------------------------------------------+
8
// | This file is part of eRibo.                                                                          |
9
// |                                                                                                      |
10
// | Foobar is free software; you can redistribute it and/or modify                                       |
11
// | it under the terms of the GNU General Public License as published by                                 |
12
// | the Free Software Foundation; either version 2 of the License, or                                    |
13
// | (at your option) any later version.                                                                  |
14
// |                                                                                                      |
15
// | Foobar is distributed in the hope that it will be useful,                                            |
16
// | but WITHOUT ANY WARRANTY; without even the implied warranty of                                       |
17
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the                                        |
18
// | GNU General Public License for more details.                                                         |
19
// |                                                                                                      |
20
// | You should have received a copy of the GNU General Public License                                    |
21
// | along with Foobar; if not, write to the Free Software                                                |
22
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                            |
23
// +------------------------------------------------------------------------------------------------------+
179 ddelon 24
// CVS : $Id: formulaire_taxonomique_xhtml.php,v 1.9 2005-08-25 14:35:59 ddelon Exp $
123 jpm 25
/**
26
* Vue affichant le formulaire de recherche taxonomique.
27
*
28
* Permet de retourner le xhtml correspondant au formulaire de recherche taxonomique.
29
*
30
*@package eFlore
31
*@subpackage Vues
32
//Auteur original :
33
*@author        Frédéric LEGENS <flegens@free.fr>
34
//Autres auteurs :
35
*@author        Jean-Pascal MILCENT <jpm@tela-botanica.org>
36
*@copyright     Tela-Botanica 2000-2004
179 ddelon 37
*@version       $Revision: 1.9 $ $Date: 2005-08-25 14:35:59 $
123 jpm 38
// +------------------------------------------------------------------------------------------------------+
39
*/
40
 
41
// +------------------------------------------------------------------------------------------------------+
42
// |                                            ENTETE du PROGRAMME                                       |
43
// +------------------------------------------------------------------------------------------------------+
44
require_once EFSE_CHEMIN_FONCTION.'eribo_encodage.fonct.php';
45
$GLOBALS['alphabet'] = array();
46
 
47
// +------------------------------------------------------------------------------------------------------+
48
// |                                            CLASSE de la VUE                                          |
49
// +------------------------------------------------------------------------------------------------------+
50
class formulaire_taxonomique_xhtml implements iVue {
51
 
52
    protected $leBlock;
53
 
54
    function __construct($unBlock)
55
    {
56
        $this->leBlock = $unBlock;
57
    }
58
 
59
    function serialiser()
60
    {
61
        $retour = '<?xml version="1.0" encoding="iso-8859-15" ?>'."\n";
62
        $retour .= '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "../../../commun/generique/dtd/xhtml1-strict.dtd">'."\n";
63
        $retour .= '<html xmlns="http://w ww.w3.org/1999/xhtml" lang="fr" >'."\n";
64
 
65
        $retour .= '<head>'."\n";
66
        $retour .= '<!-- BEGIN entete -->'."\n";
67
        $retour .= '<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-15" />'."\n";
68
        $retour .= '<meta http-equiv="Content-style-type" content="text/css" />'."\n";
69
        $retour .= '<meta http-equiv="Content-script-type" content="text/javascript />'."\n";
70
        $retour .= '<meta http-equiv="Content-language" content="fr" />'."\n";
170 jpm 71
        $retour .= '<title>Formulaire de recherche taxonomique</title>'."\n";
123 jpm 72
        $retour .= '<!-- END entete -->'."\n";
73
        $retour .= '</head>'."\n";
74
 
75
        $retour .= '<body>'."\n";
76
        $retour .= '<!-- BEGIN corps -->'."\n";
173 jpm 77
        $retour .= '<h2>'.'Consultation taxonomique'.'</h2>'."\n";
123 jpm 78
        $retour .= '<form id="eflore_form_taxonomie" name="eflore_form_taxonomie" action="{UrlProjetTaxon}" method="post">'."\n";
173 jpm 79
        $retour .= '<fieldset>'."\n".'<legend>'.'Consultation taxonomique'.'</legend>'."\n";
164 tam 80
        $retour .= '<ul>'."\n";
179 ddelon 81
        $retour .= '<li><label for="eflore_projet">'.'Référentiel : '.'</label>'."\n";
123 jpm 82
        $retour .= '<select id="eflore_projet" name="eflore_projet">'."\n";
136 jpm 83
        $retour .= $this->leBlock->afficherPattern('FORMULAIRE_TAXONOMIQUE>PROJET_VERSION_TOUS','afficherProjets', null, TRUE);
164 tam 84
        $retour .= '</select></li>'."\n";
173 jpm 85
        $retour .= '<li id="eflore_rang_li"><label for="eflore_rang">'.'Rang : '.'</label>'."\n";
123 jpm 86
        $retour .= '<select id="eflore_rang" name="eflore_rang">'."\n";
87
        $retour .= $this->leBlock->afficherPattern('FORMULAIRE_TAXONOMIQUE','afficherRang');
164 tam 88
        $retour .= '</select></li>'."\n";
170 jpm 89
        $retour .= '<li><input id="eflore_taxonomie_submit" type="submit" value="'.'OK'.'" /></li>'."\n";
123 jpm 90
        $retour .= $this->leBlock->afficherPattern('FORMULAIRE_TAXONOMIQUE>TAXON_RECHERCHE','creerAlphabetTaxon');
91
        $retour .= afficherAlphabetTaxon();
164 tam 92
        $retour .= '</ul>'."\n";
173 jpm 93
        $retour .= '<input id="eflore_ordre" name="eflore_ordre" type="hidden" value="ega" />'."\n";
123 jpm 94
        $retour .= '</fieldset>'."\n";
95
        $retour .= '</form>'."\n";
96
        $retour .= '<!-- END corps -->'."\n";
97
        $retour .= '</body>'."\n";
98
        $retour .= '</html>'."\n";
99
 
100
        // Envoi au navigateur après encodage en entité des caractères posant problème
101
        echo remplaceEntiteHTLM($retour);
102
    }
103
}
104
 
105
// +------------------------------------------------------------------------------------------------------+
106
// |                                            LISTE des FONCTIONS                                       |
107
// +------------------------------------------------------------------------------------------------------+
108
function afficherProjets($donnees)
109
{
136 jpm 110
    //$retour .= '<pre>'.print_r($donnees, true).'</pre>';
111
    if ($donnees['PROJET_VERSION_TOUS']['eprv_id_version'] == $donnees['FORMULAIRE_TAXONOMIQUE']['nvp']) {
112
        $retour .= '  <option value="'.$donnees['PROJET_VERSION_TOUS']['eprv_id_version'].'" selected="selected">';
123 jpm 113
    } else {
136 jpm 114
        $retour .= '  <option value="'.$donnees['PROJET_VERSION_TOUS']['eprv_id_version'].'">';
123 jpm 115
    }
173 jpm 116
    $retour .= $donnees['PROJET_VERSION_TOUS']['eprv_nom'].' ('.$donnees['PROJET_VERSION_TOUS']['eprv_code_version'].') - '.$donnees['PROJET_VERSION_TOUS']['epr_intitule_projet'];
123 jpm 117
    $retour .= '</option>'."\n";
118
    return $retour;
119
}
120
 
121
function creerAlphabetTaxon($donnees)
122
{
123
    $chaine = '';
124
    if (!empty($donnees['eni_intitule_nom'])) {
125
        $chaine = $donnees['eni_intitule_nom'];
126
    }
127
    if (isset($chaine{0}) AND !isset($GLOBALS['alphabet'][$chaine{0}])) {
128
        $GLOBALS['alphabet'][$chaine{0}] = $chaine{0};
129
    }
130
}
131
 
132
function afficherAlphabetTaxon()
133
{
134
    $retour = '';
135
    if (count($GLOBALS['alphabet']) != 0) {
136
        $retour .= '</p>'."\n";
137
        $retour .= '<p>'."\n";
138
        foreach ($GLOBALS['alphabet'] as $cle) {
139
            $retour .= '<input id="eflore_lettre" name="eflore_lettre" type="submit" value="'.ucfirst($cle).'" />'."\n";
140
        }
141
        $retour .= '<input id="eflore_lettre" name="eflore_lettre" type="submit" value="'.'TOUS'.'" />'."\n";
142
    }
143
    return $retour;
144
}
173 jpm 145
// Fonction afficherOrdre($donnees) inutilisé en mode d'affichage par défaut
123 jpm 146
function afficherOrdre($donnees)
147
{
148
    $retour = '';
149
    $selected_sup = '';
150
    $selected_ega = '';
151
    $selected_inf = '';
152
    $selected = 'selected="selected"';
153
    switch ($donnees['od']) {
154
        case 'sup':
155
            $selected_sup = $selected;
156
            break;
157
        case 'ega':
158
            $selected_ega = $selected;
159
            break;
160
        case 'inf':
161
            $selected_inf = $selected;
162
            break;
166 jpm 163
        default:
164
            $selected_ega = $selected;
165
            break;
123 jpm 166
    }
167
    $retour .= '<option value="sup" '.$selected_sup.'>'.'Supérieur'.'</option>'."\n";
168
    $retour .= '<option value="ega" '.$selected_ega.'>'.'Égal'.'</option>'."\n";
169
    $retour .= '<option value="inf" '.$selected_inf.'>'.'Inférieur'.'</option>'."\n";
170
    return $retour;
171
}
172
 
173
function afficherRang($donnees)
174
{
175
    $retour = '';
176
    $selected_120 = '';
177
    $selected_160 = '';
178
    $selected_250 = '';
179
    $selected_280 = '';
180
    $selected = 'selected="selected"';
181
    switch ($donnees['rg']) {
182
        case 120:
183
            $selected_120 = $selected;
184
            break;
185
        case 160:
186
            $selected_160 = $selected;
187
            break;
188
        case 250:
189
            $selected_250 = $selected;
190
            break;
191
        case 280:
192
            $selected_280 = $selected;
193
            break;
194
    }
195
    $retour .= '<option value="120" '.$selected_120.'>'.'Famille'.'</option>'."\n";
196
    $retour .= '<option value="160" '.$selected_160.'>'.'Genre'.'</option>'."\n";
197
    $retour .= '<option value="250" '.$selected_250.'>'.'Espèce'.'</option>'."\n";
198
    $retour .= '<option value="280" '.$selected_280.'>'.'Sous-Espèce'.'</option>'."\n";
199
    return $retour;
200
}
201
 
202
// +------------------------------------------------------------------------------------------------------+
203
// |                                            PIED du PROGRAMME                                         |
204
// +------------------------------------------------------------------------------------------------------+
205
 
206
 
207
/* +--Fin du code ----------------------------------------------------------------------------------------+
208
*
209
* $Log: not supported by cvs2svn $
179 ddelon 210
* Revision 1.8  2005/06/30 15:25:07  jpm
211
* Début des modifications pour ajout de l'arborescence de la classif.
212
*
173 jpm 213
* Revision 1.7  2005/06/09 18:09:52  jpm
214
* Début gestion des référenciels dans la recherche nomenclaturale.
215
*
170 jpm 216
* Revision 1.6  2005/03/15 15:11:07  jpm
217
* Ajout d'une sélection par défaut pour le choix de l'ordre.
218
*
166 jpm 219
* Revision 1.5  2005/03/15 14:45:59  tam
220
* modifs labels
221
*
163 tam 222
* Revision 1.2  2005/02/09 13:06:52  jpm
223
* Modification pour utiliser le macro-élément PROJET_VERSION_TOUS.
224
*
136 jpm 225
* Revision 1.1  2005/01/28 19:45:44  jpm
226
* Début recheche taxons.
227
*
123 jpm 228
* Revision 1.1  2005/01/26 10:45:33  jpm
229
* Ajout des résultats de recherche par noms vernaculaires.
230
*
231
*
232
* +-- Fin du code ----------------------------------------------------------------------------------------+
233
*/
234
?>