Subversion Repositories eFlore/Archives.eflore-consultation-v2

Rev

Rev 78 | Rev 107 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
64 jpm 1
<?php
86 jpm 2
/*vim: set expandtab tabstop=4 shiftwidth=4: */
3
// +------------------------------------------------------------------------------------------------------+
4
// | PHP version 4.1                                                                                      |
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
// +------------------------------------------------------------------------------------------------------+
24
// CVS : $Id: fiche_synthese_xhtml.php,v 1.3 2005-01-19 12:58:19 jpm Exp $
25
/**
26
* Vue affichant la fiche de synthèse d'un nom dans le projet donné
27
*
28
* Permet de retourner le html correspondant à la fiche de synthèse d'un nom
29
* dans un projet donné.
30
*
31
*@package eFlore
32
*@subpackage Vues
33
//Auteur original :
34
*@author        Frédéric LEGNES <flegens@free.fr>
35
//Autres auteurs :
36
*@author        Jean-Pascal MILCENT <jpm@tela-botanica.org>
37
*@copyright     Tela-Botanica 2000-2004
38
*@version       $Revision: 1.3 $ $Date: 2005-01-19 12:58:19 $
39
// +------------------------------------------------------------------------------------------------------+
40
*/
64 jpm 41
 
86 jpm 42
// +------------------------------------------------------------------------------------------------------+
43
// |                                            ENTETE du PROGRAMME                                       |
44
// +------------------------------------------------------------------------------------------------------+
45
require_once EFSE_CHEMIN_FONCTION.'eribo_encodage.fonct.php';
46
 
47
// +------------------------------------------------------------------------------------------------------+
48
// |                                            CLASSE de la VUE                                          |
49
// +------------------------------------------------------------------------------------------------------+
50
class fiche_synthese_xhtml implements iVue {
51
 
52
    protected $leBlock;
53
 
54
    function __construct($unBlock)
55
    {
56
        $this->leBlock = $unBlock;
57
    }
58
 
59
    function serialiser()
60
    {
61
        // La page xhtml :
62
        $retour = '<?xml version="1.0" encoding="iso-8859-15" ?>'."\n";
63
        $retour .= '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "../../../commun/generique/dtd/xhtml1-strict.dtd">'."\n";
64
        $retour .= '<html xmlns="http://www.w3.org/1999/xhtml" lang="fr" >'."\n";
65
 
66
        $retour .= '<head>'."\n";
67
        $retour .= '<!-- BEGIN entete -->'."\n";
68
        $retour .= '<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-15" />'."\n";
69
        $retour .= '<meta http-equiv="Content-style-type" content="text/css" />'."\n";
70
        $retour .= '<meta http-equiv="Content-script-type" content="text/javascript" />'."\n";
71
        $retour .= '<meta http-equiv="Content-language" content="fr" />'."\n";
72
        $retour .= '<title>Synthèse d\'un nom latin</title>'."\n";
73
        $retour .= '<!-- END entete -->'."\n";
74
        $retour .= '</head>'."\n";
75
 
76
        $retour .= '<body>'."\n";
77
        $retour .= '<!-- BEGIN corps -->'."\n";
78
        $retour .= '<h1>'.'Synthèse d\'un nom latin'.'</h1>'."\n";
79
        $retour .= '<h2>'.'Informations sur le nom :'.'</h2>'."\n";
80
        $retour .= '<p>'."\n";
81
        $retour .= $this->leBlock->afficherPattern('FICHE_SYNTHESE>NOM_LATIN','afficherNomInfos');
82
        $retour .= '</p>'."\n";
83
        $retour .= '<h2>'.'Présent dans : '.'</h2>'."\n";
84
        $retour .= '<form id="eflore_form_projet" action="http://eflore-test.tela-botanica.org/serveurXML/eflore_serveur.php" method="get">'."\n";//{UrlProjetChangement}
85
        $retour .= '<p>'."\n";
86
        $retour .= $this->leBlock->afficherPattern('FICHE_SYNTHESE>NOM_LATIN','afficherChampNom');
87
        $retour .= '<select id="nvp" name="nvp">'."\n";
88
        $retour .= $this->leBlock->afficherPattern('FICHE_SYNTHESE>NOM_SELECTION','afficherListeProjets');
89
        $retour .= '</select>'."\n";
90
        $retour .= '<input type="submit" value="ok" />'."\n";
91
        $retour .= '</p>'."\n";
92
        $retour .= '</form>'."\n";
93
 
94
        // Gestion du nom correct
95
        $retour .= $this->leBlock->afficherPattern('FICHE_SYNTHESE>PROJET_VERSION','afficherNomProjetVersion');
96
        $aso_param['statut_id'] = 3;
97
        $retour .= $this->leBlock->afficherPattern('FICHE_SYNTHESE>TAXON_NOMS','afficherNomCorrect', TRUE, $aso_param);
98
 
99
        // Gestion de la recherche Google
100
        $retour .= '<h2>'.'Rechercher des illustrations avec Google : '.'</h2>'."\n";
101
        $aso_param['statut_id'] = 3;
102
        $retour .= $this->leBlock->afficherPattern('FICHE_SYNTHESE>TAXON_NOMS','afficherRechercheGoogle', TRUE, $aso_param);
103
 
104
        // Gestion de la synonymie
105
        $retour .= '<h2>'.'Synonymie : '.'</h2>'."\n";
106
 
107
        // Gestion des noms dont le statut n'est pas renseigné
108
        $aso_param['statut_id'] = 0;
109
        $retour_syno = $this->leBlock->afficherPattern('FICHE_SYNTHESE>TAXON_NOMS','afficherSynonyme', TRUE, $aso_param);
110
        if (!empty($retour_syno)) {
111
            $synonymie = '<h3>'.'Statut non renseigné : '.'</h3>'."\n";
112
            $synonymie .= '<ol>'."\n";
113
            $synonymie .= $retour_syno;
114
            $synonymie .= '</ol>'."\n";
115
            $retour .= $synonymie;
116
        }
117
 
118
        // Gestion des noms dont le statut est inconnu
119
        $aso_param['statut_id'] = 1;
120
        $retour_syno = $this->leBlock->afficherPattern('FICHE_SYNTHESE>TAXON_NOMS','afficherSynonyme', TRUE, $aso_param);
121
        if (!empty($retour_syno)) {
122
            $synonymie = '<h3>'.'Statut inconnu : '.'</h3>'."\n";
123
            $synonymie .= '<ol>'."\n";
124
            $synonymie .= $retour_syno;
125
            $synonymie .= '</ol>'."\n";
126
            $retour .= $synonymie;
127
        }
128
 
129
        // Gestion des noms dont le statut pose problème
130
        $aso_param['statut_id'] = 2;
131
        $retour_syno = $this->leBlock->afficherPattern('FICHE_SYNTHESE>TAXON_NOMS','afficherSynonyme', TRUE, $aso_param);
132
        if (!empty($retour_syno)) {
133
            $synonymie = '<h3>'.'Statut posant problème : '.'</h3>'."\n";
134
            $synonymie .= '<ol>'."\n";
135
            $synonymie .= $retour_syno;
136
            $synonymie .= '</ol>'."\n";
137
            $retour .= $synonymie;
138
        }
139
        // Gestion des synonymes taxonomiques
140
        $aso_param['statut_id'] = 4;
141
        $retour_syno = $this->leBlock->afficherPattern('FICHE_SYNTHESE>TAXON_NOMS','afficherSynonyme', TRUE, $aso_param);
142
        if (!empty($retour_syno)) {
143
            $synonymie = '<h3>'.'Synonymes taxonomiques : '.'</h3>'."\n";
144
            $synonymie .= '<ol>'."\n";
145
            $synonymie .= $retour_syno;
146
            $synonymie .= '</ol>'."\n";
147
            $retour .= $synonymie;
148
        }
149
 
150
        // Gestion des synonymes nomenclaturaux
151
        $aso_param['statut_id'] = 5;
152
        $retour_syno = $this->leBlock->afficherPattern('FICHE_SYNTHESE>TAXON_NOMS','afficherSynonyme', TRUE, $aso_param);
153
        if (!empty($retour_syno)) {
154
            $synonymie = '<h3>'.'Synonymes nomenclaturaux : '.'</h3>'."\n";
155
            $synonymie .= '<ol>'."\n";
156
            $synonymie .= $retour_syno;
157
            $synonymie .= '</ol>'."\n";
158
            $retour .= $synonymie;
159
        }
160
 
161
        // Gestion des synonymes indéterminés
162
        $aso_param['statut_id'] = 6;
163
        $retour_syno = $this->leBlock->afficherPattern('FICHE_SYNTHESE>TAXON_NOMS','afficherSynonyme', TRUE, $aso_param);
164
        if (!empty($retour_syno)) {
165
            $synonymie = '<h3>'.'Synonymes indéterminés : '.'</h3>'."\n";
166
            $synonymie .= '<ol>'."\n";
167
            $synonymie .= $retour_syno;
168
            $synonymie .= '</ol>'."\n";
169
            $retour .= $synonymie;
170
        }
171
 
172
        // Gestion des synonymes "inclu dans"
173
        $aso_param['statut_id'] = 7;
174
        $retour_syno = $this->leBlock->afficherPattern('FICHE_SYNTHESE>TAXON_NOMS','afficherSynonyme', TRUE, $aso_param);
175
        if (!empty($retour_syno)) {
176
            $synonymie = '<h3>'.'Synonymes "inclu dans": '.'</h3>'."\n";
177
            $synonymie .= '<ol>'."\n";
178
            $synonymie .= $retour_syno;
179
            $synonymie .= '</ol>'."\n";
180
            $retour .= $synonymie;
181
        }
182
 
183
        // Gestion des synonymes au sens de
184
        $aso_param['statut_id'] = 8;
185
        $retour_syno = $this->leBlock->afficherPattern('FICHE_SYNTHESE>TAXON_NOMS','afficherSynonyme', TRUE, $aso_param);
186
        if (!empty($retour_syno)) {
187
            $synonymie = '<h3>'.'Synonymes "au sens de (<i>sensu</i>)": '.'</h3>'."\n";
188
            $synonymie .= '<ol>'."\n";
189
            $synonymie .= $retour_syno;
190
            $synonymie .= '</ol>'."\n";
191
            $retour .= $synonymie;
192
        }
193
 
194
        // Gestion des noms vernaculaires
195
        $retour .= '<h2>'.'Noms vernaculaires : '.'</h2>'."\n";
196
        $retour .= '<table id="tableau_nom_verna">'."\n";
197
        $retour .= '  <thead>'."\n";
198
        $retour .= '    <tr><th>'.'Langue'.'</th><th>'.'Pays'.'</th><th>'.'Nom'.'</th><th>'.'Emploi'.'</th><th>'.'Genre et nombre'.'</th></tr>'."\n";
199
        $retour .= '  </thead>'."\n";
200
        $retour .= '  <tbody>'."\n";
201
        $retour .= $this->leBlock->afficherPattern('FICHE_SYNTHESE>VERNACULAIRE_NOMS','afficherNomVernaculaire');
202
        $retour .= '  </tbody>'."\n";
203
        $retour .= '</table>'."\n";
204
 
205
        $retour .= '<!-- END corps -->'."\n";
206
 
207
        $retour .= '<!-- BEGIN pied -->'."\n";
208
        $retour .= '<p>'.'Si vous constatez des erreurs ou des insuffisances en consultant cet index, veuillez contacter :'."\n";
209
        $retour .= '  <a href="mailto:eflore_remarques@tela-botanica.org">l\'équipe d\'eFlore</a>'."\n";
210
        $retour .= '</p>'."\n";
211
        $retour .= '<p>'."\n";
212
        $retour .= '  <a href="http://jigsaw.w3.org/css-validator/check/referer">'."\n";
213
        $retour .= '    <img class="reference" src="/accueil/images/references/css.png" alt="CSS valide!" />'."\n";
214
        $retour .= '  </a>'."\n";
215
        $retour .= '  <a href="http://validator.w3.org/check?uri=referer">'."\n";
216
        $retour .= '    <img class="reference" src="/accueil/images/references/xhtml11.png" alt="XHTML 1.1 valide!" />'."\n";
217
        $retour .= '  </a>'."\n";
218
        $retour .= '  <a href="http://frenchmozilla.org">'."\n";
219
        $retour .= '    <img class="reference" src="/accueil/images/references/firefox.png" alt="Télécharger un très bon navigateur!" />'."\n";
220
        $retour .= '  </a>'."\n";
221
        $retour .= '</p>'."\n";
222
 
223
        $retour .= '<!-- END pied -->'."\n";
224
 
225
        $retour .= '</body>'."\n";
226
        $retour .= '</html>'."\n";
227
 
228
        // Envoi au navigateur après décodage de l'utf8
229
        echo remplaceEntiteHTLM($retour);
230
    }
231
}
232
 
233
// +------------------------------------------------------------------------------------------------------+
234
// |                                            LISTE des FONCTIONS                                       |
235
// +------------------------------------------------------------------------------------------------------+
236
function construireNomLatin($donnees, $bool_nom_court = FALSE)
64 jpm 237
{
78 jpm 238
// Constitution du nom:
64 jpm 239
    $nom = '';
86 jpm 240
 
64 jpm 241
    if (!empty($donnees['en_nom_supra_generique'])) {
242
        $nom .= $donnees['en_nom_supra_generique'];
243
    } else if (!empty($donnees['en_epithete_infra_generique'])){
244
        $nom .= $donnees['en_epithete_infra_generique'];
245
    } else {
246
        if (!empty($donnees['en_nom_genre'])) {
247
            $nom .= $donnees['en_nom_genre'];
248
        }
249
        if (!empty($donnees['en_epithete_espece'])) {
250
            $nom .= ' '.$donnees['en_epithete_espece'];
251
        }
252
        if (!empty($donnees['en_epithete_infra_specifique'])) {
253
            if (!empty($donnees['enrg_abreviation_rang'])) {
86 jpm 254
                $nom .= ' '.$donnees['enrg_abreviation_rang'].'';
64 jpm 255
            }
256
            $nom .= ' '.$donnees['en_epithete_infra_specifique'];
257
        }
258
    }
86 jpm 259
    if (!$bool_nom_court) {
260
        $auteur_basio = '';
261
        $auteur_modif = '';
262
        if (!empty($donnees['intitule_abrege_auteur_basio_ex']) && $donnees['en_ce_auteur_basio_ex'] != 0) {
263
            $auteur_basio .= $donnees['intitule_abrege_auteur_basio_ex'];
264
            if (!empty($donnees['intitule_abrege_auteur_basio'])) {
265
                $auteur_basio .= ' ex '.$donnees['intitule_abrege_auteur_basio'];
266
            }
267
        } else if (!empty($donnees['intitule_abrege_auteur_basio']) && $donnees['en_ce_auteur_basio'] != 0) {
268
 
269
            $auteur_basio .= $donnees['intitule_abrege_auteur_basio'];
64 jpm 270
        }
86 jpm 271
        if (!empty($donnees['intitule_abrege_auteur_modif_ex']) && $donnees['en_ce_auteur_modif_ex'] != 0) {
272
            $auteur_modif .= $donnees['intitule_abrege_auteur_modif_ex'];
273
            if (!empty($donnees['intitule_abrege_auteur_modif'])) {
274
                $auteur_modif .= ' ex '.$donnees['intitule_abrege_auteur_modif'];
275
            }
276
        } else if (!empty($donnees['intitule_abrege_auteur_modif']) && $donnees['en_ce_auteur_modif'] != 0) {
277
            $auteur_modif .= $donnees['intitule_abrege_auteur_modif'];
64 jpm 278
        }
86 jpm 279
        if (!empty($auteur_modif)) {
280
            $nom .= ' ('.$auteur_basio.') ex '.$auteur_modif;
281
        } else {
282
            $nom .= ' '.$auteur_basio;
283
        }
64 jpm 284
    }
285
 
78 jpm 286
    return $nom;
287
}
288
 
86 jpm 289
function afficherChampNom($donnees)
78 jpm 290
{
291
    $retour = '';
86 jpm 292
    $retour .= '<input type="hidden" id="nn" name="nn" value="'.$donnees['en_id_nom'].'" />'."\n";
293
    $retour .= '<input type="hidden" id="key" name="key" value="synthese" />'."\n";
294
    return $retour;
295
}
296
 
297
function afficherNomInfos($donnees)
298
{
299
    $retour = '';
78 jpm 300
    //$retour .= '<pre>'.print_r($donnees, true).'</pre>';
301
    //$retour .= '<br>';
302
    $retour .= 'Numéro nomenclatural absolu : '.$donnees['en_id_nom']."\n";
303
    $retour .= '<br />';
304
    $retour .= 'Nom sélectionné précédemment : '.construireNomLatin($donnees).'<br />'."\n";
64 jpm 305
    return $retour;
306
}
307
 
86 jpm 308
function afficherNomProjetVersion($donnees)
78 jpm 309
{
310
    $retour = '';
86 jpm 311
    $retour .= '<h2>'.'Nom correct dans le projet : '.$donnees['eprv_nom'].'</h2>'."\n";
78 jpm 312
    return $retour;
313
}
314
 
86 jpm 315
function afficherListeProjets($donnees)
78 jpm 316
{
317
    $retour = '';
86 jpm 318
    if ($donnees['nvp'] == $donnees['eprv_id_version']) {
319
        $retour .= '  <option value="'.$donnees['eprv_id_version'].'" checked="checked">'.$donnees['eprv_nom'].' - '.$donnees['epr_intitule_projet'].'</option>'."\n";
320
    } else {
321
        $retour .= '  <option value="'.$donnees['eprv_id_version'].'">'.$donnees['eprv_nom'].' - '.$donnees['epr_intitule_projet'].'</option>'."\n";
322
    }
78 jpm 323
    return $retour;
324
}
325
 
86 jpm 326
function afficherNomCorrect($donnees, $aso_param)
327
{
328
    $retour = '';
329
    //$retour .= '<pre>'.print_r($aso_param, true).'</pre>';
330
    if ($donnees['TAXON_NOMS']['esns_id_statut'] == $aso_param['statut_id']) {
331
        $retour .= '<p><strong>'.$donnees['TAXON_NOMS']['NOM_LATIN']['eni_intitule_nom'].'</strong></p>'."\n";
332
    }
333
    return $retour;
334
}
78 jpm 335
 
86 jpm 336
function afficherRechercheGoogle($donnees, $aso_param)
337
{
338
    $retour = '';
339
    //$retour .= '<pre>'.print_r($aso_param, true).'</pre>';
340
    if ($donnees['TAXON_NOMS']['esns_id_statut'] == $aso_param['statut_id']) {
341
        $retour .= '<form method="get" action="http://images.google.fr/images">'."\n";
342
        $retour .= '<p>'."\n";
343
        $retour .= '<a href="http://www.google.com/" title="Aller sur Google France">'."\n";
344
        $retour .= '    <img src="http://www.google.com/logos/Logo_25wht.gif" alt="Google" />'."\n";
345
        $retour .= '</a>'."\n";
346
        $retour .= '<input type="text" name="q" size="25" maxlength="255" value="'.construireNomLatin($donnees['TAXON_NOMS']['NOM_LATIN'], TRUE).'" />'."\n";
347
        $retour .= '<input type="hidden" name="ie" value="ISO-8859-1" />'."\n";
348
        $retour .= '<input type="hidden" name="oe" value="ISO-8859-1" />'."\n";
349
        $retour .= '<input type="hidden" name="hl" value="fr" />'."\n";
350
        $retour .= '<input type="submit" name="btnG" value="Recherche Google" />'."\n";
351
        $retour .= '</p>'."\n";
352
        $retour .= '</form>'."\n";
64 jpm 353
    }
86 jpm 354
    return $retour;
355
}
356
 
357
function afficherSynonyme($donnees, $aso_param)
358
{
359
    $retour = '';
360
    //$retour .= '<pre>'.print_r($aso_param, true).'</pre>';
361
    if ($donnees['TAXON_NOMS']['esns_id_statut'] == $aso_param['statut_id']) {
362
        $retour .= '  <li>'.$donnees['TAXON_NOMS']['NOM_LATIN']['eni_intitule_nom'].'</li>'."\n";
64 jpm 363
    }
86 jpm 364
    return $retour;
64 jpm 365
}
86 jpm 366
 
367
function afficherNomVernaculaire($donnees)
368
{
369
    $retour = '';
370
    $retour .= '    <tr>';
371
    $retour .= '<td title="'.$donnees['el_nom_langue_principal'].'">'.$donnees['el_code_langue'].'</td>';
372
    $retour .= '<td title="'.$donnees['ezg_intitule_principal_zg'].'">'.$donnees['ezg_code_zg'].'</td>';
373
    if ($donnees['evce_id_emploi'] == 0) {// Non renseigné
374
        $retour .= '<td>'.$donnees['ev_intitule_nom_vernaculaire'].'</td>';
375
        $retour .= '<td>&nbsp;</td>';
376
    } else if ($donnees['evce_id_emploi'] == 3) {// Recommandé ou typique
377
        $retour .= '<td><strong>'.$donnees['ev_intitule_nom_vernaculaire'].'</strong></td>';
378
        $retour .= '<td><strong>'.$donnees['evce_intitule_conseil_emlploi'].'</strong></td>';
379
    } else if ($donnees['evce_id_emploi'] == 2) {// Secondaire ou régional
380
        $retour .= '<td><emphasis>'.$donnees['ev_intitule_nom_vernaculaire'].'</emphasis></td>';
381
        $retour .= '<td><emphasis>'.$donnees['evce_intitule_conseil_emlploi'].'</emphasis></td>';
382
    } else {
383
        $retour .= '<td>'.$donnees['ev_intitule_nom_vernaculaire'].'</td>';
384
        $retour .= '<td>'.$donnees['evce_intitule_conseil_emlploi'].'</td>';
385
    }
386
    if ($donnees['egn_id_genre_nombre'] == 0) {
387
        $retour .= '<td>&nbsp;</td>';
388
    } else {
389
        $retour .= '<td>'.$donnees['egn_intitule'].'</td>';
390
    }
391
    $retour .= '</tr>'."\n";
392
    return $retour;
393
}
394
 
395
// +------------------------------------------------------------------------------------------------------+
396
// |                                            PIED du PROGRAMME                                         |
397
// +------------------------------------------------------------------------------------------------------+
398
 
399
 
400
 
401
/* +--Fin du code ----------------------------------------------------------------------------------------+
402
*
403
* $Log: not supported by cvs2svn $
404
*
405
* +-- Fin du code ----------------------------------------------------------------------------------------+
406
*/
64 jpm 407
?>