Subversion Repositories eFlore/Archives.eflore-consultation-v2

Rev

Rev 176 | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 176 Rev 178
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_fiche.inc.php,v 1.4 2005-07-01 19:04:12 jp_milcent Exp $
24
// CVS : $Id: eflore_fiche.inc.php,v 1.5 2005-07-26 09:20:40 jp_milcent Exp $
25
/**
25
/**
26
* Affichage des fiches d'eFlore.
26
* Affichage des fiches d'eFlore.
27
*
27
*
28
* Ce script fournit le code html correspondant aux fiches d'eFlore.
28
* Ce script fournit le code html correspondant aux fiches d'eFlore.
29
*
29
*
30
*@package eFlore
30
*@package eFlore
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.4 $ $Date: 2005-07-01 19:04:12 $
36
*@version       $Revision: 1.5 $ $Date: 2005-07-26 09:20:40 $
37
// +------------------------------------------------------------------------------------------------------+
37
// +------------------------------------------------------------------------------------------------------+
38
*/
38
*/
39
 
39
 
40
// +------------------------------------------------------------------------------------------------------+
40
// +------------------------------------------------------------------------------------------------------+
41
// |                                            ENTÊTE du PROGRAMME                                       |
41
// |                                            ENTÊTE du PROGRAMME                                       |
42
// +------------------------------------------------------------------------------------------------------+
42
// +------------------------------------------------------------------------------------------------------+
43
 
43
 
44
 
44
 
45
// +------------------------------------------------------------------------------------------------------+
45
// +------------------------------------------------------------------------------------------------------+
46
// |                                            CORPS du PROGRAMME                                        |
46
// |                                            CORPS du PROGRAMME                                        |
47
// +------------------------------------------------------------------------------------------------------+
47
// +------------------------------------------------------------------------------------------------------+
48
if (isset($_REQUEST['nn']) && $_REQUEST['nn'] != '') {
48
if (isset($_REQUEST['nn']) && $_REQUEST['nn'] != '') {
49
    // Récupération fiche -- onglet "Synthèse"
49
    // Récupération fiche -- onglet "Synthèse"
50
    if (isset($_REQUEST['nvp']) && $_REQUEST['nvp'] != '') {
50
    if (isset($_REQUEST['nvp']) && $_REQUEST['nvp'] != '') {
51
        // Nous avons en plus un projet de sélectionné
51
        // Nous avons en plus un projet de sélectionné
52
        $contenu = file_get_contents(sprintf(EFLORE_URL_FICHE_SYNTHESE_PROJET, $_REQUEST['nn'], $_REQUEST['nvp']));
52
        $contenu = file_get_contents(sprintf(EFLORE_URL_FICHE_SYNTHESE_PROJET, $_REQUEST['nn'], $_REQUEST['nvp']));
53
    } else {
53
    } else {
54
        // Avec le projet par défaut (BDNFF)
54
        // Avec le projet par défaut (BDNFF)
55
        $contenu = file_get_contents(sprintf(EFLORE_URL_FICHE_SYNTHESE, $_REQUEST['nn']));
55
        $contenu = file_get_contents(sprintf(EFLORE_URL_FICHE_SYNTHESE, $_REQUEST['nn']));
56
    }
56
    }
57
    
57
    
58
    //Analyse du squelette
58
    //Analyse du squelette
59
    require_once 'HTML/Template/ITX.php';
59
    require_once 'HTML/Template/ITX.php';
60
    $squelette = new HTML_Template_ITX();
60
    $squelette = new HTML_Template_ITX();
61
    $squelette->setTemplate($contenu, FALSE, FALSE);
61
    $squelette->setTemplate($contenu, FALSE, FALSE);
62
    
62
    
63
    // Gestion des niveaux taxonomiques supérieurs
63
    // Gestion des niveaux taxonomiques supérieurs
64
    $squelette->setCallbackFunction('selectionnerEfloreRef', 'selectionnerEfloreRef');
64
    $squelette->setCallbackFunction('selectionnerEfloreRef', 'selectionnerEfloreRef');
65
    $squelette->performCallback();
65
    $squelette->performCallback();
66
    
66
    
67
    // Indique l'url pour obtenir fiche d'un nom
67
    // Indique l'url pour obtenir fiche d'un nom
68
    $squelette->setCurrentBlock('corps');
68
    $squelette->setCurrentBlock('corps');
69
    
69
    
70
    //http://testv4.tela-botanica.org/papyrus.php?site=5&menu=39&action=fiche&onglet=synthese&nn=1573
70
    //http://testv4.tela-botanica.org/papyrus.php?site=5&menu=39&action=fiche&onglet=synthese&nn=1573
71
    $GLOBALS['_EFLORE_']['url']->addQueryString(EFLORE_LG_URL_ACTION, EFLORE_LG_URL_ACTION_FICHE);
71
    $GLOBALS['_EFLORE_']['url']->addQueryString(EFLORE_LG_URL_ACTION, EFLORE_LG_URL_ACTION_FICHE);
72
    $GLOBALS['_EFLORE_']['url']->addQueryString(EFLORE_LG_URL_ONGLET, EFLORE_LG_URL_ONGLET_SYNTHESE);
72
    $GLOBALS['_EFLORE_']['url']->addQueryString(EFLORE_LG_URL_ONGLET, EFLORE_LG_URL_ONGLET_SYNTHESE);
73
    $GLOBALS['_EFLORE_']['url']->addQueryString(EFLORE_LG_URL_NN, $_REQUEST['nn']);
73
    $GLOBALS['_EFLORE_']['url']->addQueryString(EFLORE_LG_URL_NN, $_REQUEST['nn']);
74
    $squelette->setVariable('FormUrlProjetChangement', $GLOBALS['_EFLORE_']['url']->getURL());
74
    $squelette->setVariable('FormUrlProjetChangement', $GLOBALS['_EFLORE_']['url']->getURL());
75
    $GLOBALS['_EFLORE_']['url']->addQueryString(EFLORE_LG_URL_NVP, '');
75
    $GLOBALS['_EFLORE_']['url']->addQueryString(EFLORE_LG_URL_NVP, '');
76
    $squelette->setVariable('LienUrlProjetChangement', $GLOBALS['_EFLORE_']['url']->getURL());
76
    $squelette->setVariable('LienUrlProjetChangement', $GLOBALS['_EFLORE_']['url']->getURL());
77
    // Référentiel sélectionné par défaut
77
    // Référentiel sélectionné par défaut
78
    $squelette->setCallbackFunction('NiveauTaxo', 'afficherNiveauTaxoSuperieur');
78
    $squelette->setCallbackFunction('NiveauTaxo', 'afficherNiveauTaxoSuperieur');
79
    $squelette->performCallback();
79
    $squelette->performCallback();
80
    $squelette->parseCurrentBlock('corps');
80
    $squelette->parseCurrentBlock('corps');
81
    
81
    
82
    // Récupère le bloc "corps"
82
    // Récupère le bloc "corps"
83
    $sortie .= $squelette->get('corps');
83
    $sortie .= $squelette->get('corps');
84
}
84
}
85
 
85
 
86
// +------------------------------------------------------------------------------------------------------+
86
// +------------------------------------------------------------------------------------------------------+
87
// |                                            LISTE des FONCTIONS                                       |
87
// |                                            LISTE des FONCTIONS                                       |
88
// +------------------------------------------------------------------------------------------------------+
88
// +------------------------------------------------------------------------------------------------------+
89
 
89
 
90
function afficherNiveauTaxoSuperieur($arguments) {
90
function afficherNiveauTaxoSuperieur($arguments) {
91
    $tab_nom_sup = array();
91
    $tab_nom_sup = array();
92
    $retour = '';
92
    $retour = '';
93
    $nt = $arguments[0];
93
    $nt = $arguments[0];
94
    $nvp = $arguments[1];
94
    $nvp = $arguments[1];
95
    while ($nt != 0) {
95
    while ($nt != 0) {
96
        $aso_taxon = array();
96
        $aso_taxon = array();
97
        $contenu = file_get_contents(sprintf(EFLORE_URL_INFO_TAXON_SUP, rawurlencode($nt), rawurlencode($nvp)));
97
        $contenu = file_get_contents(sprintf(EFLORE_URL_INFO_TAXON_SUP, rawurlencode($nt), rawurlencode($nvp)));
98
        preg_match("/<en_ce_r>(\d+)<\/en_ce_r>/", $contenu, $info);
98
        preg_match("/<en_ce_r>(\d+)<\/en_ce_r>/", $contenu, $info);
99
        if (isset($info[1])) {
99
        if (isset($info[1])) {
100
        	$aso_taxon['nr'] = $info[1];
100
        	$aso_taxon['nr'] = $info[1];
101
        	$nr = $info[1];
101
        	$nr = $info[1];
102
        }
102
        }
103
        preg_match('/<etr_id_t2>(\d+)<\/etr_id_t2>/', $contenu, $info);
103
        preg_match('/<etr_id_t2>(\d+)<\/etr_id_t2>/', $contenu, $info);
104
        if (isset($info[1])) {
104
        if (isset($info[1])) {
105
        	$aso_taxon['nt'] = $info[1];
105
        	$aso_taxon['nt'] = $info[1];
106
        	$nt = $info[1];
106
        	$nt = $info[1];
107
        } else {
107
        } else {
108
        	$nt = 0;
108
        	$nt = 0;
109
        }
109
        }
110
        preg_match('/<etr_id_vpt2>(\d+)<\/etr_id_vpt2>/', $contenu, $info);
110
        preg_match('/<etr_id_vpt2>(\d+)<\/etr_id_vpt2>/', $contenu, $info);
111
        if (isset($info[1])) {
111
        if (isset($info[1])) {
112
        	$aso_taxon['nvp'] = $info[1];
112
        	$aso_taxon['nvp'] = $info[1];
113
        	$nvp = $info[1];
113
        	$nvp = $info[1];
114
        }
114
        }
115
        preg_match('/<en_id_n>(\d+)<\/en_id_n>/', $contenu, $info);
115
        preg_match('/<en_id_n>(\d+)<\/en_id_n>/', $contenu, $info);
116
        if (isset($info[1])) {
116
        if (isset($info[1])) {
117
        	$aso_taxon['nn'] = $info[1];
117
        	$aso_taxon['nn'] = $info[1];
118
        }
118
        }
119
        if ($nt != 0) {
119
        if ($nt != 0) {
120
        	array_push($tab_nom_sup, $aso_taxon);
120
        	array_push($tab_nom_sup, $aso_taxon);
121
        }
121
        }
122
    }
122
    }
123
    // Nous avons des taxons supérieurs
123
    // Nous avons des taxons supérieurs
124
    if (count($tab_nom_sup) > 0) {
124
    if (count($tab_nom_sup) > 0) {
125
	    $retour .= '<ul>'."\n";
125
	    $retour .= '<ul>'."\n";
126
	    $j = 0;
126
	    $j = 0;
127
	    for($i = (count($tab_nom_sup)-1); $i >= 0; $i--) {
127
	    for($i = (count($tab_nom_sup)-1); $i >= 0; $i--) {
128
	    	$contenu = file_get_contents(sprintf(EFLORE_URL_INFO_NOM_LATIN, rawurlencode($tab_nom_sup[$i]['nn'])));
128
	    	$contenu = file_get_contents(sprintf(EFLORE_URL_INFO_NOM_LATIN, rawurlencode($tab_nom_sup[$i]['nn'])));
129
        	preg_match("/<eni_in>(.+?)<\/eni_in>/", $contenu, $info);
129
        	preg_match("/<eni_in>(.+?)<\/eni_in>/", $contenu, $info);
130
        	if (isset($info[1])) {
130
        	if (isset($info[1])) {
131
        		$retour .= '<li>'.str_repeat('&nbsp;', ($j++ * 3)).$info[1].'</li>';
131
        		$retour .= '<li>'.str_repeat('&nbsp;', ($j++ * 3)).$info[1].'</li>';
132
        	} else {
132
        	} else {
133
        		$retour .= '<li>'.str_repeat('&nbsp;', ($j++ * 3)).'???'.'</li>';
133
        		$retour .= '<li>'.str_repeat('&nbsp;', ($j++ * 3)).'???'.'</li>';
134
        	}
134
        	}
135
	        
135
	        
136
	    }
136
	    }
137
	    $retour .= '</ul>'."\n";
137
	    $retour .= '</ul>'."\n";
138
    } else {
138
    } else {
139
    	$retour .= 'Aucun taxon supérieur.';
139
    	$retour .= 'Aucun taxon supérieur ou information non renseignée.';
140
    }
140
    }
141
    return $retour;
141
    return $retour;
142
}
142
}
143
/* +--Fin du code ----------------------------------------------------------------------------------------+
143
/* +--Fin du code ----------------------------------------------------------------------------------------+
144
*
144
*
145
* $Log: not supported by cvs2svn $
145
* $Log: not supported by cvs2svn $
-
 
146
* Revision 1.4  2005/07/01 19:04:12  jp_milcent
-
 
147
* Fin gestion des niveaux taxonomiques supérieurs.
-
 
148
*
146
* Revision 1.3  2005/06/30 15:24:26  jpm
149
* Revision 1.3  2005/06/30 15:24:26  jpm
147
* Début des modifications pour ajout de l'arborescence de la classif.
150
* Début des modifications pour ajout de l'arborescence de la classif.
148
*
151
*
149
* Revision 1.2  2005/06/24 09:46:43  jpm
152
* Revision 1.2  2005/06/24 09:46:43  jpm
150
* Test pour mathilde
153
* Test pour mathilde
151
*
154
*
152
* Revision 1.1  2005/01/28 19:48:11  jpm
155
* Revision 1.1  2005/01/28 19:48:11  jpm
153
* Ajout d'une fiche de synthèse.
156
* Ajout d'une fiche de synthèse.
154
*
157
*
155
* Revision 1.2  2005/01/03 19:44:40  jpm
158
* Revision 1.2  2005/01/03 19:44:40  jpm
156
* Ajout de la gestion de l'action "fiche".
159
* Ajout de la gestion de l'action "fiche".
157
*
160
*
158
* Revision 1.1  2004/12/23 20:05:17  jpm
161
* Revision 1.1  2004/12/23 20:05:17  jpm
159
* Début prise en maine eflore-consultation.
162
* Début prise en maine eflore-consultation.
160
*
163
*
161
*
164
*
162
* +-- Fin du code ----------------------------------------------------------------------------------------+
165
* +-- Fin du code ----------------------------------------------------------------------------------------+
163
*/
166
*/
164
?>
167
?>