Subversion Repositories eFlore/Archives.eflore-consultation-v2

Compare Revisions

Ignore whitespace Rev 27 → Rev 33

/trunk/serveur/eflore_serveur.php
1,119 → 1,122
<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */
// +------------------------------------------------------------------------------------------------------+
// | PHP version 4.1 |
// +------------------------------------------------------------------------------------------------------+
// | 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: eflore_serveur.php,v 1.1.1.1 2004-12-16 12:24:36 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.1.1.1 $ $Date: 2004-12-16 12:24:36 $
// +------------------------------------------------------------------------------------------------------+
*/
 
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
require_once 'configuration/eflore_config.php';
require_once EFSE_CHEMIN_INTERFACE.'eflore_model.interface.php';
require_once EFSE_CHEMIN_INTERFACE.'eflore_vue.interface.php';
require_once EFSE_CHEMIN_INTERFACE.'eflore_macro_element.interface.php';
require_once EFSE_CHEMIN_CLASSE.'eflore_block_de_donnees.class.php';
require_once EFSE_CHEMIN_CLASSE.'eflore_collection_block_de_donnees.class.php';
require_once EFSE_CHEMIN_CLASSE.'eflore_groupe_macro_element.class.php';
 
// +------------------------------------------------------------------------------------------------------+
// | CORPS du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
$key = $_REQUEST['key'];
/* Lecture du fichier donnant la carte des services disponibles */
$fichierServicesMap = fopen(EFSE_FICHIER_MAP,"r");
while($donnee = fscanf($fichierServicesMap, "%s\t%s\t%s\t%s\t%s\t%s", $keyName, $serviceName, $viewName, $schema, $ratio, $style)) {
if ($key == $keyName) {
runService($serviceName,$viewName,$schema,$ratio,$style);
}
}
fclose($fichierServicesMap);
 
// +------------------------------------------------------------------------------------------------------+
// | LISTE de FONCTIONS |
// +------------------------------------------------------------------------------------------------------+
 
function runService($serviceName, $viewName, $schema, $ratio, $style)
{
$aConn = '';
$dataBlock = '';
$aModel = fabriquerModel($serviceName);
if ($aModel != null) {
$aModel->construire();
$dataBlock = $aModel->recupererBlockDeDonnees();
}
$uneVue = fabriquerVue($viewName, $dataBlock);
if ($uneVue != null) {
$uneVue->serialiser();
}
}
 
function fabriquerModel($modelName)
{
require_once EFSE_CHEMIN_MV_MACRO_GROUPE.$modelName.'.php';
$aConn = donneConnexionBaseDeDonnees();
$aModel = new $modelName($aConn);
return $aModel;
}
 
function fabriquerVue($viewName,$block)
{
require_once EFSE_CHEMIN_MV_VUE.$viewName.'.php';
$uneVue = new $viewName($block);
return $uneVue;
}
 
function donneConnexionBaseDeDonnees() {
if (!$linkid = 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, $linkid);
return $linkid;
}
 
/* +--Fin du code ----------------------------------------------------------------------------------------+
*
* $Log: not supported by cvs2svn $
*
* +-- Fin du code ----------------------------------------------------------------------------------------+
*/
<?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: eflore_serveur.php,v 1.2 2004-12-16 22:07:35 fred 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: 2004-12-16 22:07:35 $
// +------------------------------------------------------------------------------------------------------+
*/
 
// +------------------------------------------------------------------------------------------------------+
// | ENTETE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
require_once 'configuration/eflore_config.php';
require_once EFSE_CHEMIN_INTERFACE.'eflore_model.interface.php';
require_once EFSE_CHEMIN_INTERFACE.'eflore_vue.interface.php';
require_once EFSE_CHEMIN_INTERFACE.'eflore_macro_element.interface.php';
require_once EFSE_CHEMIN_CLASSE.'eflore_block_de_donnees.class.php';
require_once EFSE_CHEMIN_CLASSE.'eflore_collection_block_de_donnees.class.php';
require_once EFSE_CHEMIN_CLASSE.'eflore_groupe_macro_element.class.php';
 
// +------------------------------------------------------------------------------------------------------+
// | CORPS du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
$key = $_REQUEST['key'];
/* Lecture du fichier donnant la carte des services disponibles */
$fichierServicesMap = fopen(EFSE_FICHIER_MAP,"r");
while($donnee = fscanf($fichierServicesMap, "%s\t%s\t%s\t%s\t%s\t%s", $keyName, $serviceName, $viewName, $schema, $ratio, $style)) {
if ($key == $keyName) {
runService($serviceName,$viewName,$schema,$ratio,$style);
}
}
fclose($fichierServicesMap);
 
// +------------------------------------------------------------------------------------------------------+
// | LISTE de FONCTIONS |
// +------------------------------------------------------------------------------------------------------+
 
function runService($serviceName, $viewName, $schema, $ratio, $style)
{
$aConn = '';
$dataBlock = '';
$aModel = fabriquerModel($serviceName);
if ($aModel != null) {
$aModel->construire();
$dataBlock = $aModel->recupererBlockDeDonnees();
}
$uneVue = fabriquerVue($viewName, $dataBlock);
if ($uneVue != null) {
$uneVue->serialiser();
}
}
 
function fabriquerModel($modelName)
{
require_once EFSE_CHEMIN_MV_MACRO_GROUPE.$modelName.'.php';
$aConn = donneConnexionBaseDeDonnees();
$aModel = new $modelName($aConn);
return $aModel;
}
 
function fabriquerVue($viewName,$block)
{
require_once EFSE_CHEMIN_MV_VUE.$viewName.'.php';
$uneVue = new $viewName($block);
return $uneVue;
}
 
function donneConnexionBaseDeDonnees() {
if (!$linkid = 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, $linkid);
return $linkid;
}
 
/* +--Fin du code ----------------------------------------------------------------------------------------+
*
* $Log: not supported by cvs2svn $
* Revision 1.1.1.1 2004/12/16 12:24:36 jpm
* Importation initiale eFlore v1.1 et serveur.
*
*
* +-- Fin du code ----------------------------------------------------------------------------------------+
*/
?>