Subversion Repositories Sites.tela-botanica.org

Rev

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