Subversion Repositories eFlore/Archives.eflore-consultation-v2

Rev

Rev 127 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 127 Rev 150
Line 19... Line 19...
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.
Line 32... Line 32...
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
*/
Line 40... Line 40...
40
 
40
 
41
// +------------------------------------------------------------------------------------------------------+
41
// +------------------------------------------------------------------------------------------------------+
42
// |                                            ENTÊTE du PROGRAMME                                       |
42
// |                                            ENTÊTE du PROGRAMME                                       |
Line -... Line 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);
Line 43... Line 75...
43
// +------------------------------------------------------------------------------------------------------+
75
    return $squelette;
44
 
76
}
45
 
77
 
46
// +------------------------------------------------------------------------------------------------------+
78
// +------------------------------------------------------------------------------------------------------+
-
 
79
// |                                            CORPS du PROGRAMME                                        |
47
// |                                            CORPS du PROGRAMME                                        |
80
// +------------------------------------------------------------------------------------------------------+
48
// +------------------------------------------------------------------------------------------------------+
81
// Recherche sur les noms scientifiques
49
// 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'])) {
-
 
85
        $_REQUEST['eflore_lettre'] = 'A';
-
 
86
    }
-
 
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'];
52
        $_REQUEST['eflore_lettre'] = 'A';
97
    $_REQUEST['eflore_ordre'] = $_SESSION['eflore_ordre'];
53
    }
98
    $_REQUEST['eflore_lettre'] = $_SESSION['eflore_lettre'];
54
    $url = sprintf(EFLORE_URL_FORM_TAXON_ALPHABET, rawurlencode($_REQUEST['eflore_projet']), rawurlencode($_REQUEST['eflore_rang']), rawurlencode($_REQUEST['eflore_ordre']), rawurlencode($_REQUEST['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']));
-
 
100
} else {
55
} else {
101
    $url = EFLORE_URL_FORM_TAXON;
Line 56... Line 102...
56
    $url = EFLORE_URL_FORM_TAXON;
102
}
57
}
103
 
58
$contenu = file_get_contents($url);
104
$contenu = file_get_contents($url);
Line 74... Line 120...
74
$sortie .= $squelette->get('corps');
120
$sortie .= $squelette->get('corps');
Line 75... Line 121...
75
 
121
 
76
// --------------------------------------------------------------------------------------------------------
122
// --------------------------------------------------------------------------------------------------------
77
// Lancement de la recherche
123
// Lancement de la recherche
-
 
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
    }
78
if (isset($_REQUEST['eflore_lettre'])) {
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']));
Line 81... Line 155...
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';
Line 85... Line 159...
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
-
 
89
    $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, '');
162
    // Analyse du corps de la recherche
94
    $squelette->setVariable('UrlFicheNom', $GLOBALS['_EFLORE_']['url']->getURL());
163
    $squelette->setCurrentBlock('corps');
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']);
Line 105... Line 174...
105
}
174
}
Line 106... Line 175...
106
 
175
 
107
/* +--Fin du code ----------------------------------------------------------------------------------------+
176
/* +--Fin du code ----------------------------------------------------------------------------------------+
108
*
177
*
-
 
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.
109
* $Log: not supported by cvs2svn $
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
*