Subversion Repositories eFlore/Archives.eflore-consultation-v2

Rev

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

Rev 59 Rev 60
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.1 2004-12-23 20:05:17 jpm Exp $
24
// CVS : $Id: eflore_recherche_nomenclature.inc.php,v 1.2 2005-01-03 19:44:40 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.1 $ $Date: 2004-12-23 20:05:17 $
36
*@version       $Revision: 1.2 $ $Date: 2005-01-03 19:44:40 $
37
// +------------------------------------------------------------------------------------------------------+
37
// +------------------------------------------------------------------------------------------------------+
38
*/
38
*/
Line 39... Line 39...
39
 
39
 
40
// +------------------------------------------------------------------------------------------------------+
40
// +------------------------------------------------------------------------------------------------------+
Line 48... Line 48...
48
$sortie .= '<h2>'.EFLORE_LG_RECH_NOM_TITRE.'</h2>';
48
$sortie .= '<h2>'.EFLORE_LG_RECH_NOM_TITRE.'</h2>';
Line 49... Line 49...
49
 
49
 
50
// --------------------------------------------------------------------------------------------------------
50
// --------------------------------------------------------------------------------------------------------
51
// Création du formulaire
51
// Création du formulaire
-
 
52
$sortie .= '<ul>';
-
 
53
// Ajout du paramêtre action à l'url courante.
52
$sortie .= '<ul>';
54
$GLOBALS['_EFLORE_']['url']->addQueryString(EFLORE_LG_URL_ACTION, EFLORE_LG_URL_ACTION_RECH_NOM);
53
// Notes : Quickform semble remplacer les & des &amp; à nouveau par des &amp; solution utiliser str_replace()...
55
// Notes : Quickform semble remplacer les & des &amp; à nouveau par des &amp; solution utiliser str_replace()...
54
$form =& new HTML_QuickForm('eflore_form_nomenclature', 'post', str_replace('&amp;', '&', $GLOBALS['_EFLORE_']['objet_pear_url']->getUrl()));
56
$form =& new HTML_QuickForm('eflore_form_nomenclature', 'post', str_replace('&amp;', '&', $GLOBALS['_EFLORE_']['url']->getUrl()));
55
$tab_index = MORE_FORM_MOTIF_TAB;
57
$tab_index = EFLORE_RECH_NOM_FORM_TAB;
56
$squelette =& $form->defaultRenderer();
58
$squelette =& $form->defaultRenderer();
57
$squelette->setFormTemplate("\n".'<form{attributes}>'."\n".'{content}'."\n".'</form>');
59
$squelette->setFormTemplate("\n".'<form{attributes}>'."\n".'{content}'."\n".'</form>');
58
$squelette->setElementTemplate( '<li>'."\n".
60
$squelette->setElementTemplate( '<li>'."\n".
59
                                '{label}'."\n".
61
                                '{label}'."\n".
60
                                '{element}'."\n".
62
                                '{element}'."\n".
61
                                '<!-- BEGIN required --><span class="symbole_obligatoire">'.MORE_LG_FORM_SYMBOLE_OBLIGATOIRE.'</span><!-- END required -->'."\n".
63
                                '<!-- BEGIN required --><span class="symbole_obligatoire">'.MORE_LG_FORM_SYMBOLE_OBLIGATOIRE.'</span><!-- END required -->'."\n".
62
                                '<!-- BEGIN error --><span class="erreur">{error}</span><!-- END error -->'.
64
                                '<!-- BEGIN error --><span class="erreur">{error}</span><!-- END error -->'."\n".
63
                                '</li>'."\n");
65
                                '</li>'."\n");
Line 64... Line 66...
64
//$squelette->setRequiredNoteTemplate("\n".'<p><span class="symbole_obligatoire">'.MORE_LG_FORM_SYMBOLE_OBLIGATOIRE.'</span> {requiredNote}</p>'."\n");
66
//$squelette->setRequiredNoteTemplate("\n".'<p><span class="symbole_obligatoire">'.MORE_LG_FORM_SYMBOLE_OBLIGATOIRE.'</span> {requiredNote}</p>'."\n");
65
 
67
 
Line 78... Line 80...
78
$form->addElement('html', $$liste_type_nom_debut);
80
$form->addElement('html', $$liste_type_nom_debut);
Line 79... Line 81...
79
 
81
 
80
$id = 'eflore_type_nom';
82
$id = 'eflore_type_nom';
81
$valeur = 'nom_scientifique';
83
$valeur = 'nom_scientifique';
82
$aso_attributs = array( 'id'=> $id, 'tabindex' => $tab_index++);
84
$aso_attributs = array( 'id'=> $id, 'tabindex' => $tab_index++);
83
$label = '';//<label for="'.$id.'">'.EFLORE_LG_RECH_NOM_FORM_.'</label>';
85
$label = '';
84
$form->addElement('radio', $id, $label, EFLORE_LG_RECH_NOM_FORM_TYPE_NOM_SCI, $valeur, $aso_attributs);
-
 
85
 
-
 
86
$id = 'eflore_type_nom';
86
$form->addElement('radio', $id, $label, EFLORE_LG_RECH_NOM_FORM_TYPE_NOM_SCI, $valeur, $aso_attributs);
87
$valeur = 'nom_vernaculaire';
87
$valeur = 'nom_vernaculaire';
88
$aso_attributs = array( 'id'=> $id, 'tabindex' => $tab_index++);
88
$aso_attributs = array( 'id'=> $id, 'tabindex' => $tab_index++);
89
$label = '';//<label for="'.$id.'">'.EFLORE_LG_RECH_NOM_FORM_.'</label>';
89
$label = '';
-
 
90
$form->addElement('radio', $id, $label, EFLORE_LG_RECH_NOM_FORM_TYPE_NOM_VER, $valeur, $aso_attributs);
-
 
91
if (isset($_REQUEST[$id])) {
-
 
92
    switch ($_REQUEST[$id]) {
-
 
93
        case 'nom_scientifique':
-
 
94
            $form->setDefaults(array($id => 'nom_scientifique'));
-
 
95
            break;
-
 
96
        case 'nom_vernaculaire':
-
 
97
            $form->setDefaults(array($id => 'nom_vernaculaire'));
-
 
98
            break;
-
 
99
    }
-
 
100
} else {
-
 
101
    $form->setDefaults(array($id => 'nom_scientifique'));
Line 90... Line 102...
90
$form->addElement('radio', $id, $label, EFLORE_LG_RECH_NOM_FORM_TYPE_NOM_VER, $valeur, $aso_attributs);
102
}
91
 
103
 
Line 92... Line 104...
92
$liste_type_nom_fin = '</ul>'."\n";
104
$liste_type_nom_fin = '</ul>'."\n";
Line 104... Line 116...
104
 
116
 
105
// Transformation en XHTML du formulaire
117
// Transformation en XHTML du formulaire
106
$sortie .= $form->toHTML()."\n";
118
$sortie .= $form->toHTML()."\n";
Line -... Line 119...
-
 
119
$sortie .= '</ul>';
-
 
120
 
-
 
121
// --------------------------------------------------------------------------------------------------------
-
 
122
// Lancement de la recherche
-
 
123
if (isset($_REQUEST['eflore_nom']) && $_REQUEST['eflore_nom'] != '') {
-
 
124
    if ($_REQUEST['eflore_type_nom'] == 'nom_scientifique') {
-
 
125
        // Recherche sur les noms scientifiques
-
 
126
        $contenu = file_get_contents(sprintf(EFLORE_URL_LISTE_NOM_LATIN, $_REQUEST['eflore_nom']));
-
 
127
        
-
 
128
        //Analyse du squelette
-
 
129
        require_once 'HTML/Template/IT.php';
-
 
130
        $squelette = new HTML_Template_IT();
-
 
131
        $squelette->setTemplate($contenu, true, true);
-
 
132
        
-
 
133
        // Indique l'url pour obtenir fiche d'un nom
-
 
134
        $squelette->setCurrentBlock('corps');
-
 
135
        // Ajout du paramêtre action à l'url courante.
-
 
136
        $GLOBALS['_EFLORE_']['url']->addQueryString(EFLORE_LG_URL_ACTION, EFLORE_LG_URL_ACTION_FICHE);
-
 
137
        $GLOBALS['_EFLORE_']['url']->addQueryString(EFLORE_LG_URL_ONGLET, EFLORE_LG_URL_ONGLET_SYNTHESE);
-
 
138
        $GLOBALS['_EFLORE_']['url']->addQueryString(EFLORE_LG_URL_NN, '');
-
 
139
        $squelette->setVariable('UrlFicheNom', $GLOBALS['_EFLORE_']['url']->getURL());
-
 
140
        $squelette->parseCurrentBlock('corps');
-
 
141
        
-
 
142
        // Récupère le bloc "corps"
-
 
143
        $sortie .= $squelette->get();
-
 
144
    } else if ($_REQUEST['eflore_type_nom'] == 'nom_vernaculaire') {
-
 
145
        // Recherche sur les noms vernaculaires
-
 
146
        
-
 
147
    }
107
$sortie .= '</ul>';
148
}
108
 
149
 
109
/* +--Fin du code ----------------------------------------------------------------------------------------+
150
/* +--Fin du code ----------------------------------------------------------------------------------------+
-
 
151
*
-
 
152
* $Log: not supported by cvs2svn $
-
 
153
* Revision 1.1  2004/12/23 20:05:17  jpm
110
*
154
* Début prise en maine eflore-consultation.
111
* $Log: not supported by cvs2svn $
155
*
112
*
156
*
113
* +-- Fin du code ----------------------------------------------------------------------------------------+
157
* +-- Fin du code ----------------------------------------------------------------------------------------+
114
*/
158
*/