Subversion Repositories Sites.tela-botanica.org

Rev

Rev 180 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
87 alex 1
<?php
2
 
3
//vim: set expandtab tabstop=4 shiftwidth=4:
4
// +-----------------------------------------------------------------------------------------------+
5
// | PHP version 4.0                                                                               |
6
// +-----------------------------------------------------------------------------------------------+
7
// | Copyright (c) 1997, 1998, 1999, 2000, 2001 The PHP Group                                      |
8
// +-----------------------------------------------------------------------------------------------+
9
// | This source file is subject to version 2.0 of the PHP license,                                |
10
// | that is bundled with this package in the file LICENSE, and is                                 |
11
// | available at through the world-wide-web at                                                    |
12
// | http://www.php.net/license/2_02.txt.                                                          |
13
// | If you did not receive a copy of the PHP license and are unable to                            |
14
// | obtain it through the world-wide-web, please send a note to                                   |
15
// | license@php.net so we can mail you a copy immediately.                                        |
16
// +-----------------------------------------------------------------------------------------------+
17
/**
18
*
19
*Page permettant l'affichage des informations de cartographie des inscrits
20
*
21
*@package cartographie
22
//Auteur original :
23
*@author                Alexandre GRANIER <alexandre@tela-botanica.org>
24
//Autres auteurs :
25
*@copyright         Tela-Botanica 2000-2004
26
*@version             03 mai 2004
27
// +-----------------------------------------------------------------------------------------------+
28
//
29
// $Id: car_cartographie.fonct.php,v 1.4 2005/03/11 17:27:23 alex Exp $
30
// FICHIER : $RCSfile: car_cartographie.fonct.php,v $
31
// AUTEUR    : $Author: alex $
32
// VERSION : $Revision: 1.4 $
33
// DATE        : $Date: 2005/03/11 17:27:23 $
34
*/
35
 
36
/** function carto_texte_cocher ()
37
*
38
*
39
*	@return string  HTML
40
*/
41
 
42
function carto_texte_cocher () {
43
    $res = "<div class=\"cocher\">".CAR_CHECK_UNCHECK ;
44
    $res .= "&nbsp;<input type=\"checkbox\" name=\"selecttotal\" onclick=\"javascript:setCheckboxes('formmail');\" /></div>";
45
    return $res ;
46
}
47
/** function carto_formulaire ()
48
*
49
*
50
*
51
*	@return string  HTML
52
*/
53
function carto_formulaire ($titre_mail="", $corps = "") {
179 jpm 54
    $res = '<p class="attention surveillance">'.CAR_SURVEILLANCE.'</p>' ;
180 jpm 55
    $res .= '<p class="information message_a_tous">'.sprintf(CAR_MESSAGE_A_TOUS, '<a href="'.CAR_URL_ACTUALITE.'">'.CAR_ACTUALITE.'</a>').'</p>' ;
87 alex 56
    $res .= "<h2 class=\"titre2_cartographie\">".CAR_ENVOYER_MAIL."</h2> \n";
57
    $res .= "<table id=\"formulaire_mail\" border=\"0\">\n
58
                    <tr><td class=\"texte\">".CAR_SUJET." :</td>\n
59
                        <td><input class=\"forml\" type=\"text\" name=\"titre_mail\" size=\"60\" value=\"$titre_mail\" /></td>\n
60
                    </tr>\n<tr><td class=\"texte\" valign=\"top\">".CAR_MESSAGE."&nbsp;:&nbsp;</td>\n
61
                        <td><textarea class=\"forml\" name=\"corps\" rows=\"5\" cols=\"60\">$corps</textarea></td>\n
62
                    </tr>\n<tr><td></td>\n<td>";
63
    if (ereg ('Gecko',$GLOBALS['HTTP_USER_AGENT'])) {
64
        $res.="<input class=\"spip_bouton\" type=\"submit\" value=\"".CAR_ENVOYER."\" />";
65
    } else {
66
        $res.="<input class=\"spip_bouton\" type=\"submit\" onclick=\"javascript:confirmer();\" value=\"".CAR_ENVOYER."\" />";
67
    }
68
    $res.="</td>\n</tr>\n</table></form>\n";
69
    return $res ;
70
}
71
 
72
/**
73
 *  La fonction carto_getNbInscrits renvoit une phrase complete indiquant le
74
 *  nombre d'inscrits dans zone passee en argument
75
 *  @param  string  identifiant de carte ex: europe
76
 * @return string
77
 */
78
 
79
function carto_ad_consulterNbreInscrits ($id_carte)
80
{
81
    global $NOM_FICHIER;
82
 
83
    $titre_carte = carto_consulterTitreCarte($id_carte);
84
    $type_zone_carte = carto_consulterTypeZoneCarte ($id_carte);
85
 
86
    switch ($type_zone_carte){
87
        case '0' :
88
            $requete =
89
                    ' SELECT count(u_id) as nbr'.
90
                    ' FROM annuaire_tela'.
91
                    ' WHERE u_french_dpt <> 999';
92
                break;
93
 
94
        case '1' :
95
            $requete =
96
                    ' SELECT count(u_id) as nbr'.
97
                    ' FROM annuaire_tela, carto_PAYS'.
98
                    ' WHERE u_country = cp_id_pays'.
99
                    ' AND cp_id_continent = "'.carto_consulterIdZoneGeoCarte ($id_carte).'"';
100
                break;
101
 
102
        case '2' :
103
            $requete =
104
                    ' SELECT count(u_id) as nbr'.
105
                    ' FROM annuaire_tela'.
106
                    ' WHERE u_french_dpt != "999"'.
107
                    ' AND u_country = "fr"';
108
                break;
109
    }
110
 
111
    $resultat = mysql_query($requete) or die('
112
            <H2 style="text-align: center; font-weight: bold; font-size: 26px;">Erreur de requête</H2>'.
113
            '<b>Nom du fichier : </b> '.$NOM_FICHIER.'<br/>'.
114
            '<b>Nom fonction : </b> carto_ad_consulterNbreInscrits<br/>'.
115
            '<b>Requete : </b>'.$requete.
116
            '<br/><br/><b>Erreur : </b>'.mysql_error());
117
 
118
    $ligne = mysql_fetch_object ($resultat) ;
119
    $res = '<h1 class="titre1_cartographie">'.$titre_carte.' : ' ;
120
    if ($ligne->nbr == 0) {
121
        $res .= 'aucun inscrit' ;
122
    }
123
    else if ($ligne->nbr == 1) {
124
        $res .= $ligne->nbr.' inscrit' ;
125
    }
126
    else {
127
        $res .= $ligne->nbr.' inscrits ';
128
    }
129
    return $res.' &agrave; Tela Botanica</h1>' ;
130
}
131
 
132
/**
133
 *  Envoie un email à tous les adhérents sélectionnés
134
 *
135
 * @return  string  Renvoie le message 'votre message a été envoyé'
136
 */
137
 
138
function envoie_mail (&$db) {
139
    $res = "<h1 class=\"titre1_cartographie\">Votre message a &eacute;t&eacute; envoy&eacute;</div>\n" ;
140
    $requete = "select ".CAR_CHAMPS_MAIL." from ".CAR_ANNUAIRE.
141
            " where ".CAR_CHAMPS_ID."='".$GLOBALS['car_auth']->getAuthData (CAR_CHAMPS_ID)."'";
142
    $resultat = $db->query($requete);
143
    if (DB::isError($resultat)) {
144
        die ($resultat->getMessage().'<br />'.$resultat->getDebugInfo());
145
    }
146
    $ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC);
147
    $entete = "From: <".$ligne[CAR_CHAMPS_MAIL].">\n";
148
 
149
    $_POST['corps'] .= CAR_TEXTE_FIN_MAIL;
150
    $_POST['corps'] = stripslashes($_POST['corps']) ;
151
    $liste = "" ;
152
    foreach ($_POST['select'] as $key => $value) {
153
        mail ($value, stripslashes($_POST['titre_mail']), $_POST['corps'], $entete) ;
154
        $liste .= $value."\n" ;
155
    }
156
 
157
    $_POST['corps'] .= "\n----------------------------------------------------------------------------";
158
    $_POST['corps'] .= "\nCe message a été envoyé à :\n $liste" ;
159
 
160
    mail ("carto@tela-botanica.org", stripslashes($_POST['titre_mail']), $_POST['corps'], $entete);
364 jpm 161
 
87 alex 162
    $_POST['corps']='';
163
    $_POST['titre_mail']='';
164
    return $res ;
165
}
166
 
167
//-- Fin du code source    ------------------------------------------------------------
168
/*
169
* $Log: car_cartographie.fonct.php,v $
170
* Revision 1.4  2005/03/11 17:27:23  alex
171
* modification html
172
*
173
* Revision 1.3  2005/03/11 17:24:39  alex
174
* modification html
175
*
176
* Revision 1.2  2005/03/11 15:18:45  alex
177
* migration version 4
178
*
179
* Revision 1.1  2004/11/30 13:37:19  tam
180
* installation
181
*
182
* Revision 1.1.1.1  2004/11/23 17:48:17  tam
183
* Importation
184
*
185
* Revision 1.1  2004/11/23 17:30:13  tam
186
* installation
187
*
188
*
189
*/
190
?>