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 |
// +------------------------------------------------------------------------------------------------------+
|
|
|
24 |
// CVS : $Id: eflore_serveur.php,v 1.2 2004-12-16 22:07:35 fred Exp $
|
|
|
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
|
|
|
38 |
*@version $Revision: 1.2 $ $Date: 2004-12-16 22:07:35 $
|
|
|
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 |
// +------------------------------------------------------------------------------------------------------+
|
|
|
57 |
$key = $_REQUEST['key'];
|
|
|
58 |
/* Lecture du fichier donnant la carte des services disponibles */
|
|
|
59 |
$fichierServicesMap = fopen(EFSE_FICHIER_MAP,"r");
|
|
|
60 |
while($donnee = fscanf($fichierServicesMap, "%s\t%s\t%s\t%s\t%s\t%s", $keyName, $serviceName, $viewName, $schema, $ratio, $style)) {
|
|
|
61 |
if ($key == $keyName) {
|
|
|
62 |
runService($serviceName,$viewName,$schema,$ratio,$style);
|
|
|
63 |
}
|
|
|
64 |
}
|
|
|
65 |
fclose($fichierServicesMap);
|
|
|
66 |
|
|
|
67 |
// +------------------------------------------------------------------------------------------------------+
|
|
|
68 |
// | LISTE de FONCTIONS |
|
|
|
69 |
// +------------------------------------------------------------------------------------------------------+
|
|
|
70 |
|
|
|
71 |
function runService($serviceName, $viewName, $schema, $ratio, $style)
|
|
|
72 |
{
|
|
|
73 |
$aConn = '';
|
|
|
74 |
$dataBlock = '';
|
|
|
75 |
$aModel = fabriquerModel($serviceName);
|
|
|
76 |
if ($aModel != null) {
|
|
|
77 |
$aModel->construire();
|
|
|
78 |
$dataBlock = $aModel->recupererBlockDeDonnees();
|
|
|
79 |
}
|
|
|
80 |
|
|
|
81 |
$uneVue = fabriquerVue($viewName, $dataBlock);
|
|
|
82 |
if ($uneVue != null) {
|
|
|
83 |
$uneVue->serialiser();
|
|
|
84 |
}
|
|
|
85 |
}
|
|
|
86 |
|
|
|
87 |
function fabriquerModel($modelName)
|
|
|
88 |
{
|
|
|
89 |
require_once EFSE_CHEMIN_MV_MACRO_GROUPE.$modelName.'.php';
|
|
|
90 |
$aConn = donneConnexionBaseDeDonnees();
|
|
|
91 |
$aModel = new $modelName($aConn);
|
|
|
92 |
return $aModel;
|
|
|
93 |
}
|
|
|
94 |
|
|
|
95 |
function fabriquerVue($viewName,$block)
|
|
|
96 |
{
|
|
|
97 |
require_once EFSE_CHEMIN_MV_VUE.$viewName.'.php';
|
|
|
98 |
$uneVue = new $viewName($block);
|
|
|
99 |
return $uneVue;
|
|
|
100 |
}
|
|
|
101 |
|
|
|
102 |
function donneConnexionBaseDeDonnees() {
|
|
|
103 |
if (!$linkid = mysql_connect(EFSE_BDD_SERVEUR, EFSE_BDD_UTILISATEUR, EFSE_BDD_MOT_DE_PASSE)) {
|
|
|
104 |
echo '<ERREUR>';
|
|
|
105 |
echo 'Impossible d\'établir de connexion à'.EFSE_BDD_SERVEUR;
|
|
|
106 |
echo '</ERREUR>';
|
|
|
107 |
exit(0);
|
|
|
108 |
}
|
|
|
109 |
mysql_select_db(EFSE_BDD_NOM, $linkid);
|
|
|
110 |
return $linkid;
|
|
|
111 |
}
|
|
|
112 |
|
|
|
113 |
/* +--Fin du code ----------------------------------------------------------------------------------------+
|
|
|
114 |
*
|
|
|
115 |
* $Log: not supported by cvs2svn $
|
|
|
116 |
* Revision 1.1.1.1 2004/12/16 12:24:36 jpm
|
|
|
117 |
* Importation initiale eFlore v1.1 et serveur.
|
|
|
118 |
*
|
|
|
119 |
*
|
|
|
120 |
* +-- Fin du code ----------------------------------------------------------------------------------------+
|
|
|
121 |
*/
|
27 |
jpm |
122 |
?>
|