Subversion Repositories eFlore/Archives.eflore-consultation-v2

Rev

Rev 53 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 53 Rev 58
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 5.0                                                                                     |
4
// | PHP version 5.0.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-Serveur.                                                                 |
8
// | This file is part of eFlore-Serveur.                                                                 |
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
// 
24
// 
25
/**
25
/**
26
* Fichier de traduction des définitions en php.
26
* Fichier de traduction des définitions en php.
27
*
27
*
28
* Ce fichier permet de transformer la définition d'un macro-element ou d'un
28
* Ce fichier permet de transformer la définition d'un macro-element ou d'un
29
* groupe de macro-elements en code php.
29
* groupe de macro-elements en code php.
30
* 
30
* 
31
* Abréviation du programme : EFSE
31
* Abréviation du programme : EFSE
32
*
32
*
33
*@package eFlore-Serveur
33
*@package eFlore-Serveur
34
//Auteur original :
34
//Auteur original :
35
*@author        Frédéric LEGENS <flegens@free.fr>
35
*@author        Frédéric LEGENS <flegens@free.fr>
36
//Autres auteurs :
36
//Autres auteurs :
37
*@author        Aucun
37
*@author        Aucun
38
*@copyright     Tela-Botanica 2000-2004
38
*@copyright     Tela-Botanica 2000-2004
39
*@version       $Revision: 1.3 $ $Date: 2004-12-23 15:21:48 $
39
*@version       $Revision: 1.4 $ $Date: 2004-12-23 15:45:48 $
40
// +------------------------------------------------------------------------------------------------------+
40
// +------------------------------------------------------------------------------------------------------+
41
*/
41
*/
42
 
42
 
43
// +------------------------------------------------------------------------------------------------------+
43
// +------------------------------------------------------------------------------------------------------+
44
// |                                            ENTETE du PROGRAMME                                       |
44
// |                                            ENTETE du PROGRAMME                                       |
45
// +------------------------------------------------------------------------------------------------------+
45
// +------------------------------------------------------------------------------------------------------+
46
 
46
 
47
require_once '../configuration/eflore_config.php';
47
require_once '../configuration/eflore_config.php';
48
require_once '../configuration/eflore_config_avancee.inc.php';
48
require_once '../configuration/eflore_config_avancee.inc.php';
49
 
49
 
50
// +------------------------------------------------------------------------------------------------------+
50
// +------------------------------------------------------------------------------------------------------+
51
// |                                            CORPS du PROGRAMME                                        |
51
// |                                            CORPS du PROGRAMME                                        |
52
// +------------------------------------------------------------------------------------------------------+
52
// +------------------------------------------------------------------------------------------------------+
53
 
53
 
54
if(!empty($_REQUEST['listemacroelements']))
54
if(!empty($_REQUEST['listemacroelements']))
55
{
55
{
56
    genererTousMacroElements(EFSE_CHEMIN_GENERATEUR_RACINE.EFSE_CHEMIN_DEF_MACRO); 
56
    genererTousMacroElements(EFSE_CHEMIN_GENERATEUR_RACINE.EFSE_CHEMIN_DEF_MACRO); 
57
    //genererTousMacroElements('..\\'.$appConfig['def_macro']); 
57
    //genererTousMacroElements('..\\'.$appConfig['def_macro']); 
58
}
58
}
59
 
59
 
60
if(!empty($_REQUEST['groupesmacroelements']))
60
if(!empty($_REQUEST['groupesmacroelements']))
61
{
61
{
62
    genererTousGroupesMacroElements(EFSE_CHEMIN_GENERATEUR_RACINE.EFSE_CHEMIN_DEF_MACRO_GROUPE);
62
    genererTousGroupesMacroElements(EFSE_CHEMIN_GENERATEUR_RACINE.EFSE_CHEMIN_DEF_MACRO_GROUPE);
63
    //genererTousGroupesMacroElements('..\\'.$appConfig['def_groupes']);
63
    //genererTousGroupesMacroElements('..\\'.$appConfig['def_groupes']);
64
}
64
}
65
 
65
 
66
// +------------------------------------------------------------------------------------------------------+
66
// +------------------------------------------------------------------------------------------------------+
67
// |                                           LISTE de FONCTIONS                                         |
67
// |                                           LISTE de FONCTIONS                                         |
68
// +------------------------------------------------------------------------------------------------------+
68
// +------------------------------------------------------------------------------------------------------+
69
 
69
 
70
function genererTousGroupesMacroElements($chemin)
70
function genererTousGroupesMacroElements($chemin)
71
{
71
{
72
    $repertoire = openDir($chemin);
72
    $repertoire = openDir($chemin);
73
    while ($fichier = readDir($repertoire)) {
73
    while ($fichier = readDir($repertoire)) {
74
        if (($fichier != '.') && ($fichier != '..') && ($fichier != 'CVS')) {
74
        if (($fichier != '.') && ($fichier != '..') && ($fichier != 'CVS')) {
75
            echo '<li>'.$fichier.' début de la génération';
75
            echo '<li>'.$fichier.' début de la génération';
76
            $res = EFSE_CHEMIN_GENERATEUR_RACINE.EFSE_CHEMIN_MV_MACRO_GROUPE.$fichier.'.php';
76
            $res = EFSE_CHEMIN_GENERATEUR_RACINE.EFSE_CHEMIN_MV_MACRO_GROUPE.$fichier.'.php';
77
            genererFichier(EFSE_CHEMIN_GENE_XSLT.'groupemacroelement.xslt', $chemin.$fichier, $res);
77
            genererFichier(EFSE_CHEMIN_GENE_XSLT.'groupemacroelement.xslt', $chemin.$fichier, $res);
78
            echo 'Fin de la génération';
78
            echo 'Fin de la génération';
79
        }
79
        }
80
    }
80
    }
81
    closeDir($repertoire);
81
    closeDir($repertoire);
82
}
82
}
83
 
83
 
84
function genererTousMacroElements($chemin)
84
function genererTousMacroElements($chemin)
85
{
85
{
86
    $repertoire = openDir($chemin);
86
    $repertoire = openDir($chemin);
87
    while ($fichier = readDir($repertoire)) {
87
    while ($fichier = readDir($repertoire)) {
88
        if (($fichier != '.') && ($fichier != '..') && ($fichier != 'CVS')) {
88
        if (($fichier != '.') && ($fichier != '..') && ($fichier != 'CVS')) {
89
            echo '<li>'.$fichier.' début de la génération';
89
            echo '<li>'.$fichier.' début de la génération';
90
            $res = EFSE_CHEMIN_GENERATEUR_RACINE.EFSE_CHEMIN_MV_MACRO.$fichier.'.php';
90
            $res = EFSE_CHEMIN_GENERATEUR_RACINE.EFSE_CHEMIN_MV_MACRO.$fichier.'.php';
91
            genererFichier(EFSE_CHEMIN_GENE_XSLT.'macroelement.xslt',$chemin.$fichier,$res);
91
            genererFichier(EFSE_CHEMIN_GENE_XSLT.'macroelement.xslt',$chemin.$fichier,$res);
92
            echo 'Fin de la génération';
92
            echo 'Fin de la génération';
93
        }
93
        }
94
    }
94
    }
95
    closeDir($repertoire);
95
    closeDir($repertoire);
96
}
96
}
97
 
97
 
98
function genererFichier($xsltFilePath, $xmlFilePath, $resFilePath)
98
function genererFichier($xsltFilePath, $xmlFilePath, $resFilePath)
99
{
99
{
100
    $processeur = new XSLTprocessor();
100
    $processeur = new XSLTprocessor();
101
    
101
    
102
    $style = new domDocument();
102
    $style = new domDocument();
103
    $style->load($xsltFilePath);
103
    $style->load($xsltFilePath);
104
    
104
    
105
    $processeur->importStyleSheet($style);
105
    $processeur->importStyleSheet($style);
106
    
106
    
107
    $doc = new domDocument();
107
    $doc = new domDocument();
108
    
108
    
109
    $doc->load($xmlFilePath);
109
    $doc->load($xmlFilePath);
110
    
110
    
111
    $handle = fopen ($resFilePath, 'w');
111
    $handle = fopen ($resFilePath, 'w');
112
    fwrite($handle, $processeur->transformToXML($doc));
112
    fwrite($handle, $processeur->transformToXML($doc));
113
    fclose($handle);
113
    fclose($handle);
114
}
114
}
115
 
115
 
116
/* +--Fin du code ----------------------------------------------------------------------------------------+
116
/* +--Fin du code ----------------------------------------------------------------------------------------+
117
*
117
*
118
* $Log: not supported by cvs2svn $
118
* $Log: not supported by cvs2svn $
-
 
119
* Revision 1.3  2004/12/23 15:21:48  jpm
-
 
120
* Mise en conformité convention de codage.
-
 
121
*
119
* Revision 1.2  2004/12/22 23:29:15  fred
122
* Revision 1.2  2004/12/22 23:29:15  fred
120
* intégration de la license
123
* intégration de la license
121
*
124
*
122
*
125
*
123
* +-- Fin du code ----------------------------------------------------------------------------------------+
126
* +-- Fin du code ----------------------------------------------------------------------------------------+
124
*/
127
*/
125
?>
128
?>