Subversion Repositories eFlore/Archives.eflore-consultation-v2

Rev

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

Rev 27 Rev 51
Line 1... Line 1...
1
<?    
1
<?    
-
 
2
/*vim: set expandtab tabstop=4 shiftwidth=4: */ 
-
 
3
// +------------------------------------------------------------------------------------------------------+
-
 
4
// | PHP version 5.0                                                                                     |
-
 
5
// +------------------------------------------------------------------------------------------------------+
-
 
6
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org)                                         |
-
 
7
// +------------------------------------------------------------------------------------------------------+
-
 
8
// | This file is part of eFlore-Serveur.                                                                 |
-
 
9
// |                                                                                                      |
-
 
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                                 |
-
 
12
// | the Free Software Foundation; either version 2 of the License, or                                    |
-
 
13
// | (at your option) any later version.                                                                  |
-
 
14
// |                                                                                                      |
-
 
15
// | Foobar is distributed in the hope that it will be useful,                                            |
-
 
16
// | but WITHOUT ANY WARRANTY; without even the implied warranty of                                       |
-
 
17
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the                                        |
-
 
18
// | GNU General Public License for more details.                                                         |
-
 
19
// |                                                                                                      |
-
 
20
// | You should have received a copy of the GNU General Public License                                    |
-
 
21
// | along with Foobar; if not, write to the Free Software                                                |
-
 
22
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                            |
-
 
23
// +------------------------------------------------------------------------------------------------------+
-
 
24
// 
-
 
25
/**
-
 
26
* Fichier de traduction des définitions en php.
-
 
27
*
-
 
28
* Ce fichier permet de transformer la définition d'un macro-element ou d'un
-
 
29
* groupe de macro-elements en code php.
-
 
30
* 
-
 
31
* Abréviation du programme : EFSE
-
 
32
*
-
 
33
*@package eFlore-Serveur
-
 
34
//Auteur original :
-
 
35
*@author        Frédéric LEGENS <flegens@free.fr>
-
 
36
//Autres auteurs :
-
 
37
*@author        Aucun
-
 
38
*@copyright     Tela-Botanica 2000-2004
-
 
39
*@version       $Revision: 1.2 $ $Date: 2004-12-22 23:29:15 $
-
 
40
// +------------------------------------------------------------------------------------------------------+
-
 
41
*/
-
 
42
 
-
 
43
// +------------------------------------------------------------------------------------------------------+
-
 
44
// |                                            ENTETE du PROGRAMME                                       |
-
 
45
// +------------------------------------------------------------------------------------------------------+
-
 
46
 
2
    require_once '..\\eflore_config.php';
47
    require_once '../configuration/eflore_config.php';
-
 
48
    require_once '../configuration/eflore_config_avancee.inc.php';
-
 
49
    
-
 
50
// +------------------------------------------------------------------------------------------------------+
-
 
51
// |                                            CORPS du PROGRAMME                                        |
-
 
52
// +------------------------------------------------------------------------------------------------------+
-
 
53
 
3
    if(!empty($_REQUEST['listemacroelements']))
54
    if(!empty($_REQUEST['listemacroelements']))
4
    {
55
    {
5
        
-
 
-
 
56
        genererTousMacroElements(EFSE_CHEMIN_GENERATEUR_RACINE.EFSE_CHEMIN_DEF_MACRO); 
6
        genererTousMacroElements('..\\'.$appConfig['def_macro']); 
57
        //genererTousMacroElements('..\\'.$appConfig['def_macro']); 
7
    }
58
    }
8
    
59
    
9
    if(!empty($_REQUEST['groupesmacroelements']))
60
    if(!empty($_REQUEST['groupesmacroelements']))
10
    {
61
    {
11
        
-
 
-
 
62
        genererTousGroupesMacroElements(EFSE_CHEMIN_GENERATEUR_RACINE.EFSE_CHEMIN_DEF_MACRO_GROUPE);
12
        genererTousGroupesMacroElements('..\\'.$appConfig['def_groupes']);
63
        //genererTousGroupesMacroElements('..\\'.$appConfig['def_groupes']);
13
    }
64
    }
-
 
65
    
-
 
66
    
-
 
67
// +------------------------------------------------------------------------------------------------------+
-
 
68
// |                                           LISTE de FONCTIONS                                         |
-
 
69
// +------------------------------------------------------------------------------------------------------+
-
 
70
 
-
 
71
    
14
    
72
    
15
function genererTousGroupesMacroElements($chemin)
73
function genererTousGroupesMacroElements($chemin)
16
{
74
{
17
            global $appConfig;
-
 
18
            $repertoire = openDir($chemin);
75
            $repertoire = openDir($chemin);
19
            while ($fichier = readDir($repertoire))
76
            while ($fichier = readDir($repertoire))
20
            {
77
            {
21
                if (($fichier !='.') && ($fichier !='..'))
78
                if (($fichier !='.') && ($fichier !='..') && ($fichier!='CVS'))
22
                {
79
                {
23
                    echo "<li>$fichier début de la génération";
80
                    echo "<li>$fichier début de la génération";
24
                    $res='..\\'.$appConfig['auto_groupes'].$fichier.'.php';
81
                    $res=EFSE_CHEMIN_GENERATEUR_RACINE.EFSE_CHEMIN_MV_MACRO_GROUPE.$fichier.'.php';
25
                    genererFichier('xslt\groupemacroelement.xslt',$chemin.$fichier,$res);
82
                    genererFichier('xslt\groupemacroelement.xslt',$chemin.$fichier,$res);
26
                    echo "fin de la génération";
83
                    echo "fin de la génération";
27
                }
84
                }
28
            }    
85
            }    
29
            closeDir($repertoire);
86
            closeDir($repertoire);
30
}
87
}
31
    
88
    
32
function genererTousMacroElements($chemin)
89
function genererTousMacroElements($chemin)
33
    {
90
    {
34
            global $appConfig;
-
 
35
            $repertoire = openDir($chemin);
91
            $repertoire = openDir($chemin);
36
            while ($fichier = readDir($repertoire))
92
            while ($fichier = readDir($repertoire))
37
            {
93
            {
38
                if (($fichier !='.') && ($fichier !='..'))
94
                if (($fichier !='.') && ($fichier !='..') && ($fichier!='CVS'))
39
                {
95
                {
40
                    echo "<li>$fichier début de la génération";
96
                    echo "<li>$fichier début de la génération";
41
                    $res='..\\'.$appConfig['auto_macro'].$fichier.'.php';
97
                    $res=EFSE_CHEMIN_GENERATEUR_RACINE.EFSE_CHEMIN_MV_MACRO.$fichier.'.php';
42
                    genererFichier('xslt\macroelement.xslt',$chemin.$fichier,$res);
98
                    genererFichier('xslt\macroelement.xslt',$chemin.$fichier,$res);
43
                    echo "fin de la génération";
99
                    echo "fin de la génération";
44
                }
100
                }
45
            }    
101
            }    
46
            closeDir($repertoire);
102
            closeDir($repertoire);
47
    }
103
    }
48
    
104
    
49
function genererFichier($xsltFilePath,$xmlFilePath,$resFilePath)
105
function genererFichier($xsltFilePath,$xmlFilePath,$resFilePath)
50
{
106
{
51
    $processeur = new XSLTprocessor();
107
    $processeur = new XSLTprocessor();
52
 
108
 
53
    $style = new domDocument();
109
    $style = new domDocument();
54
    $style->load($xsltFilePath);
110
    $style->load($xsltFilePath);
55
 
111
 
56
    $processeur->importStyleSheet($style);
112
    $processeur->importStyleSheet($style);
57
 
113
 
58
    $doc = new domDocument();
114
    $doc = new domDocument();
59
 
115
 
60
    $doc->load($xmlFilePath);
116
    $doc->load($xmlFilePath);
61
 
117
 
62
    $handle = fopen ($resFilePath, "w");
118
    $handle = fopen ($resFilePath, "w");
63
    fwrite($handle,$processeur->transformToXML($doc));
119
    fwrite($handle,$processeur->transformToXML($doc));
64
    fclose($handle);
120
    fclose($handle);
65
}
121
}
66
    
122
 
-
 
123
/* +--Fin du code ----------------------------------------------------------------------------------------+
-
 
124
*
-
 
125
* $Log: not supported by cvs2svn $
-
 
126
*
-
 
127
* +-- Fin du code ----------------------------------------------------------------------------------------+
-
 
128
*/    
67
?>
129
?>
68
130