Subversion Repositories eFlore/Archives.eflore-consultation-v2

Rev

Rev 92 | Blame | Compare with Previous | Last modification | View Log | RSS feed

<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */ 
// +------------------------------------------------------------------------------------------------------+
// | PHP version 5.0                                                                                     |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org)                                         |
// +------------------------------------------------------------------------------------------------------+
// | This file is part of eFlore-Serveur.                                                                 |
// |                                                                                                      |
// | 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                            |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: eribo_serveur.php,v 1.2 2005-01-24 17:42:54 jpm Exp $
/**
* Fichier principal d'eFlore-Serveur
*
* Ce fichier initialise le programme lance la recherche des infos et transfères les données
* à la vue demandée par l'action.
* Abréviation du programme : EFSE
*
*@package eFlore-Serveur
//Auteur original :
*@author        Frédéric LEGENS <flegens@free.fr>
//Autres auteurs :
*@author        Jean-Pascal MILCENT <jpm@tela-botanica.org>
*@copyright     Tela-Botanica 2000-2004
*@version       $Revision: 1.2 $ $Date: 2005-01-24 17:42:54 $
// +------------------------------------------------------------------------------------------------------+
*/

// +------------------------------------------------------------------------------------------------------+
// |                                            ENTETE du PROGRAMME                                       |
// +------------------------------------------------------------------------------------------------------+

require_once 'configuration/eribo_config_avancee.inc.php';
require_once EFSE_FICHIER_CONFIG;
require_once EFSE_CHEMIN_INTERFACE.'eribo_modele.interface.php';
require_once EFSE_CHEMIN_INTERFACE.'eribo_vue.interface.php';
require_once EFSE_CHEMIN_INTERFACE.'eribo_macro_element.interface.php';
require_once EFSE_CHEMIN_CLASSE.'eribo_block.class.php';
require_once EFSE_CHEMIN_CLASSE.'eribo_collection_block.class.php';
require_once EFSE_CHEMIN_CLASSE.'eribo_groupe_macro_element.class.php';
require_once EFSE_CHEMIN_CLASSE.'eribo_macro_element.class.php';

// +------------------------------------------------------------------------------------------------------+
// |                                            CORPS du PROGRAMME                                        |
// +------------------------------------------------------------------------------------------------------+
$cle = $_REQUEST['cle'];
/* Lecture du fichier donnant la carte des services disponibles */
$fichier_services_map = fopen(EFSE_FICHIER_MAP, 'r');
while($donnee = fscanf($fichier_services_map, "%s\t%s\t%s\t%s\t%s\t%s", $cle_nom, $service_nom, $vue_nom, $schema, $ratio, $style)) {
    if ($cle == $cle_nom) {
        lancerService($service_nom, $vue_nom, $schema, $ratio, $style);
    }
}
fclose($fichier_services_map);

// +------------------------------------------------------------------------------------------------------+
// |                                           LISTE de FONCTIONS                                         |
// +------------------------------------------------------------------------------------------------------+

function lancerService($modele_nom, $vue_nom, $schema, $ratio, $style)
{
    $donnees_block = '';
    $un_modele = fabriquerModele($modele_nom);
    if ($un_modele != null) {
        $un_modele->construire();
        $donnees_block = $un_modele->recupererBlockDeDonnees();
    }
    
    $une_vue = fabriquerVue($vue_nom, $donnees_block);
    if ($une_vue != null) {
        $une_vue->serialiser();
    }
}

function fabriquerModele($modele_nom)
{
    require_once EFSE_CHEMIN_MV_MACRO_GROUPE.$modele_nom.'.php';
    $une_connexion = donnerConnexionBaseDeDonnees();
    $un_modele = new $modele_nom($une_connexion);
    return $un_modele;
}

function fabriquerVue($vue_nom, $donnees)
{
    require_once EFSE_CHEMIN_MV_VUE.$vue_nom.'.php';
    $une_vue = new $vue_nom($donnees);
    return $une_vue;
}

function donnerConnexionBaseDeDonnees() {
    if (!$link_id = mysql_connect(EFSE_BDD_SERVEUR, EFSE_BDD_UTILISATEUR, EFSE_BDD_MOT_DE_PASSE)) {
        echo '<ERREUR>';
        echo 'Impossible d\'établir de connexion à'.EFSE_BDD_SERVEUR;
        echo '</ERREUR>';
        exit(0);
    }
    mysql_select_db(EFSE_BDD_NOM, $link_id);
    return $link_id;
}

/* +--Fin du code ----------------------------------------------------------------------------------------+
*
* $Log: not supported by cvs2svn $
* Revision 1.1  2005/01/19 15:24:08  jpm
* Changement de nom.
*
* Revision 1.5  2005/01/19 15:23:43  jpm
* Changement de nom de fichiers.
*
* Revision 1.4  2004/12/22 13:32:33  jpm
* Inclusion des deux fichiers de config.
*
* Revision 1.3  2004/12/21 19:06:59  jpm
* Mise en conformité convention de codage.
*
* Revision 1.2  2004/12/16 22:07:35  fred
* correction du numéro de version de PHP
*
* Revision 1.1.1.1  2004/12/16 12:24:36  jpm
* Importation initiale eFlore v1.1 et serveur.
*
*
* +-- Fin du code ----------------------------------------------------------------------------------------+
*/
?>