Subversion Repositories Applications.papyrus

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
231 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.1 2004-12-15 13:30:20 alex Exp $
30
// FICHIER : $RCSfile: car_cartographie.fonct.php,v $
31
// AUTEUR    : $Author: alex $
32
// VERSION : $Revision: 1.1 $
33
// DATE        : $Date: 2004-12-15 13:30:20 $
34
*/
35
 
36
/** function carto_texte_cocher ()
37
*
38
*
39
*	@return string  HTML
40
*/
41
 
42
function carto_texte_cocher () {
43
    $res .= "<div class=\"texte\">".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
    global $HTTP_USER_AGENT, $GS_GLOBAL ;
55
    $res .= "<div class=\"chapo\">".CAR_ENVOYER_MAIL."</div>\n";
56
    $res .= "<div>\n<table width=\"100%\" 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="'.$GLOBALS['titre_mail'].'"></td>'."\n"
59
            .'</tr><tr><td class="texte" valign="top">'.CAR_MESSAGE.'&nbsp;:&nbsp;</td>'."\n"
60
            .'<td><textarea class="forml" name="corps" rows="5" cols="60">'.$GLOBALS['corps'].'</textarea></td>'."\n"
61
            .'</tr><tr><td></td><td align="center">';
62
    if (ereg ("Gecko",$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>\n</div></form>\n";
68
    return $res ;
69
}
70
 
71
/**
72
 *  Renvoie le code HTML de la liste des inscrits
73
 *  en fonction de la requete passé en parametre
74
 *
75
 * @return  Renvoie le code HTML de la liste des inscrits
76
 */
77
 
78
function listes_inscrit ($requete, $url, $select, $argument, &$db, $niveau = 'pays') {
79
    $res = "<div>";
80
    $res .= "<form action=\"$url&amp;mailer=1"."&amp;select=$select\" method=\"post\" name=\"formmail\">\n
81
                <tr><td>\n
82
                        <table id=\"table_outilsreseaux\" width=\"100%\">\n
83
                            <colgroup>
84
                                <col />
85
                                <col />
86
                                <col />
87
                                <col />
88
                                <col />
89
                                <col />
90
                            </colgroup>
91
                                <thead>\n
92
                                        <th>&nbsp;</th>\n
93
                                        <th>".CAR_NOM."</th>\n
94
                                        <th>".CAR_PRENOM."</th>\n
95
                                        <th>".CAR_DATE_INS."</th>\n
96
                                        <th>".($niveau == 'pays' ? CAR_REGION : CAR_CP)."</th>\n
97
                                        <th>".CAR_VILLE."</th>\n
98
                                </thead>\n";
99
 
100
 
101
    $resultat= $GLOBALS['car_db']->query($requete);
102
    if (DB::isError($resultat)) {
103
        die ($resultat->getMessage().'<br />'.$resultat->getDebugInfo()) ;
104
    }
105
    $indic=0;
106
    $i=1;
107
    while ($ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
108
        if ($indic==0) {
109
            $res.="<tr class=\"ligne_impaire\">\n";
110
            $indic=1;
111
        }
112
        else {
113
            $res.="<tr class=\"ligne_paire\">\n";
114
            $indic=0;
115
        }
116
        $res.="<td><input type=\"checkbox\" name=\"select[]\" value=\"".$ligne[CAR_CHAMPS_MAIL]."\"></td>\n
117
                        <td>".$ligne[CAR_CHAMPS_NOM]."&nbsp;</td>\n
118
                        <td>".$ligne[CAR_CHAMPS_PRENOM]."&nbsp;</td>\n
119
                        <td>".date("d m Y", strtotime($ligne[CAR_CHAMPS_DATE_INS]))."&nbsp;</td>\n
120
                        <td>".($niveau == 'pays' ? $ligne[CAR_CHAMPS_REGION] : $ligne[CAR_CHAMPS_CODE_POSTAL])."&nbsp;</td>\n
121
                        <td>".$ligne[CAR_CHAMPS_VILLE]."&nbsp;</td>\n" ;
122
        $res .= "</tr>\n";
123
    }
124
 
125
    $res .= "</table></div>\n";
126
    return $res ;
127
}
128
 
129
/** envoie_mail()
130
 *
131
 *
132
 * @return  envoie l'email
133
 */
134
 
135
function envoie_mail () {
136
    $requete = "select ".CAR_CHAMPS_MAIL." from ".CAR_ANNUAIRE.
137
            " where ".CAR_CHAMPS_ID."='".$GLOBALS['car_auth']->getAuthData (CAR_CHAMPS_ID)."'";
138
    $resultat = $GLOBALS['car_db']->query($requete);
139
    if (DB::isError($resultat)) {
140
        die ($resultat->getMessage().'<br />'.$resultat->getDebugInfo());
141
    }
142
    $ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC);
143
    $entete = "From: <".$ligne[CAR_CHAMPS_MAIL].">\n";
144
 
145
    $GLOBALS['corps'] .= CAR_TEXTE_FIN_MAIL;
146
    $GLOBALS['corps'] = stripslashes($GLOBALS['corps']) ;
147
    $liste = "" ;
148
    foreach ($GLOBALS['select'] as $key => $value) {
149
        mail ($value, stripslashes($GLOBALS['titre_mail']), $GLOBALS['corps'] , $entete) ;
150
        $liste .= $value."\n" ;
151
    }
152
 
153
    $GLOBALS['corps'] .= "\n----------------------------------------------------------------------------";
154
    $GLOBALS['corps'] .= "\n".CAR_MESSAGE_ENVOYE_A." :\n $liste" ;
155
 
156
    mail (CAR_MAIL_ADMIN, stripslashes($GLOBALS['titre_mail']), $GLOBALS['corps'], $entete);
157
    $GLOBALS['corps'] = '';
158
    $GLOBALS['titre_mail'] = '';
159
}
160
//-- Fin du code source    ------------------------------------------------------------
161
/*
162
* $Log: not supported by cvs2svn $
163
*
164
*/
165
?>