Subversion Repositories eFlore/Archives.eflore-consultation-v2

Rev

Rev 27 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
51 fred 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
 
47
    require_once '../configuration/eflore_config.php';
48
    require_once '../configuration/eflore_config_avancee.inc.php';
49
 
50
// +------------------------------------------------------------------------------------------------------+
51
// |                                            CORPS du PROGRAMME                                        |
52
// +------------------------------------------------------------------------------------------------------+
53
 
54
    if(!empty($_REQUEST['listemacroelements']))
55
    {
56
        genererTousMacroElements(EFSE_CHEMIN_GENERATEUR_RACINE.EFSE_CHEMIN_DEF_MACRO);
57
        //genererTousMacroElements('..\\'.$appConfig['def_macro']);
58
    }
59
 
60
    if(!empty($_REQUEST['groupesmacroelements']))
61
    {
62
        genererTousGroupesMacroElements(EFSE_CHEMIN_GENERATEUR_RACINE.EFSE_CHEMIN_DEF_MACRO_GROUPE);
63
        //genererTousGroupesMacroElements('..\\'.$appConfig['def_groupes']);
64
    }
65
 
66
 
67
// +------------------------------------------------------------------------------------------------------+
68
// |                                           LISTE de FONCTIONS                                         |
69
// +------------------------------------------------------------------------------------------------------+
70
 
71
 
72
 
73
function genererTousGroupesMacroElements($chemin)
74
{
75
            $repertoire = openDir($chemin);
76
            while ($fichier = readDir($repertoire))
77
            {
78
                if (($fichier !='.') && ($fichier !='..') && ($fichier!='CVS'))
79
                {
80
                    echo "<li>$fichier début de la génération";
81
                    $res=EFSE_CHEMIN_GENERATEUR_RACINE.EFSE_CHEMIN_MV_MACRO_GROUPE.$fichier.'.php';
82
                    genererFichier('xslt\groupemacroelement.xslt',$chemin.$fichier,$res);
83
                    echo "fin de la génération";
84
                }
85
            }
86
            closeDir($repertoire);
87
}
88
 
89
function genererTousMacroElements($chemin)
90
    {
91
            $repertoire = openDir($chemin);
92
            while ($fichier = readDir($repertoire))
93
            {
94
                if (($fichier !='.') && ($fichier !='..') && ($fichier!='CVS'))
95
                {
96
                    echo "<li>$fichier début de la génération";
97
                    $res=EFSE_CHEMIN_GENERATEUR_RACINE.EFSE_CHEMIN_MV_MACRO.$fichier.'.php';
98
                    genererFichier('xslt\macroelement.xslt',$chemin.$fichier,$res);
99
                    echo "fin de la génération";
100
                }
101
            }
102
            closeDir($repertoire);
103
    }
104
 
105
function genererFichier($xsltFilePath,$xmlFilePath,$resFilePath)
106
{
107
    $processeur = new XSLTprocessor();
108
 
109
    $style = new domDocument();
110
    $style->load($xsltFilePath);
111
 
112
    $processeur->importStyleSheet($style);
113
 
114
    $doc = new domDocument();
115
 
116
    $doc->load($xmlFilePath);
117
 
118
    $handle = fopen ($resFilePath, "w");
119
    fwrite($handle,$processeur->transformToXML($doc));
120
    fclose($handle);
121
}
122
 
123
/* +--Fin du code ----------------------------------------------------------------------------------------+
124
*
125
* $Log: not supported by cvs2svn $
126
*
127
* +-- Fin du code ----------------------------------------------------------------------------------------+
128
*/
27 jpm 129
?>