Subversion Repositories Sites.obs-saisons.fr

Compare Revisions

Problem with comparison.

Ignore whitespace Rev HEAD → Rev 1

/obs_saisons/SPIP-v1-8-3/modules/cartographie.php
New file
0,0 → 1,293
<?php
 
//vim: set expandtab tabstop=4 shiftwidth=4:
// +-----------------------------------------------------------------------------------------------+
// | PHP version 4.0 |
// +-----------------------------------------------------------------------------------------------+
// | Copyright (c) 1997, 1998, 1999, 2000, 2001 The PHP Group |
// +-----------------------------------------------------------------------------------------------+
// | This source file is subject to version 2.0 of the PHP license, |
// | that is bundled with this package in the file LICENSE, and is |
// | available at through the world-wide-web at |
// | http://www.php.net/license/2_02.txt. |
// | If you did not receive a copy of the PHP license and are unable to |
// | obtain it through the world-wide-web, please send a note to |
// | license@php.net so we can mail you a copy immediately. |
// +-----------------------------------------------------------------------------------------------+
/**
*
*Page permettant l'affichage des informations de cartographie des inscrits
*
*@package cartographie
//Auteur original :
*@author Alexandre GRANIER <alexandre@tela-botanica.org>
//Autres auteurs :
*@copyright Tela-Botanica 2000-2004
*@version 03 mai 2004
// +-----------------------------------------------------------------------------------------------+
//
// $Id: cartographie.php,v 1.6 2005/03/14 09:43:13 alex Exp $
// FICHIER : $RCSfile: cartographie.php,v $
// AUTEUR : $Author: alex $
// VERSION : $Revision: 1.6 $
// DATE : $Date: 2005/03/14 09:43:13 $
*/
include_once 'connect.php';
include_once 'configuration/car_config.inc.php' ;
include_once CAR_CHEMIN_APPLI.'bibliotheque/lib.carto.php' ;
include_once CAR_CHEMIN_APPLI.'bibliotheque/car_cartographie.fonct.php' ;
 
 
//================================================================================================
 
$GLOBALS['car_auth']->start();
 
function afficherContenuCorps () {
 
$image_x = null;
if (isset($_POST['image_x'])) $image_x = $_POST['image_x'];
$image_y = null;
if (isset($_POST['image_y'])) $image_y = $_POST['image_y'];
$historique_cartes = null;
if (isset($_POST['historique_cartes'])) $historique_cartes = $_POST['historique_cartes'];
if (isset($_GET['historique_cartes'])) $historique_cartes = $_GET['historique_cartes'];
$mailer = null;
if (isset($_GET['mailer'])) $mailer = $_GET['mailer'];
$fin = null;
if (isset($_GET['fin'])) $fin = $_GET['fin'];
$sendpwd = null;//utilisé dans liste_inscrit.php
if (isset($_GET['sendpwd'])) $sendpwd = $_GET['sendpwd'];
$select = null;//utilisé dans liste_inscrit.php
if (isset($_POST['select'])) $select = $_POST['select'];
$liste_zone_carte = null;
if (isset($_POST['liste_zone_carte'])) $liste_zone_carte = $_POST['liste_zone_carte'];
//===========================================================================================================
$requete_01 =
"SELECT *,count(cp_id_continent) as nbr".
" FROM ".CAR_ANNUAIRE.", carto_PAYS".
" WHERE ".CAR_CHAMPS_CE_PAYS." = cp_id_pays";
if (defined('SQL_SUPPLEMENTAIRE') && SQL_SUPPLEMENTAIRE != '') {
$requete_01 .= ' AND '.SQL_SUPPLEMENTAIRE.' ';
}
$requete_01 .= " GROUP BY cp_id_continent";
 
$resultat_01 = $GLOBALS['car_db']->query ($requete_01) ;
if (DB::isError($resultat_01)) {
die ($resultat_01->getMessage().'<br />'.$resultat_01->getDebugInfo()) ;
}
$tableau_ad_continent=array();
while ($ligne_01 = $resultat_01->fetchRow(DB_FETCHMODE_OBJECT)) {
$tableau_ad_continent[$ligne_01->CP_ID_Continent] = $ligne_01->nbr;
}
$info_continent['nom_table_zone'] = 'carto_CONTINENT';
$info_continent['nom_chp_id_zone'] = 'CC_ID_Continent';
$info_continent['nom_chp_nom_zone'] = 'CC_Intitule_continent';
$info_continent['nom_chp_rouge'] = 'CC_Couleur_R';
$info_continent['nom_chp_vert'] = 'CC_Couleur_V';
$info_continent['nom_chp_bleu'] = 'CC_Couleur_B';
$info_continent['nom_chp_zone_sup'] = '';
$info_continent['tableau_valeurs_zone'] = $tableau_ad_continent;
//============================================================================================================
$requete_02 = 'SELECT CC_ID_Continent FROM carto_CONTINENT';
$resultat_02 = $GLOBALS['car_db']->query ($requete_02) ;
if (DB::isError($resultat_02)) {
die ($resultat_02->getMessage().'<br />'.$resultat_02->getDebugInfo()) ;
}
while ($ligne_02 = $resultat_02->fetchRow(DB_FETCHMODE_OBJECT)) {
$requete_03 =
'SELECT *, count(cp_id_pays) as nbr '.
' FROM '.CAR_ANNUAIRE.', carto_PAYS'.
' WHERE '.CAR_CHAMPS_CE_PAYS.'= cp_id_pays';
if (defined('SQL_SUPPLEMENTAIRE') && SQL_SUPPLEMENTAIRE != '') {
$requete_03 .= ' AND '.SQL_SUPPLEMENTAIRE.' ';
}
$requete_03 .= ' AND cp_id_continent = "'.$ligne_02->CC_ID_Continent.'"'.
' GROUP BY cp_id_pays';
$resultat_03 = $GLOBALS['car_db']->query ($requete_03) ;
if (DB::isError($resultat_03)) {
die ($resultat_03->getMessage().'<br />'.$resultat_03->getDebugInfo()) ;
}
$tableau_ad_pays = array();
while ($ligne_03 = $resultat_03->fetchRow(DB_FETCHMODE_OBJECT)) {
$tableau_ad_pays[$ligne_03->CP_ID_Pays] = $ligne_03->nbr;
}
$info_pays[$ligne_02->CC_ID_Continent]['nom_table_zone'] = 'carto_PAYS';
$info_pays[$ligne_02->CC_ID_Continent]['nom_chp_id_zone'] = 'CP_ID_Pays';
$info_pays[$ligne_02->CC_ID_Continent]['nom_chp_nom_zone'] = 'CP_Intitule_pays';
$info_pays[$ligne_02->CC_ID_Continent]['nom_chp_rouge'] = 'CP_Couleur_R';
$info_pays[$ligne_02->CC_ID_Continent]['nom_chp_vert'] = 'CP_Couleur_V';
$info_pays[$ligne_02->CC_ID_Continent]['nom_chp_bleu'] = 'CP_Couleur_B';
$info_pays[$ligne_02->CC_ID_Continent]['nom_chp_zone_sup'] = 'CP_ID_Continent';
$info_pays[$ligne_02->CC_ID_Continent]['tableau_valeurs_zone'] = $tableau_ad_pays;
}
//============================================================================================================
$requete_04 = "SELECT * ,count(cd_id_departement) as nbr".
" FROM ".CAR_ANNUAIRE.", carto_DEPARTEMENT".
" WHERE ".CAR_CHAMPS_CE_PAYS." = 'fr'".
" AND ".CAR_CHAMPS_DPT." = cd_id_departement";
if (defined('SQL_SUPPLEMENTAIRE') && SQL_SUPPLEMENTAIRE != '') {
$requete_04 .= ' AND '.SQL_SUPPLEMENTAIRE.' ';
}
$requete_04 .= " GROUP BY cd_id_Departement";
$resultat_04 = $GLOBALS['car_db']->query ($requete_04) ;
if (DB::isError($resultat_04)) {
die('
<H2 style="text-align: center; font-weight: bold; font-size: 26px;">Erreur de requête</H2>'.
'<b>Requete : </b>'.$requete_04.
'<br/><br/><b>Erreur : </b>'.$resultat_04->getMessage());
}
$tableau_ad_dpt_france = array();
while ($ligne_04 = $resultat_04->fetchRow(DB_FETCHMODE_OBJECT)) {
$tableau_ad_dpt_france[$ligne_04->CD_ID_Departement] = $ligne_04->nbr;
}
$info_dpt_france['nom_table_zone'] = 'carto_DEPARTEMENT';
$info_dpt_france['nom_chp_id_zone'] = 'CD_ID_Departement';
$info_dpt_france['nom_chp_nom_zone'] = 'CD_Intitule_departement';
$info_dpt_france['nom_chp_rouge'] = 'CD_Couleur_R';
$info_dpt_france['nom_chp_vert'] = 'CD_Couleur_V';
$info_dpt_france['nom_chp_bleu'] = 'CD_Couleur_B';
$info_dpt_france['nom_chp_zone_sup'] = 'CD_ID_Pays';
$info_dpt_france['tableau_valeurs_zone'] = $tableau_ad_dpt_france;
//============================================================================================================
 
//============================================================================================================
// On cree tout d'abord l'arborescence
$monde = new Carto_Carte ('continent', '', 'Monde', 'monde_masque5c.png', 'monde5c.png', CAR_CHEMIN_APPLI.'fonds/', $info_continent);
$monde->definirCouleurs ('255', '255', '255','255', '250', '130','255', '165', '0','255', '50', '0') ;
// Affichage par defaut
if (CAR_ECHELLE_DEPART) {
if (isset($_REQUEST['historique_cartes'])) {
$monde->historique_cartes = $_REQUEST['historique_cartes'];
} else {
$monde->historique_cartes = CAR_ECHELLE_DEPART;
}
}
else {
$monde->historique_cartes = $historique_cartes;
}
$monde->image_x = $image_x;
$monde->image_y = $image_y;
$monde->liste_zone_carte = $liste_zone_carte;
$monde->url = $GLOBALS['car_url']->getURL();
foreach ($info_pays as $cle => $valeur) {
$requete_05 =
"SELECT CDC_Titre_carte, CDC_ID_Carte, CDC_Carte_fond, CDC_Carte_masque, CDC_ID_Zone_geo_carte".
" FROM carto_DESCRIPTION_CARTE, carto_ACTION ".
" WHERE CA_ID_Zone_geo = '$cle'".
" AND CA_Type_zone = 1".
" AND CA_ID_Carte_destination = CDC_ID_Carte";
$resultat_05 = $GLOBALS['car_db']->query ($requete_05) ;
if (DB::isError($resultat_05)) {
die ($resultat_05->getMessage().'<br />'.$resultat_05->getDebugInfo()) ;
}
$ligne_05 = $resultat_05->fetchRow(DB_FETCHMODE_OBJECT);
if (is_object($ligne_05)) {
$monde->ajouterFils($ligne_05->CDC_ID_Carte, $ligne_05->CDC_ID_Zone_geo_carte, $ligne_05->CDC_Titre_carte,
$ligne_05->CDC_Carte_masque, $ligne_05->CDC_Carte_fond, $valeur);
$monde->fils[$ligne_05->CDC_ID_Carte]->definirCouleurs ('255', '255', '255','255', '250', '130','255', '165', '0','255', '50', '0') ;
}
}
$monde->fils['europe']->ajouterFils('france', 'fr', 'France' ,'france_masque.png', 'france_region.png', $info_dpt_france);
$monde->fils['europe']->fils['france']->definirCouleurs ('255', '255', '255','255', '250', '130','255', '165', '0','255', '50', '0') ;
// Une fois l'arborescence créée on lance la methode donnerFormulaireImage() pour recuperer la carte
// (dans $img). S'il n'y a pas de carte a afficher donnerFormulaireImage() renvoi false. On peut alors recuperer
// le niveau ou on en est grace a $monde->historique (du type continent*namerique*ca).
$res = '';
$img = false;
if ($mailer == 1 || $fin == true) {
$objet_carte = $_SESSION['carte'] ;
$monde = unserialize($objet_carte);}
else {
$img = $monde->donnerFormulaireImage();
}
// On teste donc img
if (!$img ) {
include 'liste_inscrit.php';
return $res;
}
else {
$historique_carte = new Carto_HistoriqueCarte ($monde, '&gt;', 'chemin_carto');
$res .= $historique_carte->afficherHistoriqueCarte();
$res .= "<br />\n" ;
$tab = explode('*',$monde->historique);
$res .= carto_ad_consulterNbreInscrits($tab[(count($tab)-1)]);
$res .= $img;
$res .= '<div class="cliquer2">'.CAR_CLIQUER.'</div>';
$res .= '<div class="couleur">'.CAR_COULEUR.'</div>'."\n";
$res .= '<div class="avertissement_carto" id="d"><h2 class="titre2_cartographie">'.CAR_AVERTISSEMENT_TITRE.' : </h2>';
$res .= '<span class="texte_avertissement">'.CAR_AVERTISSEMENT."</span></div>\n";
return $res;
}
}
 
echo afficherContenuCorps ().'<br /><br />'."\n";
 
if ($GLOBALS['car_auth']->getAuth()) {
// Synchronisation avec l'identification d'origine
if (!PARTICIPANT_EST_ADULTE) {
$requete_participant = mysql_query("select PARTICIPANT_ID from PARTICIPANT where PARTICIPANT_PSEUDO LIKE '".addSlashes($_POST['username'])."' and PARTICIPANT_MOTDEPASSE LIKE '".$_POST['password']."' and PARTICIPANT_EN_ATTENTE=0 and PARTICIPANT_ADULTE=0");
}
else {
$requete_participant = mysql_query("select PARTICIPANT_ID from PARTICIPANT where PARTICIPANT_PSEUDO LIKE '".addSlashes($_POST['username'])."' and PARTICIPANT_MOTDEPASSE LIKE '".$_POST['password']."' and PARTICIPANT_EN_ATTENTE=0 and PARTICIPANT_ADULTE=1");
}
$participant_ligne = mysql_fetch_row($requete_participant);
if ($participant_ligne) {
$_SESSION['participant'] = $participant_ligne[0];
}
if($_GET[act] == 'logout') {
// Synchronisation avec l'identification d'origine
unset($_SESSION['participant']);
// on déconnecte l'utilisateur
$GLOBALS['car_auth']->logout();
echo 'Vous êtes présentement déconnecté. '."\n";
echo loginFunction();
} else {
// on affiche la possibilité de se déconnecter
//echo 'Connecté en tant que '.$GLOBALS['car_auth']->getUsername().'. '."\n";
//echo '<br><a href= "'.$GLOBALS['car_url']->getURL().'&act=logout">Se déconnecter</a><br />'."\n";
}
} else {
// pas identifié, on propose le formulaire d'identification
echo loginFunction();
}
 
?>