Subversion Repositories eFlore/Archives.eflore-consultation-v2

Rev

Rev 127 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 127 Rev 150
1
<?php
1
<?php
2
/*vim: set expandtab tabstop=4 shiftwidth=4: */ 
2
/*vim: set expandtab tabstop=4 shiftwidth=4: */ 
3
// +------------------------------------------------------------------------------------------------------+
3
// +------------------------------------------------------------------------------------------------------+
4
// | PHP version 4.3                                                                                      |
4
// | PHP version 4.3                                                                                      |
5
// +------------------------------------------------------------------------------------------------------+
5
// +------------------------------------------------------------------------------------------------------+
6
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org)                                         |
6
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org)                                         |
7
// +------------------------------------------------------------------------------------------------------+
7
// +------------------------------------------------------------------------------------------------------+
8
// | This file is part of eFlore-consultation.                                                            |
8
// | This file is part of eFlore-consultation.                                                            |
9
// |                                                                                                      |
9
// |                                                                                                      |
10
// | Foobar is free software; you can redistribute it and/or modify                                       |
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                                 |
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                                    |
12
// | the Free Software Foundation; either version 2 of the License, or                                    |
13
// | (at your option) any later version.                                                                  |
13
// | (at your option) any later version.                                                                  |
14
// |                                                                                                      |
14
// |                                                                                                      |
15
// | Foobar is distributed in the hope that it will be useful,                                            |
15
// | Foobar is distributed in the hope that it will be useful,                                            |
16
// | but WITHOUT ANY WARRANTY; without even the implied warranty of                                       |
16
// | but WITHOUT ANY WARRANTY; without even the implied warranty of                                       |
17
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the                                        |
17
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the                                        |
18
// | GNU General Public License for more details.                                                         |
18
// | GNU General Public License for more details.                                                         |
19
// |                                                                                                      |
19
// |                                                                                                      |
20
// | You should have received a copy of the GNU General Public License                                    |
20
// | You should have received a copy of the GNU General Public License                                    |
21
// | along with Foobar; if not, write to the Free Software                                                |
21
// | along with Foobar; if not, write to the Free Software                                                |
22
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                            |
22
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                            |
23
// +------------------------------------------------------------------------------------------------------+
23
// +------------------------------------------------------------------------------------------------------+
24
// CVS : $Id: eflore_recherche_taxonomie.inc.php,v 1.2 2005-01-28 19:47:55 jpm Exp $
24
// CVS : $Id: eflore_recherche_taxonomie.inc.php,v 1.3 2005-02-15 13:00:51 jpm Exp $
25
/**
25
/**
26
* Affichage du moteur de recherche taxonomique et de ses résultats.
26
* Affichage du moteur de recherche taxonomique et de ses résultats.
27
*
27
*
28
* Ce script fournit le code html correspondant aux moteurs de recherche taxonomique (par projet) et ses 
28
* Ce script fournit le code html correspondant aux moteurs de recherche taxonomique (par projet) et ses 
29
* résultats.
29
* résultats.
30
*
30
*
31
*@package eFlore
31
*@package eFlore
32
//Auteur original :
32
//Auteur original :
33
*@author        Jean-Pascal MILCENT <jpm@tela-botanica.org>
33
*@author        Jean-Pascal MILCENT <jpm@tela-botanica.org>
34
//Autres auteurs :
34
//Autres auteurs :
35
*@author        Aucun
35
*@author        Aucun
36
*@copyright     Tela-Botanica 2000-2004
36
*@copyright     Tela-Botanica 2000-2004
37
*@version       $Revision: 1.2 $ $Date: 2005-01-28 19:47:55 $
37
*@version       $Revision: 1.3 $ $Date: 2005-02-15 13:00:51 $
38
// +------------------------------------------------------------------------------------------------------+
38
// +------------------------------------------------------------------------------------------------------+
39
*/
39
*/
40
 
40
 
41
// +------------------------------------------------------------------------------------------------------+
41
// +------------------------------------------------------------------------------------------------------+
42
// |                                            ENTÊTE du PROGRAMME                                       |
42
// |                                            ENTÊTE du PROGRAMME                                       |
43
// +------------------------------------------------------------------------------------------------------+
43
// +------------------------------------------------------------------------------------------------------+
-
 
44
 
-
 
45
function ajouterArboressenceClassif($arguments) {
-
 
46
    if (isset($GLOBALS['_EFLORE_']['classif'][$arguments[0]])) {
-
 
47
        $retour = $GLOBALS['_EFLORE_']['classif'][$arguments[0]];
-
 
48
        return $retour;
-
 
49
    }
-
 
50
    return '';
-
 
51
}
-
 
52
 
-
 
53
function remplacerUrlClassif($arguments) {
-
 
54
    $GLOBALS['_EFLORE_']['url']->addQueryString(EFLORE_LG_URL_ACTION, EFLORE_LG_URL_ACTION_RECH_TAX);
-
 
55
    $GLOBALS['_EFLORE_']['url']->addQueryString(EFLORE_LG_URL_NT, $arguments[0]);
-
 
56
    $retour = $GLOBALS['_EFLORE_']['url']->getURL().'#eflore_taxon_'.$arguments[0];
-
 
57
    $GLOBALS['_EFLORE_']['url']->removeQueryString(EFLORE_LG_URL_ACTION);
-
 
58
    $GLOBALS['_EFLORE_']['url']->removeQueryString(EFLORE_LG_URL_NT);
-
 
59
    return $retour;
-
 
60
}
-
 
61
 
-
 
62
function remplacerInfoCommune(&$squelette) {
-
 
63
    $squelette->setCallbackFunction('ajouterArboressenceClassif', 'ajouterArboressenceClassif');
-
 
64
    $squelette->setCallbackFunction('remplacerUrlClassif', 'remplacerUrlClassif');
-
 
65
    $squelette->performCallback();
-
 
66
    $GLOBALS['_EFLORE_']['url']->addQueryString(EFLORE_LG_URL_ACTION, EFLORE_LG_URL_ACTION_FICHE);
-
 
67
    $GLOBALS['_EFLORE_']['url']->addQueryString(EFLORE_LG_URL_ONGLET, EFLORE_LG_URL_ONGLET_SYNTHESE);
-
 
68
    $GLOBALS['_EFLORE_']['url']->addQueryString(EFLORE_LG_URL_NVP, $_REQUEST['eflore_projet']);
-
 
69
    $GLOBALS['_EFLORE_']['url']->addQueryString(EFLORE_LG_URL_NN, '');
-
 
70
    $squelette->setVariable('UrlFicheNom', $GLOBALS['_EFLORE_']['url']->getURL());
-
 
71
    $GLOBALS['_EFLORE_']['url']->removeQueryString(EFLORE_LG_URL_ACTION);
-
 
72
    $GLOBALS['_EFLORE_']['url']->removeQueryString(EFLORE_LG_URL_ONGLET);
-
 
73
    $GLOBALS['_EFLORE_']['url']->removeQueryString(EFLORE_LG_URL_NVP);
-
 
74
    $GLOBALS['_EFLORE_']['url']->removeQueryString(EFLORE_LG_URL_NN);
-
 
75
    return $squelette;
44
 
76
}
45
 
77
 
46
// +------------------------------------------------------------------------------------------------------+
78
// +------------------------------------------------------------------------------------------------------+
47
// |                                            CORPS du PROGRAMME                                        |
79
// |                                            CORPS du PROGRAMME                                        |
48
// +------------------------------------------------------------------------------------------------------+
80
// +------------------------------------------------------------------------------------------------------+
49
// Recherche sur les noms scientifiques
81
// Recherche sur les noms scientifiques
-
 
82
//$GLOBALS['_DEBOGAGE_'] .= '<pre>'.print_r($GLOBALS, true).'</pre>';
50
if (isset($_REQUEST['eflore_projet']) AND isset($_REQUEST['eflore_rang']) AND isset($_REQUEST['eflore_ordre'])) {
83
if (isset($_REQUEST['eflore_projet']) AND isset($_REQUEST['eflore_rang']) AND isset($_REQUEST['eflore_ordre'])) {
51
    if (!isset($_REQUEST['eflore_lettre'])) {
84
    if (!isset($_REQUEST['eflore_lettre'])) {
52
        $_REQUEST['eflore_lettre'] = 'A';
85
        $_REQUEST['eflore_lettre'] = 'A';
53
    }
86
    }
54
    $url = sprintf(EFLORE_URL_FORM_TAXON_ALPHABET, rawurlencode($_REQUEST['eflore_projet']), rawurlencode($_REQUEST['eflore_rang']), rawurlencode($_REQUEST['eflore_ordre']), rawurlencode($_REQUEST['eflore_lettre']));
87
    $url = sprintf(EFLORE_URL_FORM_TAXON_ALPHABET, rawurlencode($_REQUEST['eflore_projet']), rawurlencode($_REQUEST['eflore_rang']), rawurlencode($_REQUEST['eflore_ordre']), rawurlencode($_REQUEST['eflore_lettre']));
-
 
88
    $_SESSION['eflore_projet'] = $_REQUEST['eflore_projet'];
-
 
89
    $_SESSION['eflore_rang'] = $_REQUEST['eflore_rang'];
-
 
90
    $_SESSION['eflore_ordre'] = $_REQUEST['eflore_ordre'];
-
 
91
    $_SESSION['eflore_lettre'] = $_REQUEST['eflore_lettre'];
-
 
92
    $_SESSION['eflore_classif'] = array();
-
 
93
    $_SESSION['eflore_classif_chemin'] = '';
-
 
94
} else if (isset($_REQUEST[EFLORE_LG_URL_NT])) {
-
 
95
    $_REQUEST['eflore_projet'] = $_SESSION['eflore_projet'];
-
 
96
    $_REQUEST['eflore_rang'] = $_SESSION['eflore_rang'];
-
 
97
    $_REQUEST['eflore_ordre'] = $_SESSION['eflore_ordre'];
-
 
98
    $_REQUEST['eflore_lettre'] = $_SESSION['eflore_lettre'];
-
 
99
    $url = sprintf(EFLORE_URL_FORM_TAXON_ALPHABET, rawurlencode($_REQUEST['eflore_projet']), rawurlencode($_REQUEST['eflore_rang']), rawurlencode($_REQUEST['eflore_ordre']), rawurlencode($_REQUEST['eflore_lettre']));
55
} else {
100
} else {
56
    $url = EFLORE_URL_FORM_TAXON;
101
    $url = EFLORE_URL_FORM_TAXON;
57
}
102
}
-
 
103
 
58
$contenu = file_get_contents($url);
104
$contenu = file_get_contents($url);
59
 
105
 
60
//Analyse du squelette
106
//Analyse du squelette
61
require_once 'HTML/Template/IT.php';
107
require_once 'HTML/Template/IT.php';
62
$squelette = new HTML_Template_IT();
108
$squelette = new HTML_Template_IT();
63
$squelette->setTemplate($contenu, FALSE, FALSE);
109
$squelette->setTemplate($contenu, FALSE, FALSE);
64
 
110
 
65
// Indique l'url pour obtenir fiche d'un nom
111
// Indique l'url pour obtenir fiche d'un nom
66
$squelette->setCurrentBlock('corps');
112
$squelette->setCurrentBlock('corps');
67
// Ajout du paramêtre action à l'url courante.
113
// Ajout du paramêtre action à l'url courante.
68
$GLOBALS['_EFLORE_']['url']->addQueryString(EFLORE_LG_URL_ACTION, EFLORE_LG_URL_ACTION_RECH_TAX);
114
$GLOBALS['_EFLORE_']['url']->addQueryString(EFLORE_LG_URL_ACTION, EFLORE_LG_URL_ACTION_RECH_TAX);
69
$squelette->setVariable('UrlProjetTaxon', $GLOBALS['_EFLORE_']['url']->getURL());
115
$squelette->setVariable('UrlProjetTaxon', $GLOBALS['_EFLORE_']['url']->getURL());
70
$GLOBALS['_EFLORE_']['url']->removeQueryString(EFLORE_LG_URL_ACTION);
116
$GLOBALS['_EFLORE_']['url']->removeQueryString(EFLORE_LG_URL_ACTION);
71
$squelette->parseCurrentBlock('corps');
117
$squelette->parseCurrentBlock('corps');
72
 
118
 
73
// Récupère le bloc "corps"
119
// Récupère le bloc "corps"
74
$sortie .= $squelette->get('corps');
120
$sortie .= $squelette->get('corps');
75
 
121
 
76
// --------------------------------------------------------------------------------------------------------
122
// --------------------------------------------------------------------------------------------------------
77
// Lancement de la recherche
123
// Lancement de la recherche
78
if (isset($_REQUEST['eflore_lettre'])) {
124
if (isset($_REQUEST['eflore_lettre'])) {
-
 
125
    //Constitution du chemin de navigation dans la classification
-
 
126
    if (isset($_REQUEST[EFLORE_LG_URL_NT])) {
-
 
127
        if (!isset($_SESSION['eflore_classif'][$_REQUEST[EFLORE_LG_URL_NT]])) {
-
 
128
            $_SESSION['eflore_classif_chemin'] .= $_REQUEST[EFLORE_LG_URL_NT].'>';
-
 
129
            $_SESSION['eflore_classif'][$_REQUEST[EFLORE_LG_URL_NT]] = $_REQUEST['eflore_projet'];
-
 
130
        }
-
 
131
    }
-
 
132
    if (!empty($_SESSION['eflore_classif_chemin'])) {
-
 
133
        $GLOBALS['_DEBOGAGE_'] .= $_SESSION['eflore_classif_chemin'].'<br/>';
-
 
134
        $tab_classif_chemin = array_reverse(explode('>', substr($_SESSION['eflore_classif_chemin'], 0, -1)));
-
 
135
        
-
 
136
        $GLOBALS['_EFLORE_']['classif'] = array();
-
 
137
        $GLOBALS['_DEBOGAGE_'] .= $tab_classif_chemin[0].'<br />';
-
 
138
        for ($i = 0; $i < count($tab_classif_chemin); $i++) {
-
 
139
            $url = sprintf(EFLORE_URL_LISTE_CLASSIF, rawurlencode($_SESSION['eflore_classif'][$tab_classif_chemin[$i]]), rawurlencode($tab_classif_chemin[$i]));
-
 
140
            $GLOBALS['_DEBOGAGE_'] .= $url.'<br />';
-
 
141
            $contenu = file_get_contents($url);
-
 
142
            //Analyse du squelette
-
 
143
            require_once 'HTML/Template/ITX.php';
-
 
144
            $squelette = new HTML_Template_ITX();
-
 
145
            $squelette->setTemplate($contenu, FALSE, FALSE);
-
 
146
            $squelette->setCurrentBlock('liste');
-
 
147
            $squelette =& remplacerInfoCommune($squelette);
-
 
148
            $squelette->parseCurrentBlock('liste');
-
 
149
            $GLOBALS['_EFLORE_']['classif'][$tab_classif_chemin[$i]] = $squelette->get('liste');
-
 
150
        }
-
 
151
    }
-
 
152
    
79
    // Recherche sur les noms scientifiques
153
    // Recherche sur les taxons
80
    $url = sprintf(EFLORE_URL_LISTE_TAXON, rawurlencode($_REQUEST['eflore_projet']), rawurlencode($_REQUEST['eflore_rang']), rawurlencode($_REQUEST['eflore_ordre']), rawurlencode($_REQUEST['eflore_lettre']));
154
    $url = sprintf(EFLORE_URL_LISTE_TAXON, rawurlencode($_REQUEST['eflore_projet']), rawurlencode($_REQUEST['eflore_rang']), rawurlencode($_REQUEST['eflore_ordre']), rawurlencode($_REQUEST['eflore_lettre']));
81
    $contenu = file_get_contents($url);
155
    $contenu = file_get_contents($url);
82
    
156
    
83
    //Analyse du squelette
157
    //Analyse du squelette
84
    require_once 'HTML/Template/IT.php';
158
    require_once 'HTML/Template/ITX.php';
85
    $squelette = new HTML_Template_IT();
159
    $squelette = new HTML_Template_ITX();
86
    $squelette->setTemplate($contenu, FALSE, FALSE);
160
    $squelette->setTemplate($contenu, FALSE, FALSE);
87
    
161
    
88
    // Indique l'url pour obtenir fiche d'un nom
162
    // Analyse du corps de la recherche
89
    $squelette->setCurrentBlock('corps');
163
    $squelette->setCurrentBlock('corps');
90
    // Ajout du paramêtre action à l'url courante.
-
 
91
    $GLOBALS['_EFLORE_']['url']->addQueryString(EFLORE_LG_URL_ACTION, EFLORE_LG_URL_ACTION_FICHE);
-
 
92
    $GLOBALS['_EFLORE_']['url']->addQueryString(EFLORE_LG_URL_ONGLET, EFLORE_LG_URL_ONGLET_SYNTHESE);
-
 
93
    $GLOBALS['_EFLORE_']['url']->addQueryString(EFLORE_LG_URL_NN, '');
-
 
94
    $squelette->setVariable('UrlFicheNom', $GLOBALS['_EFLORE_']['url']->getURL());
-
 
95
    $GLOBALS['_EFLORE_']['url']->removeQueryString(EFLORE_LG_URL_NN);
164
    $squelette =& remplacerInfoCommune($squelette);
96
    $GLOBALS['_EFLORE_']['url']->addQueryString(EFLORE_LG_URL_NVP, $_REQUEST['eflore_projet']);
165
    $GLOBALS['_EFLORE_']['url']->addQueryString(EFLORE_LG_URL_NVP, $_REQUEST['eflore_projet']);
97
    $GLOBALS['_EFLORE_']['url']->addQueryString(EFLORE_LG_URL_RG, $_REQUEST['eflore_rang']);
166
    $GLOBALS['_EFLORE_']['url']->addQueryString(EFLORE_LG_URL_RG, $_REQUEST['eflore_rang']);
98
    $GLOBALS['_EFLORE_']['url']->addQueryString(EFLORE_LG_URL_OD, $_REQUEST['eflore_ordre']);
167
    $GLOBALS['_EFLORE_']['url']->addQueryString(EFLORE_LG_URL_OD, $_REQUEST['eflore_ordre']);
99
    $GLOBALS['_EFLORE_']['url']->addQueryString(EFLORE_LG_URL_LE, '');
168
    $GLOBALS['_EFLORE_']['url']->addQueryString(EFLORE_LG_URL_LE, '');
100
    $squelette->setVariable('UrlRechercheTaxonAlphabet', $GLOBALS['_EFLORE_']['url']->getURL());
169
    $squelette->setVariable('UrlRechercheTaxonAlphabet', $GLOBALS['_EFLORE_']['url']->getURL());
101
    $squelette->parseCurrentBlock('corps');
170
    $squelette->parseCurrentBlock('corps');
102
    
171
    
103
    // Récupère le bloc "corps"
172
    // Récupère le bloc "corps"
104
    $sortie .= $squelette->get('corps');
173
    $sortie .= $squelette->get('corps');
105
}
174
}
106
 
175
 
107
/* +--Fin du code ----------------------------------------------------------------------------------------+
176
/* +--Fin du code ----------------------------------------------------------------------------------------+
108
*
177
*
109
* $Log: not supported by cvs2svn $
178
* $Log: not supported by cvs2svn $
-
 
179
* Revision 1.2  2005/01/28 19:47:55  jpm
-
 
180
* Ajout de la recherche pour les taxons.
-
 
181
*
110
* Revision 1.1  2004/12/23 20:05:17  jpm
182
* Revision 1.1  2004/12/23 20:05:17  jpm
111
* Début prise en maine eflore-consultation.
183
* Début prise en maine eflore-consultation.
112
*
184
*
113
*
185
*
114
* +-- Fin du code ----------------------------------------------------------------------------------------+
186
* +-- Fin du code ----------------------------------------------------------------------------------------+
115
*/
187
*/
116
?>
188
?>