Subversion Repositories eFlore/Archives.eflore-consultation-v2

Rev

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

Rev Author Line No. Line
33 fred 1
<?php
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
// +------------------------------------------------------------------------------------------------------+
91 jpm 24
// CVS : $Id: eflore_serveur.php,v 1.5 2005-01-19 15:23:43 jpm Exp $
33 fred 25
/**
26
* Fichier principal d'eFlore-Serveur
27
*
28
* Ce fichier initialise le programme lance la recherche des infos et transfères les données
29
* à la vue demandée par l'action.
30
* Abréviation du programme : EFSE
31
*
32
*@package eFlore-Serveur
33
//Auteur original :
34
*@author        Frédéric LEGENS <flegens@free.fr>
35
//Autres auteurs :
36
*@author        Jean-Pascal MILCENT <jpm@tela-botanica.org>
37
*@copyright     Tela-Botanica 2000-2004
91 jpm 38
*@version       $Revision: 1.5 $ $Date: 2005-01-19 15:23:43 $
33 fred 39
// +------------------------------------------------------------------------------------------------------+
40
*/
41
 
42
// +------------------------------------------------------------------------------------------------------+
43
// |                                            ENTETE du PROGRAMME                                       |
44
// +------------------------------------------------------------------------------------------------------+
45
 
91 jpm 46
require_once 'configuration/eribo_config_avancee.inc.php';
48 jpm 47
require_once EFSE_FICHIER_CONFIG;
91 jpm 48
require_once EFSE_CHEMIN_INTERFACE.'eribo_modele.interface.php';
49
require_once EFSE_CHEMIN_INTERFACE.'eribo_vue.interface.php';
50
require_once EFSE_CHEMIN_INTERFACE.'eribo_macro_element.interface.php';
51
require_once EFSE_CHEMIN_CLASSE.'eribo_block.class.php';
52
require_once EFSE_CHEMIN_CLASSE.'eribo_collection_block.class.php';
53
require_once EFSE_CHEMIN_CLASSE.'eribo_groupe_macro_element.class.php';
54
require_once EFSE_CHEMIN_CLASSE.'eribo_macro_element.class.php';
33 fred 55
 
56
// +------------------------------------------------------------------------------------------------------+
57
// |                                            CORPS du PROGRAMME                                        |
58
// +------------------------------------------------------------------------------------------------------+
36 jpm 59
$cle = $_REQUEST['key'];
33 fred 60
/* Lecture du fichier donnant la carte des services disponibles */
36 jpm 61
$fichier_services_map = fopen(EFSE_FICHIER_MAP, 'r');
62
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)) {
63
    if ($cle == $cle_nom) {
64
        lancerService($service_nom, $vue_nom, $schema, $ratio, $style);
33 fred 65
    }
66
}
36 jpm 67
fclose($fichier_services_map);
33 fred 68
 
69
// +------------------------------------------------------------------------------------------------------+
70
// |                                           LISTE de FONCTIONS                                         |
71
// +------------------------------------------------------------------------------------------------------+
72
 
91 jpm 73
function lancerService($modele_nom, $vue_nom, $schema, $ratio, $style)
33 fred 74
{
36 jpm 75
    $donnees_block = '';
91 jpm 76
    $un_modele = fabriquerModele($modele_nom);
36 jpm 77
    if ($un_modele != null) {
78
        $un_modele->construire();
79
        $donnees_block = $un_modele->recupererBlockDeDonnees();
33 fred 80
    }
81
 
36 jpm 82
    $une_vue = fabriquerVue($vue_nom, $donnees_block);
83
    if ($une_vue != null) {
84
        $une_vue->serialiser();
33 fred 85
    }
86
}
87
 
36 jpm 88
function fabriquerModele($modele_nom)
33 fred 89
{
36 jpm 90
    require_once EFSE_CHEMIN_MV_MACRO_GROUPE.$modele_nom.'.php';
91
    $une_connexion = donnerConnexionBaseDeDonnees();
92
    $un_modele = new $modele_nom($une_connexion);
93
    return $un_modele;
33 fred 94
}
95
 
36 jpm 96
function fabriquerVue($vue_nom, $donnees)
33 fred 97
{
36 jpm 98
    require_once EFSE_CHEMIN_MV_VUE.$vue_nom.'.php';
99
    $une_vue = new $vue_nom($donnees);
100
    return $une_vue;
33 fred 101
}
102
 
36 jpm 103
function donnerConnexionBaseDeDonnees() {
104
    if (!$link_id = mysql_connect(EFSE_BDD_SERVEUR, EFSE_BDD_UTILISATEUR, EFSE_BDD_MOT_DE_PASSE)) {
33 fred 105
        echo '<ERREUR>';
106
        echo 'Impossible d\'établir de connexion à'.EFSE_BDD_SERVEUR;
107
        echo '</ERREUR>';
108
        exit(0);
109
    }
36 jpm 110
    mysql_select_db(EFSE_BDD_NOM, $link_id);
111
    return $link_id;
33 fred 112
}
113
 
114
/* +--Fin du code ----------------------------------------------------------------------------------------+
115
*
116
* $Log: not supported by cvs2svn $
91 jpm 117
* Revision 1.4  2004/12/22 13:32:33  jpm
118
* Inclusion des deux fichiers de config.
119
*
48 jpm 120
* Revision 1.3  2004/12/21 19:06:59  jpm
121
* Mise en conformité convention de codage.
122
*
36 jpm 123
* Revision 1.2  2004/12/16 22:07:35  fred
124
* correction du numéro de version de PHP
125
*
33 fred 126
* Revision 1.1.1.1  2004/12/16 12:24:36  jpm
127
* Importation initiale eFlore v1.1 et serveur.
128
*
129
*
130
* +-- Fin du code ----------------------------------------------------------------------------------------+
131
*/
27 jpm 132
?>