Rev 150 | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
59 | jpm | 1 | <?php |
2 | /*vim: set expandtab tabstop=4 shiftwidth=4: */ |
||
3 | // +------------------------------------------------------------------------------------------------------+ |
||
4 | // | PHP version 4.3 | |
||
5 | // +------------------------------------------------------------------------------------------------------+ |
||
6 | // | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) | |
||
7 | // +------------------------------------------------------------------------------------------------------+ |
||
8 | // | This file is part of eFlore-consultation. | |
||
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 | // +------------------------------------------------------------------------------------------------------+ |
||
173 | jpm | 24 | // CVS : $Id: eflore_recherche_taxonomie.inc.php,v 1.4 2005-06-30 15:24:26 jpm Exp $ |
59 | jpm | 25 | /** |
26 | * Affichage du moteur de recherche taxonomique et de ses résultats. |
||
27 | * |
||
28 | * Ce script fournit le code html correspondant aux moteurs de recherche taxonomique (par projet) et ses |
||
29 | * résultats. |
||
30 | * |
||
31 | *@package eFlore |
||
32 | //Auteur original : |
||
33 | *@author Jean-Pascal MILCENT <jpm@tela-botanica.org> |
||
34 | //Autres auteurs : |
||
35 | *@author Aucun |
||
36 | *@copyright Tela-Botanica 2000-2004 |
||
173 | jpm | 37 | *@version $Revision: 1.4 $ $Date: 2005-06-30 15:24:26 $ |
59 | jpm | 38 | // +------------------------------------------------------------------------------------------------------+ |
39 | */ |
||
40 | |||
41 | // +------------------------------------------------------------------------------------------------------+ |
||
42 | // | ENTÊTE du PROGRAMME | |
||
43 | // +------------------------------------------------------------------------------------------------------+ |
||
44 | |||
150 | jpm | 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 | } |
||
59 | jpm | 52 | |
150 | jpm | 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; |
||
76 | } |
||
77 | |||
59 | jpm | 78 | // +------------------------------------------------------------------------------------------------------+ |
79 | // | CORPS du PROGRAMME | |
||
80 | // +------------------------------------------------------------------------------------------------------+ |
||
127 | jpm | 81 | // Recherche sur les noms scientifiques |
150 | jpm | 82 | //$GLOBALS['_DEBOGAGE_'] .= '<pre>'.print_r($GLOBALS, true).'</pre>'; |
127 | jpm | 83 | if (isset($_REQUEST['eflore_projet']) AND isset($_REQUEST['eflore_rang']) AND isset($_REQUEST['eflore_ordre'])) { |
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'])); |
||
150 | jpm | 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'])); |
||
127 | jpm | 100 | } else { |
101 | $url = EFLORE_URL_FORM_TAXON; |
||
102 | } |
||
150 | jpm | 103 | |
127 | jpm | 104 | $contenu = file_get_contents($url); |
59 | jpm | 105 | |
127 | jpm | 106 | //Analyse du squelette |
107 | require_once 'HTML/Template/IT.php'; |
||
108 | $squelette = new HTML_Template_IT(); |
||
109 | $squelette->setTemplate($contenu, FALSE, FALSE); |
||
110 | |||
111 | // Indique l'url pour obtenir fiche d'un nom |
||
112 | $squelette->setCurrentBlock('corps'); |
||
113 | // Ajout du paramêtre action à l'url courante. |
||
114 | $GLOBALS['_EFLORE_']['url']->addQueryString(EFLORE_LG_URL_ACTION, EFLORE_LG_URL_ACTION_RECH_TAX); |
||
115 | $squelette->setVariable('UrlProjetTaxon', $GLOBALS['_EFLORE_']['url']->getURL()); |
||
116 | $GLOBALS['_EFLORE_']['url']->removeQueryString(EFLORE_LG_URL_ACTION); |
||
117 | $squelette->parseCurrentBlock('corps'); |
||
118 | |||
119 | // Récupère le bloc "corps" |
||
120 | $sortie .= $squelette->get('corps'); |
||
121 | |||
122 | // -------------------------------------------------------------------------------------------------------- |
||
123 | // Lancement de la recherche |
||
173 | jpm | 124 | if (isset($_REQUEST['eflore_taxonomie_submit'])) { |
150 | jpm | 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 | |||
153 | // Recherche sur les taxons |
||
127 | jpm | 154 | $url = sprintf(EFLORE_URL_LISTE_TAXON, rawurlencode($_REQUEST['eflore_projet']), rawurlencode($_REQUEST['eflore_rang']), rawurlencode($_REQUEST['eflore_ordre']), rawurlencode($_REQUEST['eflore_lettre'])); |
155 | $contenu = file_get_contents($url); |
||
156 | |||
157 | //Analyse du squelette |
||
150 | jpm | 158 | require_once 'HTML/Template/ITX.php'; |
159 | $squelette = new HTML_Template_ITX(); |
||
127 | jpm | 160 | $squelette->setTemplate($contenu, FALSE, FALSE); |
161 | |||
150 | jpm | 162 | // Analyse du corps de la recherche |
127 | jpm | 163 | $squelette->setCurrentBlock('corps'); |
150 | jpm | 164 | $squelette =& remplacerInfoCommune($squelette); |
127 | jpm | 165 | $GLOBALS['_EFLORE_']['url']->addQueryString(EFLORE_LG_URL_NVP, $_REQUEST['eflore_projet']); |
166 | $GLOBALS['_EFLORE_']['url']->addQueryString(EFLORE_LG_URL_RG, $_REQUEST['eflore_rang']); |
||
167 | $GLOBALS['_EFLORE_']['url']->addQueryString(EFLORE_LG_URL_OD, $_REQUEST['eflore_ordre']); |
||
168 | $GLOBALS['_EFLORE_']['url']->addQueryString(EFLORE_LG_URL_LE, ''); |
||
169 | $squelette->setVariable('UrlRechercheTaxonAlphabet', $GLOBALS['_EFLORE_']['url']->getURL()); |
||
170 | $squelette->parseCurrentBlock('corps'); |
||
171 | |||
172 | // Récupère le bloc "corps" |
||
173 | $sortie .= $squelette->get('corps'); |
||
174 | } |
||
175 | |||
59 | jpm | 176 | /* +--Fin du code ----------------------------------------------------------------------------------------+ |
177 | * |
||
178 | * $Log: not supported by cvs2svn $ |
||
173 | jpm | 179 | * Revision 1.3 2005/02/15 13:00:51 jpm |
180 | * Ajout de la possibilité de naviguer dans la classification. |
||
181 | * |
||
150 | jpm | 182 | * Revision 1.2 2005/01/28 19:47:55 jpm |
183 | * Ajout de la recherche pour les taxons. |
||
184 | * |
||
127 | jpm | 185 | * Revision 1.1 2004/12/23 20:05:17 jpm |
186 | * Début prise en maine eflore-consultation. |
||
59 | jpm | 187 | * |
127 | jpm | 188 | * |
59 | jpm | 189 | * +-- Fin du code ----------------------------------------------------------------------------------------+ |
190 | */ |
||
191 | ?> |