Subversion Repositories eFlore/Archives.eflore-consultation-v2

Compare Revisions

Ignore whitespace Rev 93 → Rev 94

/trunk/serveur/generateur/eribo_traducteur.php
New file
0,0 → 1,135
<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */
// +------------------------------------------------------------------------------------------------------+
// | PHP version 5.0.3 |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
// +------------------------------------------------------------------------------------------------------+
// | This file is part of Serveur eRibosome. |
// | |
// | Foobar is free software; you can redistribute it and/or modify |
// | it under the terms of the GNU General Public License as published by |
// | the Free Software Foundation; either version 2 of the License, or |
// | (at your option) any later version. |
// | |
// | Foobar is distributed in the hope that it will be useful, |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
// | GNU General Public License for more details. |
// | |
// | You should have received a copy of the GNU General Public License |
// | along with Foobar; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
//
/**
* Fichier de traduction des définitions en php.
*
* Ce fichier permet de transformer la définition d'un macro-element ou d'un
* groupe de macro-elements en code php.
*
* Abréviation du programme : ERIBO
*
*@package eRibosome
*@subpackage Generateur
//Auteur original :
*@author Frédéric LEGENS <flegens@free.fr>
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.1 $ $Date: 2005-01-19 15:45:16 $
// +------------------------------------------------------------------------------------------------------+
*/
 
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
require_once '../configuration/eribo_config.php';
require_once '../configuration/eribo_config_avancee.inc.php';
 
// +------------------------------------------------------------------------------------------------------+
// | CORPS du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
if(!empty($_REQUEST['listemacroelements']))
{
genererTousMacroElements(EFSE_CHEMIN_GENERATEUR_RACINE.EFSE_CHEMIN_DEF_MACRO);
//genererTousMacroElements('..\\'.$appConfig['def_macro']);
}
 
if(!empty($_REQUEST['groupesmacroelements']))
{
genererTousGroupesMacroElements(EFSE_CHEMIN_GENERATEUR_RACINE.EFSE_CHEMIN_DEF_MACRO_GROUPE);
//genererTousGroupesMacroElements('..\\'.$appConfig['def_groupes']);
}
 
// +------------------------------------------------------------------------------------------------------+
// | LISTE de FONCTIONS |
// +------------------------------------------------------------------------------------------------------+
 
function genererTousGroupesMacroElements($chemin)
{
$repertoire = openDir($chemin);
while ($fichier = readDir($repertoire)) {
if (($fichier != '.') && ($fichier != '..') && ($fichier != 'CVS')) {
echo '<li>'.$fichier.' début de la génération';
$res = EFSE_CHEMIN_GENERATEUR_RACINE.EFSE_CHEMIN_MV_MACRO_GROUPE.$fichier.'.php';
genererFichier(EFSE_CHEMIN_GENE_XSLT.'groupemacroelement.xslt', $chemin.$fichier, $res);
echo 'Fin de la génération';
}
}
closeDir($repertoire);
}
 
function genererTousMacroElements($chemin)
{
$repertoire = openDir($chemin);
while ($fichier = readDir($repertoire)) {
if (($fichier != '.') && ($fichier != '..') && ($fichier != 'CVS')) {
echo '<li>'.$fichier.' début de la génération';
$res = EFSE_CHEMIN_GENERATEUR_RACINE.EFSE_CHEMIN_MV_MACRO.$fichier.'.php';
genererFichier(EFSE_CHEMIN_GENE_XSLT.'macroelement.xslt',$chemin.$fichier,$res);
echo 'Fin de la génération';
}
}
closeDir($repertoire);
}
 
function genererFichier($xsltFilePath, $xmlFilePath, $resFilePath)
{
$processeur = new XSLTprocessor();
$style = new domDocument();
$style->load($xsltFilePath);
$processeur->importStyleSheet($style);
$doc = new domDocument();
$doc->load($xmlFilePath);
$handle = fopen ($resFilePath, 'w');
fwrite($handle, $processeur->transformToXML($doc));
fclose($handle);
}
 
/* +--Fin du code ----------------------------------------------------------------------------------------+
*
* $Log: not supported by cvs2svn $
* Revision 1.5 2005/01/19 15:43:40 jpm
* Changement de nom des fichiers à appeler.
*
* Revision 1.4 2004/12/23 15:45:48 jpm
* Changement de version de PHP.
*
* Revision 1.3 2004/12/23 15:21:48 jpm
* Mise en conformité convention de codage.
*
* Revision 1.2 2004/12/22 23:29:15 fred
* intégration de la license
*
*
* +-- Fin du code ----------------------------------------------------------------------------------------+
*/
?>