Subversion Repositories Sites.tela-botanica.org

Rev

Rev 177 | Go to most recent revision | Blame | Last modification | View Log | RSS feed

<?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: car_cartographie.fonct.php,v 1.4 2005/03/11 17:27:23 alex Exp $
// FICHIER : $RCSfile: car_cartographie.fonct.php,v $
// AUTEUR    : $Author: alex $
// VERSION : $Revision: 1.4 $
// DATE        : $Date: 2005/03/11 17:27:23 $
*/

/** function carto_texte_cocher ()
*
*
*       @return string  HTML
*/

function carto_texte_cocher () {
    $res = "<div class=\"cocher\">".CAR_CHECK_UNCHECK ;
    $res .= "&nbsp;<input type=\"checkbox\" name=\"selecttotal\" onclick=\"javascript:setCheckboxes('formmail');\" /></div>";
    return $res ;
}
/** function carto_formulaire ()
*
*
*
*       @return string  HTML
*/
function carto_formulaire ($titre_mail="", $corps = "") {
    $res = '<p class="attention surveillance">'.CAR_SURVEILLANCE.'</p>' ;
    $res .= '<p class="information message_a_tous">'.sprintf(CAR_MESSAGE_A_TOUS, '<a href="http://www.tela-botanica.org/">'.CAR_ACTUALITE.'</a>').'</p>' ;
    $res .= "<h2 class=\"titre2_cartographie\">".CAR_ENVOYER_MAIL."</h2> \n";
    $res .= "<table id=\"formulaire_mail\" border=\"0\">\n
                    <tr><td class=\"texte\">".CAR_SUJET." :</td>\n
                        <td><input class=\"forml\" type=\"text\" name=\"titre_mail\" size=\"60\" value=\"$titre_mail\" /></td>\n
                    </tr>\n<tr><td class=\"texte\" valign=\"top\">".CAR_MESSAGE."&nbsp;:&nbsp;</td>\n
                        <td><textarea class=\"forml\" name=\"corps\" rows=\"5\" cols=\"60\">$corps</textarea></td>\n
                    </tr>\n<tr><td></td>\n<td>";
    if (ereg ('Gecko',$GLOBALS['HTTP_USER_AGENT'])) {
        $res.="<input class=\"spip_bouton\" type=\"submit\" value=\"".CAR_ENVOYER."\" />";
    } else {
        $res.="<input class=\"spip_bouton\" type=\"submit\" onclick=\"javascript:confirmer();\" value=\"".CAR_ENVOYER."\" />";
    }
    $res.="</td>\n</tr>\n</table></form>\n";
    return $res ;
}

/**
 *  La fonction carto_getNbInscrits renvoit une phrase complete indiquant le 
 *  nombre d'inscrits dans zone passee en argument
 *  @param  string  identifiant de carte ex: europe
 * @return string
 */

function carto_ad_consulterNbreInscrits ($id_carte)
{
    global $NOM_FICHIER;
    
    $titre_carte = carto_consulterTitreCarte($id_carte);
    $type_zone_carte = carto_consulterTypeZoneCarte ($id_carte);
    
    switch ($type_zone_carte){
        case '0' :
            $requete =
                    ' SELECT count(u_id) as nbr'.
                    ' FROM annuaire_tela'.
                    ' WHERE u_french_dpt <> 999';
                break;
        
        case '1' :
            $requete =
                    ' SELECT count(u_id) as nbr'.
                    ' FROM annuaire_tela, carto_PAYS'.
                    ' WHERE u_country = cp_id_pays'.
                    ' AND cp_id_continent = "'.carto_consulterIdZoneGeoCarte ($id_carte).'"';
                break;
        
        case '2' :
            $requete = 
                    ' SELECT count(u_id) as nbr'.
                    ' FROM annuaire_tela'.
                    ' WHERE u_french_dpt != "999"'.
                    ' AND u_country = "fr"';
                break;
    }
    
    $resultat = mysql_query($requete) or die('
            <H2 style="text-align: center; font-weight: bold; font-size: 26px;">Erreur de requête</H2>'.
            '<b>Nom du fichier : </b> '.$NOM_FICHIER.'<br/>'.
            '<b>Nom fonction : </b> carto_ad_consulterNbreInscrits<br/>'.
            '<b>Requete : </b>'.$requete.
            '<br/><br/><b>Erreur : </b>'.mysql_error());
    
    $ligne = mysql_fetch_object ($resultat) ;
    $res = '<h1 class="titre1_cartographie">'.$titre_carte.' : ' ;
    if ($ligne->nbr == 0) {
        $res .= 'aucun inscrit' ;
    }
    else if ($ligne->nbr == 1) {
        $res .= $ligne->nbr.' inscrit' ;
    }
    else {
        $res .= $ligne->nbr.' inscrits ';
    }
    return $res.' &agrave; Tela Botanica</h1>' ;
}

/**
 *  Envoie un email à tous les adhérents sélectionnés
 *
 * @return  string  Renvoie le message 'votre message a été envoyé'
 */

function envoie_mail (&$db) {
    $res = "<h1 class=\"titre1_cartographie\">Votre message a &eacute;t&eacute; envoy&eacute;</div>\n" ;
    $requete = "select ".CAR_CHAMPS_MAIL." from ".CAR_ANNUAIRE.
            " where ".CAR_CHAMPS_ID."='".$GLOBALS['car_auth']->getAuthData (CAR_CHAMPS_ID)."'";
    $resultat = $db->query($requete);
    if (DB::isError($resultat)) {
        die ($resultat->getMessage().'<br />'.$resultat->getDebugInfo());
    }
    $ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC);
    $entete = "From: <".$ligne[CAR_CHAMPS_MAIL].">\n";
    
    $_POST['corps'] .= CAR_TEXTE_FIN_MAIL;
    $_POST['corps'] = stripslashes($_POST['corps']) ;
    $liste = "" ;
    foreach ($_POST['select'] as $key => $value) {
        mail ($value, stripslashes($_POST['titre_mail']), $_POST['corps'], $entete) ;
        $liste .= $value."\n" ;
    }
    
    $_POST['corps'] .= "\n----------------------------------------------------------------------------";
    $_POST['corps'] .= "\nCe message a été envoyé à :\n $liste" ;
    
    mail ("carto@tela-botanica.org", stripslashes($_POST['titre_mail']), $_POST['corps'], $entete);
    $_POST['corps']='';
    $_POST['titre_mail']='';
    return $res ;
}

//-- Fin du code source    ------------------------------------------------------------
/*
* $Log: car_cartographie.fonct.php,v $
* Revision 1.4  2005/03/11 17:27:23  alex
* modification html
*
* Revision 1.3  2005/03/11 17:24:39  alex
* modification html
*
* Revision 1.2  2005/03/11 15:18:45  alex
* migration version 4
*
* Revision 1.1  2004/11/30 13:37:19  tam
* installation
*
* Revision 1.1.1.1  2004/11/23 17:48:17  tam
* Importation
*
* Revision 1.1  2004/11/23 17:30:13  tam
* installation
*
*
*/
?>