94 |
jpm |
1 |
<?php
|
|
|
2 |
/*vim: set expandtab tabstop=4 shiftwidth=4: */
|
|
|
3 |
// +------------------------------------------------------------------------------------------------------+
|
|
|
4 |
// | PHP version 5.0.3 |
|
|
|
5 |
// +------------------------------------------------------------------------------------------------------+
|
|
|
6 |
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
|
|
|
7 |
// +------------------------------------------------------------------------------------------------------+
|
|
|
8 |
// | This file is part of Serveur eRibosome. |
|
|
|
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 : ERIBO
|
|
|
32 |
*
|
|
|
33 |
*@package eRibosome
|
|
|
34 |
*@subpackage Generateur
|
|
|
35 |
//Auteur original :
|
|
|
36 |
*@author Frédéric LEGENS <flegens@free.fr>
|
|
|
37 |
//Autres auteurs :
|
|
|
38 |
*@author Aucun
|
|
|
39 |
*@copyright Tela-Botanica 2000-2004
|
|
|
40 |
*@version $Revision: 1.1 $ $Date: 2005-01-19 15:45:16 $
|
|
|
41 |
// +------------------------------------------------------------------------------------------------------+
|
|
|
42 |
*/
|
|
|
43 |
|
|
|
44 |
// +------------------------------------------------------------------------------------------------------+
|
|
|
45 |
// | ENTETE du PROGRAMME |
|
|
|
46 |
// +------------------------------------------------------------------------------------------------------+
|
|
|
47 |
|
|
|
48 |
require_once '../configuration/eribo_config.php';
|
|
|
49 |
require_once '../configuration/eribo_config_avancee.inc.php';
|
|
|
50 |
|
|
|
51 |
// +------------------------------------------------------------------------------------------------------+
|
|
|
52 |
// | CORPS du PROGRAMME |
|
|
|
53 |
// +------------------------------------------------------------------------------------------------------+
|
|
|
54 |
|
|
|
55 |
if(!empty($_REQUEST['listemacroelements']))
|
|
|
56 |
{
|
|
|
57 |
genererTousMacroElements(EFSE_CHEMIN_GENERATEUR_RACINE.EFSE_CHEMIN_DEF_MACRO);
|
|
|
58 |
//genererTousMacroElements('..\\'.$appConfig['def_macro']);
|
|
|
59 |
}
|
|
|
60 |
|
|
|
61 |
if(!empty($_REQUEST['groupesmacroelements']))
|
|
|
62 |
{
|
|
|
63 |
genererTousGroupesMacroElements(EFSE_CHEMIN_GENERATEUR_RACINE.EFSE_CHEMIN_DEF_MACRO_GROUPE);
|
|
|
64 |
//genererTousGroupesMacroElements('..\\'.$appConfig['def_groupes']);
|
|
|
65 |
}
|
|
|
66 |
|
|
|
67 |
// +------------------------------------------------------------------------------------------------------+
|
|
|
68 |
// | LISTE de FONCTIONS |
|
|
|
69 |
// +------------------------------------------------------------------------------------------------------+
|
|
|
70 |
|
|
|
71 |
function genererTousGroupesMacroElements($chemin)
|
|
|
72 |
{
|
|
|
73 |
$repertoire = openDir($chemin);
|
|
|
74 |
while ($fichier = readDir($repertoire)) {
|
|
|
75 |
if (($fichier != '.') && ($fichier != '..') && ($fichier != 'CVS')) {
|
|
|
76 |
echo '<li>'.$fichier.' début de la génération';
|
|
|
77 |
$res = EFSE_CHEMIN_GENERATEUR_RACINE.EFSE_CHEMIN_MV_MACRO_GROUPE.$fichier.'.php';
|
|
|
78 |
genererFichier(EFSE_CHEMIN_GENE_XSLT.'groupemacroelement.xslt', $chemin.$fichier, $res);
|
|
|
79 |
echo 'Fin de la génération';
|
|
|
80 |
}
|
|
|
81 |
}
|
|
|
82 |
closeDir($repertoire);
|
|
|
83 |
}
|
|
|
84 |
|
|
|
85 |
function genererTousMacroElements($chemin)
|
|
|
86 |
{
|
|
|
87 |
$repertoire = openDir($chemin);
|
|
|
88 |
while ($fichier = readDir($repertoire)) {
|
|
|
89 |
if (($fichier != '.') && ($fichier != '..') && ($fichier != 'CVS')) {
|
|
|
90 |
echo '<li>'.$fichier.' début de la génération';
|
|
|
91 |
$res = EFSE_CHEMIN_GENERATEUR_RACINE.EFSE_CHEMIN_MV_MACRO.$fichier.'.php';
|
|
|
92 |
genererFichier(EFSE_CHEMIN_GENE_XSLT.'macroelement.xslt',$chemin.$fichier,$res);
|
|
|
93 |
echo 'Fin de la génération';
|
|
|
94 |
}
|
|
|
95 |
}
|
|
|
96 |
closeDir($repertoire);
|
|
|
97 |
}
|
|
|
98 |
|
|
|
99 |
function genererFichier($xsltFilePath, $xmlFilePath, $resFilePath)
|
|
|
100 |
{
|
|
|
101 |
$processeur = new XSLTprocessor();
|
|
|
102 |
|
|
|
103 |
$style = new domDocument();
|
|
|
104 |
$style->load($xsltFilePath);
|
|
|
105 |
|
|
|
106 |
$processeur->importStyleSheet($style);
|
|
|
107 |
|
|
|
108 |
$doc = new domDocument();
|
|
|
109 |
|
|
|
110 |
$doc->load($xmlFilePath);
|
|
|
111 |
|
|
|
112 |
$handle = fopen ($resFilePath, 'w');
|
|
|
113 |
fwrite($handle, $processeur->transformToXML($doc));
|
|
|
114 |
fclose($handle);
|
|
|
115 |
}
|
|
|
116 |
|
|
|
117 |
/* +--Fin du code ----------------------------------------------------------------------------------------+
|
|
|
118 |
*
|
|
|
119 |
* $Log: not supported by cvs2svn $
|
|
|
120 |
* Revision 1.5 2005/01/19 15:43:40 jpm
|
|
|
121 |
* Changement de nom des fichiers à appeler.
|
|
|
122 |
*
|
|
|
123 |
* Revision 1.4 2004/12/23 15:45:48 jpm
|
|
|
124 |
* Changement de version de PHP.
|
|
|
125 |
*
|
|
|
126 |
* Revision 1.3 2004/12/23 15:21:48 jpm
|
|
|
127 |
* Mise en conformité convention de codage.
|
|
|
128 |
*
|
|
|
129 |
* Revision 1.2 2004/12/22 23:29:15 fred
|
|
|
130 |
* intégration de la license
|
|
|
131 |
*
|
|
|
132 |
*
|
|
|
133 |
* +-- Fin du code ----------------------------------------------------------------------------------------+
|
|
|
134 |
*/
|
|
|
135 |
?>
|