| 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_nomenclature.inc.php,v 1.2 2005-01-03 19:44:40 jpm Exp $
|
24 |
// CVS : $Id: eflore_recherche_nomenclature.inc.php,v 1.3 2005-01-28 19:47:55 jpm Exp $
|
| 25 |
/**
|
25 |
/**
|
| 26 |
* Affichage du moteur de recherche nomenclatural et de ses résultats.
|
26 |
* Affichage du moteur de recherche nomenclatural et de ses résultats.
|
| 27 |
*
|
27 |
*
|
| 28 |
* Ce script fournit le code html correspondant aux moteurs de recherche nomenclatural et ses résultats.
|
28 |
* Ce script fournit le code html correspondant aux moteurs de recherche nomenclatural et ses résultats.
|
| 29 |
*
|
29 |
*
|
| Line 31... |
Line 31... |
| 31 |
//Auteur original :
|
31 |
//Auteur original :
|
| 32 |
*@author Jean-Pascal MILCENT <jpm@tela-botanica.org>
|
32 |
*@author Jean-Pascal MILCENT <jpm@tela-botanica.org>
|
| 33 |
//Autres auteurs :
|
33 |
//Autres auteurs :
|
| 34 |
*@author Aucun
|
34 |
*@author Aucun
|
| 35 |
*@copyright Tela-Botanica 2000-2004
|
35 |
*@copyright Tela-Botanica 2000-2004
|
| 36 |
*@version $Revision: 1.2 $ $Date: 2005-01-03 19:44:40 $
|
36 |
*@version $Revision: 1.3 $ $Date: 2005-01-28 19:47:55 $
|
| 37 |
// +------------------------------------------------------------------------------------------------------+
|
37 |
// +------------------------------------------------------------------------------------------------------+
|
| 38 |
*/
|
38 |
*/
|
| Line 39... |
Line 39... |
| 39 |
|
39 |
|
| 40 |
// +------------------------------------------------------------------------------------------------------+
|
40 |
// +------------------------------------------------------------------------------------------------------+
|
| 41 |
// | ENTÊTE du PROGRAMME |
|
41 |
// | ENTÊTE du PROGRAMME |
|
| Line -... |
Line 42... |
| - |
|
42 |
// +------------------------------------------------------------------------------------------------------+
|
| - |
|
43 |
|
| - |
|
44 |
function remplacerUrlFicheNom($arguments) {
|
| - |
|
45 |
$GLOBALS['_EFLORE_']['url']->addQueryString(EFLORE_LG_URL_ACTION, EFLORE_LG_URL_ACTION_FICHE);
|
| - |
|
46 |
$GLOBALS['_EFLORE_']['url']->addQueryString(EFLORE_LG_URL_ONGLET, EFLORE_LG_URL_ONGLET_SYNTHESE);
|
| - |
|
47 |
$GLOBALS['_EFLORE_']['url']->addQueryString(EFLORE_LG_URL_NN, $arguments[0]);
|
| - |
|
48 |
$GLOBALS['_EFLORE_']['url']->addQueryString(EFLORE_LG_URL_NVP, $arguments[1]);
|
| Line 42... |
Line 49... |
| 42 |
// +------------------------------------------------------------------------------------------------------+
|
49 |
return $GLOBALS['_EFLORE_']['url']->getURL();
|
| 43 |
|
50 |
}
|
| 44 |
|
51 |
|
| 45 |
// +------------------------------------------------------------------------------------------------------+
|
52 |
// +------------------------------------------------------------------------------------------------------+
|
| Line 58... |
Line 65... |
| 58 |
$squelette =& $form->defaultRenderer();
|
65 |
$squelette =& $form->defaultRenderer();
|
| 59 |
$squelette->setFormTemplate("\n".'<form{attributes}>'."\n".'{content}'."\n".'</form>');
|
66 |
$squelette->setFormTemplate("\n".'<form{attributes}>'."\n".'{content}'."\n".'</form>');
|
| 60 |
$squelette->setElementTemplate( '<li>'."\n".
|
67 |
$squelette->setElementTemplate( '<li>'."\n".
|
| 61 |
'{label}'."\n".
|
68 |
'{label}'."\n".
|
| 62 |
'{element}'."\n".
|
69 |
'{element}'."\n".
|
| 63 |
'<!-- BEGIN required --><span class="symbole_obligatoire">'.MORE_LG_FORM_SYMBOLE_OBLIGATOIRE.'</span><!-- END required -->'."\n".
|
70 |
'<!-- BEGIN required --><span class="symbole_obligatoire">'.EFLORE_LG_FORM_SYMBOLE_OBLIGATOIRE.'</span><!-- END required -->'."\n".
|
| 64 |
'<!-- BEGIN error --><span class="erreur">{error}</span><!-- END error -->'."\n".
|
71 |
'<!-- BEGIN error --><span class="erreur">{error}</span><!-- END error -->'."\n".
|
| 65 |
'</li>'."\n");
|
72 |
'</li>'."\n");
|
| 66 |
//$squelette->setRequiredNoteTemplate("\n".'<p><span class="symbole_obligatoire">'.MORE_LG_FORM_SYMBOLE_OBLIGATOIRE.'</span> {requiredNote}</p>'."\n");
|
73 |
//$squelette->setRequiredNoteTemplate("\n".'<p><span class="symbole_obligatoire">'.MORE_LG_FORM_SYMBOLE_OBLIGATOIRE.'</span> {requiredNote}</p>'."\n");
|
| Line 67... |
Line 74... |
| 67 |
|
74 |
|
| Line 75... |
Line 82... |
| 75 |
'onclick' => "javascript: this.value='';");
|
82 |
'onclick' => "javascript: this.value='';");
|
| 76 |
$label = '<label for="'.$id.'">'.EFLORE_LG_RECH_NOM_FORM_NOM.'</label>';
|
83 |
$label = '<label for="'.$id.'">'.EFLORE_LG_RECH_NOM_FORM_NOM.'</label>';
|
| 77 |
$form->addElement('text', $id, $label, $aso_attributs);
|
84 |
$form->addElement('text', $id, $label, $aso_attributs);
|
| Line 78... |
Line 85... |
| 78 |
|
85 |
|
| 79 |
$liste_type_nom_debut = '<ul>'."\n";
|
86 |
$liste_type_nom_debut = '<ul>'."\n";
|
| Line 80... |
Line 87... |
| 80 |
$form->addElement('html', $$liste_type_nom_debut);
|
87 |
$form->addElement('html', $liste_type_nom_debut);
|
| 81 |
|
88 |
|
| 82 |
$id = 'eflore_type_nom';
|
89 |
$id = 'eflore_type_nom';
|
| 83 |
$valeur = 'nom_scientifique';
|
90 |
$valeur = 'nom_scientifique';
|
| Line 100... |
Line 107... |
| 100 |
} else {
|
107 |
} else {
|
| 101 |
$form->setDefaults(array($id => 'nom_scientifique'));
|
108 |
$form->setDefaults(array($id => 'nom_scientifique'));
|
| 102 |
}
|
109 |
}
|
| Line 103... |
Line 110... |
| 103 |
|
110 |
|
| 104 |
$liste_type_nom_fin = '</ul>'."\n";
|
111 |
$liste_type_nom_fin = '</ul>'."\n";
|
| Line 105... |
Line 112... |
| 105 |
$form->addElement('html', $$liste_type_nom_fin);
|
112 |
$form->addElement('html', $liste_type_nom_fin);
|
| 106 |
|
113 |
|
| 107 |
$id = 'eflore_valider';
|
114 |
$id = 'eflore_valider_nom';
|
| Line 108... |
Line 115... |
| 108 |
$aso_attributs = array('id'=> $id, 'class' => 'champ', 'tabindex' => $tab_index++);
|
115 |
$aso_attributs = array('id'=> $id, 'class' => 'champ', 'tabindex' => $tab_index++);
|
| 109 |
$form->addElement('submit', $id, EFLORE_LG_RECH_NOM_FORM_VALIDER, $aso_attributs);
|
116 |
$form->addElement('submit', $id, EFLORE_LG_RECH_NOM_FORM_VALIDER, $aso_attributs);
|
| Line 110... |
Line 117... |
| 110 |
|
117 |
|
| 111 |
$partie_entete_fin = "\n".'</fieldset>';
|
118 |
$partie_entete_fin = "\n".'</fieldset>';
|
| Line 112... |
Line 119... |
| 112 |
$form->addElement('html', $partie_entete_fin);
|
119 |
$form->addElement('html', $partie_entete_fin);
|
| 113 |
|
120 |
|
| 114 |
// Instanciation avec les valeur par défaut
|
121 |
// Instanciation avec les valeur par défaut
|
| Line 115... |
Line 122... |
| 115 |
$form->setDefaults($_SESSION['_MOTEUR_RECHERCHE_']['rechercher']);
|
122 |
$form->setDefaults($_SESSION['_EFLORE_']['rechercher']);
|
| 116 |
|
123 |
|
| 117 |
// Transformation en XHTML du formulaire
|
124 |
// Transformation en XHTML du formulaire
|
| - |
|
125 |
$sortie .= $form->toHTML()."\n";
|
| - |
|
126 |
$sortie .= '</ul>'."\n";
|
| 118 |
$sortie .= $form->toHTML()."\n";
|
127 |
|
| 119 |
$sortie .= '</ul>';
|
128 |
// --------------------------------------------------------------------------------------------------------
|
| 120 |
|
129 |
// Lancement de la recherche
|
| Line 121... |
Line 130... |
| 121 |
// --------------------------------------------------------------------------------------------------------
|
130 |
if (isset($_REQUEST['eflore_nom']) && $_REQUEST['eflore_nom'] != '' && !eregi("^%{1,}$", $_REQUEST['eflore_nom']) ) {
|
| 122 |
// Lancement de la recherche
|
131 |
// Formatage de la chaine à rechercher
|
| 123 |
if (isset($_REQUEST['eflore_nom']) && $_REQUEST['eflore_nom'] != '') {
|
132 |
$_REQUEST['eflore_nom'] = '%'.str_replace(' ', '%', $_REQUEST['eflore_nom']).'%';
|
| 124 |
if ($_REQUEST['eflore_type_nom'] == 'nom_scientifique') {
|
133 |
if ($_REQUEST['eflore_type_nom'] == 'nom_scientifique') {
|
| Line 125... |
Line 134... |
| 125 |
// Recherche sur les noms scientifiques
|
134 |
// Recherche sur les noms scientifiques
|
| 126 |
$contenu = file_get_contents(sprintf(EFLORE_URL_LISTE_NOM_LATIN, $_REQUEST['eflore_nom']));
|
135 |
$contenu = file_get_contents(sprintf(EFLORE_URL_LISTE_NOM_LATIN, rawurlencode($_REQUEST['eflore_nom'])));
|
| 127 |
|
136 |
|
| 128 |
//Analyse du squelette
|
137 |
//Analyse du squelette
|
| Line 138... |
Line 147... |
| 138 |
$GLOBALS['_EFLORE_']['url']->addQueryString(EFLORE_LG_URL_NN, '');
|
147 |
$GLOBALS['_EFLORE_']['url']->addQueryString(EFLORE_LG_URL_NN, '');
|
| 139 |
$squelette->setVariable('UrlFicheNom', $GLOBALS['_EFLORE_']['url']->getURL());
|
148 |
$squelette->setVariable('UrlFicheNom', $GLOBALS['_EFLORE_']['url']->getURL());
|
| 140 |
$squelette->parseCurrentBlock('corps');
|
149 |
$squelette->parseCurrentBlock('corps');
|
| Line 141... |
Line 150... |
| 141 |
|
150 |
|
| 142 |
// Récupère le bloc "corps"
|
151 |
// Récupère le bloc "corps"
|
| 143 |
$sortie .= $squelette->get();
|
152 |
$sortie .= $squelette->get('corps');
|
| 144 |
} else if ($_REQUEST['eflore_type_nom'] == 'nom_vernaculaire') {
|
153 |
} else if ($_REQUEST['eflore_type_nom'] == 'nom_vernaculaire') {
|
| - |
|
154 |
// Recherche sur les noms vernaculaires
|
| - |
|
155 |
$contenu = file_get_contents(sprintf(EFLORE_URL_LISTE_NOM_VERNA, rawurlencode($_REQUEST['eflore_nom'])));
|
| - |
|
156 |
|
| - |
|
157 |
//Analyse du squelette
|
| - |
|
158 |
require_once 'HTML/Template/ITX.php';
|
| - |
|
159 |
$squelette = new HTML_Template_ITX();
|
| - |
|
160 |
$squelette->setTemplate($contenu, FALSE, FALSE);
|
| - |
|
161 |
|
| - |
|
162 |
// Indique l'url pour obtenir fiche d'un nom
|
| - |
|
163 |
$squelette->setCurrentBlock('corps');
|
| - |
|
164 |
$squelette->setCallbackFunction('UrlFicheNom', 'remplacerUrlFicheNom');
|
| - |
|
165 |
$squelette->performCallback();
|
| - |
|
166 |
$squelette->parseCurrentBlock('corps');
|
| - |
|
167 |
|
| - |
|
168 |
// Récupère le bloc "corps"
|
| Line 145... |
Line 169... |
| 145 |
// Recherche sur les noms vernaculaires
|
169 |
$sortie .= $squelette->get('corps');
|
| 146 |
|
170 |
|
| Line 147... |
Line 171... |
| 147 |
}
|
171 |
}
|
| 148 |
}
|
172 |
}
|
| 149 |
|
173 |
|
| - |
|
174 |
/* +--Fin du code ----------------------------------------------------------------------------------------+
|
| - |
|
175 |
*
|
| - |
|
176 |
* $Log: not supported by cvs2svn $
|
| 150 |
/* +--Fin du code ----------------------------------------------------------------------------------------+
|
177 |
* Revision 1.2 2005/01/03 19:44:40 jpm
|
| 151 |
*
|
178 |
* Ajout de la gestion de l'action "fiche".
|
| 152 |
* $Log: not supported by cvs2svn $
|
179 |
*
|
| 153 |
* Revision 1.1 2004/12/23 20:05:17 jpm
|
180 |
* Revision 1.1 2004/12/23 20:05:17 jpm
|
| 154 |
* Début prise en maine eflore-consultation.
|
181 |
* Début prise en maine eflore-consultation.
|