Subversion Repositories eFlore/Archives.eflore-consultation-v2

Rev

Rev 33 | 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
// +------------------------------------------------------------------------------------------------------+
36 jpm 24
// CVS : $Id: eflore_serveur.php,v 1.3 2004-12-21 19:06:59 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
36 jpm 38
*@version       $Revision: 1.3 $ $Date: 2004-12-21 19:06:59 $
33 fred 39
// +------------------------------------------------------------------------------------------------------+
40
*/
41
 
42
// +------------------------------------------------------------------------------------------------------+
43
// |                                            ENTETE du PROGRAMME                                       |
44
// +------------------------------------------------------------------------------------------------------+
45
 
46
require_once 'configuration/eflore_config.php';
47
require_once EFSE_CHEMIN_INTERFACE.'eflore_model.interface.php';
48
require_once EFSE_CHEMIN_INTERFACE.'eflore_vue.interface.php';
49
require_once EFSE_CHEMIN_INTERFACE.'eflore_macro_element.interface.php';
50
require_once EFSE_CHEMIN_CLASSE.'eflore_block_de_donnees.class.php';
51
require_once EFSE_CHEMIN_CLASSE.'eflore_collection_block_de_donnees.class.php';
52
require_once EFSE_CHEMIN_CLASSE.'eflore_groupe_macro_element.class.php';
53
 
54
// +------------------------------------------------------------------------------------------------------+
55
// |                                            CORPS du PROGRAMME                                        |
56
// +------------------------------------------------------------------------------------------------------+
36 jpm 57
$cle = $_REQUEST['key'];
33 fred 58
/* Lecture du fichier donnant la carte des services disponibles */
36 jpm 59
$fichier_services_map = fopen(EFSE_FICHIER_MAP, 'r');
60
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)) {
61
    if ($cle == $cle_nom) {
62
        lancerService($service_nom, $vue_nom, $schema, $ratio, $style);
33 fred 63
    }
64
}
36 jpm 65
fclose($fichier_services_map);
33 fred 66
 
67
// +------------------------------------------------------------------------------------------------------+
68
// |                                           LISTE de FONCTIONS                                         |
69
// +------------------------------------------------------------------------------------------------------+
70
 
36 jpm 71
function lancerService($service_nom, $vue_nom, $schema, $ratio, $style)
33 fred 72
{
36 jpm 73
    $donnees_block = '';
74
    $un_modele = fabriquerModele($service_nom);
75
    if ($un_modele != null) {
76
        $un_modele->construire();
77
        $donnees_block = $un_modele->recupererBlockDeDonnees();
33 fred 78
    }
79
 
36 jpm 80
    $une_vue = fabriquerVue($vue_nom, $donnees_block);
81
    if ($une_vue != null) {
82
        $une_vue->serialiser();
33 fred 83
    }
84
}
85
 
36 jpm 86
function fabriquerModele($modele_nom)
33 fred 87
{
36 jpm 88
    require_once EFSE_CHEMIN_MV_MACRO_GROUPE.$modele_nom.'.php';
89
    $une_connexion = donnerConnexionBaseDeDonnees();
90
    $un_modele = new $modele_nom($une_connexion);
91
    return $un_modele;
33 fred 92
}
93
 
36 jpm 94
function fabriquerVue($vue_nom, $donnees)
33 fred 95
{
36 jpm 96
    require_once EFSE_CHEMIN_MV_VUE.$vue_nom.'.php';
97
    $une_vue = new $vue_nom($donnees);
98
    return $une_vue;
33 fred 99
}
100
 
36 jpm 101
function donnerConnexionBaseDeDonnees() {
102
    if (!$link_id = mysql_connect(EFSE_BDD_SERVEUR, EFSE_BDD_UTILISATEUR, EFSE_BDD_MOT_DE_PASSE)) {
33 fred 103
        echo '<ERREUR>';
104
        echo 'Impossible d\'établir de connexion à'.EFSE_BDD_SERVEUR;
105
        echo '</ERREUR>';
106
        exit(0);
107
    }
36 jpm 108
    mysql_select_db(EFSE_BDD_NOM, $link_id);
109
    return $link_id;
33 fred 110
}
111
 
112
/* +--Fin du code ----------------------------------------------------------------------------------------+
113
*
114
* $Log: not supported by cvs2svn $
36 jpm 115
* Revision 1.2  2004/12/16 22:07:35  fred
116
* correction du numéro de version de PHP
117
*
33 fred 118
* Revision 1.1.1.1  2004/12/16 12:24:36  jpm
119
* Importation initiale eFlore v1.1 et serveur.
120
*
121
*
122
* +-- Fin du code ----------------------------------------------------------------------------------------+
123
*/
27 jpm 124
?>