Subversion Repositories Sites.tela-botanica.org

Rev

Rev 463 | 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 () {
463 jpm 43
    $res = '<p class="cocher">'.CAR_CHECK_UNCHECK ;
44
    $res .= '&nbsp;<input type="checkbox" name="selecttotal" onclick="javascript:setCheckboxes(\'formmail\');" />'.
45
			'</p>';
87 alex 46
    return $res ;
47
}
48
/** function carto_formulaire ()
49
*
50
*
51
*
52
*	@return string  HTML
53
*/
463 jpm 54
function carto_formulaire ($titre_mail = '', $corps = '') {
55
    $res = '<div id="redaction">'."\n";
56
    $res .= '<div id="redaction_tete"></div>'."\n";
57
    $res .= '<h2 class="chapo">'.CAR_ENVOYER_MAIL.'</h2>'."\n";
58
    $res .= '<table id="formulaire_mail" border="0">'."\n".
59
			'	<tr>' .
60
			'		<td class="texte">'.CAR_SUJET.' :</td>'."\n".
61
			'		<td><input class="forml" type="text" name="titre_mail" size="60" value="'.$titre_mail.'" /></td>'."\n".
62
			'	</tr>'."\n".
63
			'	<tr>'."\n".
64
			'		<td class="texte" valign="top">'.CAR_MESSAGE.'&nbsp;:&nbsp;</td>'."\n".
65
			'		<td><textarea class="forml" name="corps" rows="5" cols="60">'.$corps.'</textarea></td>'."\n".
66
			'	</tr>'."\n".
67
			'	<tr>'."\n".
68
			'		<td>&nbsp;</td>'."\n".
69
			'		<td>';
70
    if (ereg('Gecko', $GLOBALS['HTTP_USER_AGENT'])) {
71
        $res.= '<input class="spip_bouton" type="submit" value="'.CAR_ENVOYER.'" />';
87 alex 72
    } else {
463 jpm 73
        $res .= '<input class="spip_bouton" type="submit" onclick="javascript:confirmer();" value="'.CAR_ENVOYER.'" />';
87 alex 74
    }
463 jpm 75
    $res .=	'		</td>'."\n".
76
    		'	</tr>'."\n".
77
    		'</table>'."\n".
78
    		'<div id="redaction_pied"/></div>'."\n".
79
    		'</div>'."\n".
80
    		'</form>'."\n";
81
    $res .= '<p class="attention surveillance">'.CAR_SURVEILLANCE.'</p>' ;
82
    $res .= '<p class="information message_a_tous">'.sprintf(CAR_MESSAGE_A_TOUS, '<a href="'.CAR_URL_ACTUALITE.'">'.CAR_ACTUALITE.'</a>').'</p>' ;
83
 
87 alex 84
    return $res ;
85
}
86
 
87
/**
88
 *  La fonction carto_getNbInscrits renvoit une phrase complete indiquant le
89
 *  nombre d'inscrits dans zone passee en argument
90
 *  @param  string  identifiant de carte ex: europe
91
 * @return string
92
 */
93
 
94
function carto_ad_consulterNbreInscrits ($id_carte)
95
{
96
    global $NOM_FICHIER;
97
 
98
    $titre_carte = carto_consulterTitreCarte($id_carte);
99
    $type_zone_carte = carto_consulterTypeZoneCarte ($id_carte);
100
 
101
    switch ($type_zone_carte){
102
        case '0' :
103
            $requete =
104
                    ' SELECT count(u_id) as nbr'.
105
                    ' FROM annuaire_tela'.
106
                    ' WHERE u_french_dpt <> 999';
107
                break;
108
 
109
        case '1' :
110
            $requete =
111
                    ' SELECT count(u_id) as nbr'.
112
                    ' FROM annuaire_tela, carto_PAYS'.
113
                    ' WHERE u_country = cp_id_pays'.
114
                    ' AND cp_id_continent = "'.carto_consulterIdZoneGeoCarte ($id_carte).'"';
115
                break;
116
 
117
        case '2' :
118
            $requete =
119
                    ' SELECT count(u_id) as nbr'.
120
                    ' FROM annuaire_tela'.
121
                    ' WHERE u_french_dpt != "999"'.
122
                    ' AND u_country = "fr"';
123
                break;
124
    }
125
 
126
    $resultat = mysql_query($requete) or die('
127
            <H2 style="text-align: center; font-weight: bold; font-size: 26px;">Erreur de requête</H2>'.
128
            '<b>Nom du fichier : </b> '.$NOM_FICHIER.'<br/>'.
129
            '<b>Nom fonction : </b> carto_ad_consulterNbreInscrits<br/>'.
130
            '<b>Requete : </b>'.$requete.
131
            '<br/><br/><b>Erreur : </b>'.mysql_error());
132
 
133
    $ligne = mysql_fetch_object ($resultat) ;
134
    $res = '<h1 class="titre1_cartographie">'.$titre_carte.' : ' ;
135
    if ($ligne->nbr == 0) {
136
        $res .= 'aucun inscrit' ;
137
    }
138
    else if ($ligne->nbr == 1) {
139
        $res .= $ligne->nbr.' inscrit' ;
140
    }
141
    else {
142
        $res .= $ligne->nbr.' inscrits ';
143
    }
144
    return $res.' &agrave; Tela Botanica</h1>' ;
145
}
146
 
147
/**
148
 *  Envoie un email à tous les adhérents sélectionnés
149
 *
150
 * @return  string  Renvoie le message 'votre message a été envoyé'
151
 */
152
 
153
function envoie_mail (&$db) {
154
    $res = "<h1 class=\"titre1_cartographie\">Votre message a &eacute;t&eacute; envoy&eacute;</div>\n" ;
155
    $requete = "select ".CAR_CHAMPS_MAIL." from ".CAR_ANNUAIRE.
156
            " where ".CAR_CHAMPS_ID."='".$GLOBALS['car_auth']->getAuthData (CAR_CHAMPS_ID)."'";
157
    $resultat = $db->query($requete);
158
    if (DB::isError($resultat)) {
159
        die ($resultat->getMessage().'<br />'.$resultat->getDebugInfo());
160
    }
161
    $ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC);
162
    $entete = "From: <".$ligne[CAR_CHAMPS_MAIL].">\n";
163
 
164
    $_POST['corps'] .= CAR_TEXTE_FIN_MAIL;
165
    $_POST['corps'] = stripslashes($_POST['corps']) ;
166
    $liste = "" ;
167
    foreach ($_POST['select'] as $key => $value) {
499 jpm 168
        mail($value, stripslashes($_POST['titre_mail']), $_POST['corps'], $entete) ;
87 alex 169
        $liste .= $value."\n" ;
170
    }
171
 
172
    $_POST['corps'] .= "\n----------------------------------------------------------------------------";
367 jpm 173
    $_POST['corps'] .= "\n".CAR_MESSAGE_APPLI."\n" ;
174
    $_POST['corps'] .= "\n".CAR_MESSAGE_ENVOYE_A.":\n $liste" ;
87 alex 175
 
499 jpm 176
    // Envoie du message aux administrateurs
177
	foreach ($GLOBALS['mail_admin'] as $courriel) {
178
		if (!mail($courriel, stripslashes($_POST['titre_mail']), $_POST['corps'], $entete)) {
179
			trigger_error("Le courriel n'a pas été envoyé à : $courriel", E_USER_WANRNING);
180
		}
181
	}
364 jpm 182
 
499 jpm 183
 
184
 
87 alex 185
    $_POST['corps']='';
186
    $_POST['titre_mail']='';
187
    return $res ;
188
}
189
 
190
//-- Fin du code source    ------------------------------------------------------------
191
/*
192
* $Log: car_cartographie.fonct.php,v $
193
* Revision 1.4  2005/03/11 17:27:23  alex
194
* modification html
195
*
196
* Revision 1.3  2005/03/11 17:24:39  alex
197
* modification html
198
*
199
* Revision 1.2  2005/03/11 15:18:45  alex
200
* migration version 4
201
*
202
* Revision 1.1  2004/11/30 13:37:19  tam
203
* installation
204
*
205
* Revision 1.1.1.1  2004/11/23 17:48:17  tam
206
* Importation
207
*
208
* Revision 1.1  2004/11/23 17:30:13  tam
209
* installation
210
*
211
*
212
*/
213
?>