Subversion Repositories eFlore/Archives.eflore-consultation-v1

Rev

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

Rev 8 Rev 9
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.1                                                                                      |
4
// | PHP version 4.1                                                                                      |
5
// +------------------------------------------------------------------------------------------------------+
5
// +------------------------------------------------------------------------------------------------------+
6
// | Copyright (C) 2005 Tela Botanica (accueil@tela-botanica.org)                                         |
6
// | Copyright (C) 2005 Tela Botanica (accueil@tela-botanica.org)                                         |
7
// +------------------------------------------------------------------------------------------------------+
7
// +------------------------------------------------------------------------------------------------------+
8
// | This file is part of Integrateur eFlore.                                                             |
8
// | This file is part of Integrateur eFlore.                                                             |
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_transfo_xslt.inc.php,v 1.2 2005-06-01 18:26:21 jpm Exp $
24
// CVS : $Id: eflore_transfo_xslt.inc.php,v 1.3 2005-11-18 15:14:39 jp_milcent Exp $
25
/**
25
/**
26
* Réalisation de la transfo XSL du XML d'eFlore.
26
* Réalisation de la transfo XSL du XML d'eFlore.
27
*
27
*
28
*@package eFlore
28
*@package eFlore
29
*@subpackage Ancien
29
*@subpackage Ancien
30
//Auteur original :
30
//Auteur original :
31
*@author        Jean-Pascal MILCENT <jpm@tela-botanica.org>
31
*@author        Jean-Pascal MILCENT <jpm@tela-botanica.org>
32
//Autres auteurs :
32
//Autres auteurs :
33
*@author        Aucun
33
*@author        Aucun
34
*@copyright     Tela-Botanica 2000-2005
34
*@copyright     Tela-Botanica 2000-2005
35
*@version       $Revision: 1.2 $ $Date: 2005-06-01 18:26:21 $
35
*@version       $Revision: 1.3 $ $Date: 2005-11-18 15:14:39 $
36
// +------------------------------------------------------------------------------------------------------+
36
// +------------------------------------------------------------------------------------------------------+
37
*/
37
*/
38
 
38
 
39
// +------------------------------------------------------------------------------------------------------+
39
// +------------------------------------------------------------------------------------------------------+
40
// |                                            ENTETE du PROGRAMME                                       |
40
// |                                            ENTETE du PROGRAMME                                       |
41
// +------------------------------------------------------------------------------------------------------+
41
// +------------------------------------------------------------------------------------------------------+
42
// Récupération des valeurs du formulaire
42
// Récupération des valeurs du formulaire
43
switch ($flore) {
43
switch ($flore) {
44
    case 'FRA':
44
    case 'FRA':
45
        $services = 'servicesxml/';
45
        $services = 'servicesxml/';
46
        $baseURL .= '&amp;flore=FRA&amp;';
46
        $baseURL .= '&amp;flore=FRA&amp;';
47
        $tab_champ['esd_nom_index'] = 'France metropole';
47
        $tab_champ['esd_nom_index'] = 'France metropole';
48
        break;
48
        break;
49
    case 'REU':
49
    case 'REU':
50
        $services = 'services_xml_mascareignes/';
50
        $services = 'services_xml_mascareignes/';
51
        $baseURL .= '&amp;flore=REU&amp;';
51
        $baseURL .= '&amp;flore=REU&amp;';
52
        $tab_champ['esd_nom_index'] = 'France mascareignes';
52
        $tab_champ['esd_nom_index'] = 'France mascareignes';
53
        break;
53
        break;
54
    case 'ANT':
54
    case 'ANT':
55
        $services = 'services_xml_antilles/';
55
        $services = 'services_xml_antilles/';
56
        $baseURL .= '&amp;flore=ANT&amp;';
56
        $baseURL .= '&amp;flore=ANT&amp;';
57
        $tab_champ['esd_nom_index'] = 'France antilles';
57
        $tab_champ['esd_nom_index'] = 'France antilles';
58
        break;
58
        break;
59
}
59
}
60
 
60
 
61
$numclass = (isset($_POST['numclass'])) ? $_POST['numclass'] : 1;
61
$numclass = (isset($_POST['numclass'])) ? $_POST['numclass'] : 1;
62
switch ($recherche) {
62
switch ($recherche) {
63
    case 'LATIN':
63
    case 'LATIN':
64
        $xml  = 'donnelistetaxons.php';
64
        $xml  = 'donnelistetaxons.php';
65
        $xslt = 'listetaxons.xsl';
65
        $xslt = 'listetaxons.xsl';
66
        break;
66
        break;
67
    case 'VERNA':
67
    case 'VERNA':
68
        $xml  = 'donnelistenomsvernaculaires.php';
68
        $xml  = 'donnelistenomsvernaculaires.php';
69
        $xslt = 'listenomsvernaculaires.xsl';
69
        $xslt = 'listenomsvernaculaires.xsl';
70
        break;
70
        break;
71
}
71
}
72
(isset($_GET['servicexml'])) ? $xml = $_GET['servicexml'] : '';
72
(isset($_GET['servicexml'])) ? $xml = $_GET['servicexml'] : '';
73
(isset($_GET['xslt'])) ? $xslt = $_GET['xslt'] : '';
73
(isset($_GET['xslt'])) ? $xslt = $_GET['xslt'] : '';
74
 
74
 
75
$radical = rawurlencode($radical);
75
$radical = rawurlencode($radical);
76
$param = '?radical='.$radical;
76
$param = '?radical='.$radical;
77
if (!empty($numclass)) $param .= '&numclass='.$numclass;
77
if (!empty($numclass)) $param .= '&numclass='.$numclass;
78
if (!empty($numnom)) $param .= '&numnom='.$numnom;
78
if (!empty($numnom)) $param .= '&numnom='.$numnom;
79
if (!empty($paramxslt)) $param .= '&paramxslt='.$paramxslt;
79
if (!empty($paramxslt)) $param .= '&paramxslt='.$paramxslt;
80
if (!empty($profondeur)) $param .= '&profondeur='.$profondeur;
80
if (!empty($profondeur)) $param .= '&profondeur='.$profondeur;
81
if (!empty($numtaxo)) $param .= '&numtaxo='.$numtaxo;
81
if (!empty($numtaxo)) $param .= '&numtaxo='.$numtaxo;
82
 
82
 
83
if (empty($eFlore_rangtaxomin)) $eFlore_rangtaxomin = '';
83
if (empty($eFlore_rangtaxomin)) $eFlore_rangtaxomin = '';
84
if (empty($eFlore_rangtaxomax)) $eFlore_rangtaxomax = '';
84
if (empty($eFlore_rangtaxomax)) $eFlore_rangtaxomax = '';
85
if (empty($eFlore_nommin)) $eFlore_nommin = '';
85
if (empty($eFlore_nommin)) $eFlore_nommin = '';
86
if (empty($eFlore_nommax)) $eFlore_nommax = '';
86
if (empty($eFlore_nommax)) $eFlore_nommax = '';
87
 
87
 
88
if ($eFlore_rangtaxomin == -1) { $eFlore_rangtaxomin = 0; }
88
if ($eFlore_rangtaxomin == -1) { $eFlore_rangtaxomin = 0; }
89
if ($eFlore_rangtaxomax == -1) { $eFlore_rangtaxomax = 100000000; }
89
if ($eFlore_rangtaxomax == -1) { $eFlore_rangtaxomax = 100000000; }
90
if ($eFlore_nommin == '') { $eFlore_nommin = 'aaaa'; }
90
if ($eFlore_nommin == '') { $eFlore_nommin = 'aaaa'; }
91
if ($eFlore_nommax == '') { $eFlore_nommax = 'zzzz'; }
91
if ($eFlore_nommax == '') { $eFlore_nommax = 'zzzz'; }
92
 
92
 
93
//$chemin_service_XML = "http://test.tela-botanica.org/modules/client/eflore/servicesxml/".$xml.$param;
93
//$chemin_service_XML = "http://test.tela-botanica.org/modules/client/eflore/servicesxml/".$xml.$param;
94
$chemin_service_XML = 'http://eflore.tela-botanica.org/'.$services.$xml.$param;
94
$chemin_service_XML = 'http://eflore.tela-botanica.org/'.$services.$xml.$param;
95
 
95
 
96
//$chemin_service_XML = "http://".$HTTP_HOST."/".EF_PATH_SERVICES.$xml.$param;
96
//$chemin_service_XML = "http://".$HTTP_HOST."/".EF_PATH_SERVICES.$xml.$param;
97
 
97
 
98
$xsl = join('', file(EF_PATH_XSLT.$xslt));
98
$xsl = join('', file(EF_PATH_XSLT.$xslt));
99
$xml = join ('', file($chemin_service_XML));
99
$xml = join ('', file($chemin_service_XML));
100
 
100
 
101
$arguments = array(
101
$arguments = array(
102
     '/_xml' => $xml,
102
     '/_xml' => $xml,
103
     '/_xsl' => $xsl
103
     '/_xsl' => $xsl
104
    );
104
    );
105
 
105
 
106
// Nom du fichier temporaire pdf
106
// Nom du fichier temporaire pdf
107
//include ("php/lib/lib.divers.php") ;
107
//include ("php/lib/lib.divers.php") ;
108
//$tmp_pdf = "eflore_pdf".create_new_random(5) ;
108
//$tmp_pdf = "eflore_pdf".create_new_random(5) ;
109
 
109
 
110
 
110
 
111
// Début pour PHP 4 avec utilisation de Sablotron
111
// Début pour PHP 4 avec utilisation de Sablotron
-
 
112
/*
112
$xh = xslt_create();//Crée un nouvel analyseur XSLT.
113
$xh = xslt_create();//Crée un nouvel analyseur XSLT.
113
xslt_set_encoding($xh,'ISO-8859-1');
114
xslt_set_encoding($xh,'ISO-8859-1');
114
$result = xslt_process($xh,'arg:/_xml', 'arg:/_xsl', NULL, $arguments);
115
$result = xslt_process($xh,'arg:/_xml', 'arg:/_xsl', NULL, $arguments);
-
 
116
*/
115
// Fin pour PHP 4
117
// Fin pour PHP 4
116
 
118
 
117
/*
119
 
118
// Début pour PHP 5
120
// Début pour PHP 5
119
$inputDom = new DomDocument(); //Crée un nouvel analyseur XSLT.
121
$inputDom = new DomDocument(); //Crée un nouvel analyseur XSLT.
120
$inputDom->load($chemin_service_XML);
122
$inputDom->load($chemin_service_XML);
121
 
123
 
122
$xsl = new DomDocument();
124
$xsl = new DomDocument();
123
$xsl->load(EF_PATH_XSLT.$xslt);
125
$xsl->load(EF_PATH_XSLT.$xslt);
124
 
126
 
125
$proc = new xsltprocessor();
127
$proc = new xsltprocessor();
126
$xsl = $proc->importStylesheet($xsl);
128
$xsl = $proc->importStylesheet($xsl);
127
 
129
 
128
$result = $proc->transformToXML($inputDom);
130
$result = $proc->transformToXML($inputDom);
129
// Fin PHP 5
131
// Fin PHP 5
130
*/
132
 
131
$result = ereg_replace ('transformer.php\?', $baseURL, $result) ;
133
$result = ereg_replace ('transformer.php\?', $baseURL, $result) ;
132
//$result = ereg_replace ("pdf.php", $tmp_pdf.".php", $result) ;
134
//$result = ereg_replace ("pdf.php", $tmp_pdf.".php", $result) ;
133
if ($result) {
135
if ($result) {
134
    $res = $result;
136
    $res = $result;
135
    $tab_champ['ESD_RESULTAT'] = 'ok';
137
    $tab_champ['ESD_RESULTAT'] = 'ok';
136
} else {
138
} else {
137
    // Début pour PHP 4 avec utilisation de Sablotron
139
    // Début pour PHP 4 avec utilisation de Sablotron
138
    print 'Message d\'erreur XSLT: ' . xslt_error($xh) .//xslt_error -- Retourne le message d'erreur courant
140
    //print 'Message d\'erreur XSLT: ' . xslt_error($xh) .//xslt_error -- Retourne le message d'erreur courant
139
    print ' avec le code : ' . xslt_errno($xh);//xslt_errno -- Retourne le numéro d'erreur courant
141
    //print ' avec le code : ' . xslt_errno($xh);//xslt_errno -- Retourne le numéro d'erreur courant
140
    // Fin pour PHP 4
142
    // Fin pour PHP 4
141
    $tab_champ['ESD_RESULTAT'] = 'ERREUR';
143
    $tab_champ['ESD_RESULTAT'] = 'ERREUR';
142
}
144
}
143
 
145
 
144
// Début pour PHP 4 avec utilisation de Sablotron
146
// Début pour PHP 4 avec utilisation de Sablotron
-
 
147
/*
145
xslt_free($xh);//Détruit l'analyseur XSLT
148
xslt_free($xh);//Détruit l'analyseur XSLT
-
 
149
*/
146
// Fin pour PHP 4
150
// Fin pour PHP 4
147
 
151
 
148
// Début pour PHP 5
152
// Début pour PHP 5
149
//unset($xsl);//Détruit l'analyseur XSLT
153
unset($xsl);//Détruit l'analyseur XSLT
150
//unset($inputDom);
154
unset($inputDom);
151
// Fin pour PHP 5
155
// Fin pour PHP 5
152
 
156
 
153
//if ($servicexml == "donneidentitestaxons.php") {
157
//if ($servicexml == "donneidentitestaxons.php") {
154
//    $xsl = join('', file(EF_PATH_XSLT.'identitetaxon_pdf.xsl'));
158
//    $xsl = join('', file(EF_PATH_XSLT.'identitetaxon_pdf.xsl'));
155
//    $xml = join ('', file($chemin_service_XML));
159
//    $xml = join ('', file($chemin_service_XML));
156
//    $xh = xslt_create() ;
160
//    $xh = xslt_create() ;
157
//    $arguments = array(
161
//    $arguments = array(
158
//        '/_xml' => $xml,
162
//        '/_xml' => $xml,
159
//        '/_xsl' => $xsl
163
//        '/_xsl' => $xsl
160
//    );
164
//    );
161
//    $result = xslt_process($xh,'arg:/_xml', 'arg:/_xsl', NULL, $arguments) ;
165
//    $result = xslt_process($xh,'arg:/_xml', 'arg:/_xsl', NULL, $arguments) ;
162
//    $result = ereg_replace("&lt;", "<", $result) ;
166
//    $result = ereg_replace("&lt;", "<", $result) ;
163
//    $result = ereg_replace("&gt;", ">" , $result) ;
167
//    $result = ereg_replace("&gt;", ">" , $result) ;
164
//$file_php = fopen("tmp/$tmp_pdf.php","w") ;
168
//$file_php = fopen("tmp/$tmp_pdf.php","w") ;
165
//fputs($file_php, $result) ;
169
//fputs($file_php, $result) ;
166
//    xslt_free($xh) ;
170
//    xslt_free($xh) ;
167
//}
171
//}
168
 
172
 
169
?>
173
?>
170
 
174