Subversion Repositories Applications.papyrus

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
235 alex 1
<?
2
/*vim: set expandtab tabstop=4 shiftwidth=4: */
3
// +------------------------------------------------------------------------------------------------------+
4
// | PHP version 4.1                                                                                      |
5
// +------------------------------------------------------------------------------------------------------+
6
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org)                                         |
7
// +------------------------------------------------------------------------------------------------------+
8
// | This library is free software; you can redistribute it and/or                                        |
9
// | modify it under the terms of the GNU Lesser General Public                                           |
10
// | License as published by the Free Software Foundation; either                                         |
11
// | version 2.1 of the License, or (at your option) any later version.                                   |
12
// |                                                                                                      |
13
// | This library is distributed in the hope that it will be useful,                                      |
14
// | but WITHOUT ANY WARRANTY; without even the implied warranty of                                       |
15
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU                                    |
16
// | Lesser General Public License for more details.                                                      |
17
// |                                                                                                      |
18
// | You should have received a copy of the GNU Lesser General Public                                     |
19
// | License along with this library; if not, write to the Free Software                                  |
20
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                            |
21
// +------------------------------------------------------------------------------------------------------+
245 alex 22
// CVS : $Id: annuaire.php,v 1.3 2005-01-06 15:44:33 alex Exp $
235 alex 23
/**
24
* programme principal du module annuaire
25
*
26
* programme principal du module annuaire
27
*
28
*@package annuaire
29
//Auteur original :
30
*@author        Alexandre Granier <alexandre@tela-botanica.org>
31
//Autres auteurs :
32
*@author        Aucun
33
*@copyright     Tela-Botanica 2000-2004
245 alex 34
*@version       $Revision: 1.3 $
235 alex 35
// +------------------------------------------------------------------------------------------------------+
36
*/
37
 
38
// +------------------------------------------------------------------------------------------------------+
39
// |                                            ENTETE du PROGRAMME                                       |
40
// +------------------------------------------------------------------------------------------------------+
41
 
42
 
43
include_once 'client/annuaire/configuration/ann_config.inc.php' ;
243 alex 44
include_once ANN_CHEMIN_LIBRAIRIE.'annuaire.fonct.php' ;
235 alex 45
if (isset($lang)) {
243 alex 46
    include_once ANN_CHEMIN_APPLI."/langues/ann_langue_$lang.inc.php" ;
235 alex 47
} else {
243 alex 48
    include_once ANN_CHEMIN_APPLI.'/langues/ann_langue_fr.inc.php' ;
235 alex 49
}
50
 
51
 
243 alex 52
 
235 alex 53
include_once 'HTML/QuickForm.php' ;
54
 
55
 
56
define ("ENVOIE_MAIL", 2) ;
57
 
243 alex 58
/**
59
 *  Renvoie le code HTML de l'application
60
 *
61
 * @return  string  HTML
62
 */
235 alex 63
 
243 alex 64
function afficherContenuCorps () {
245 alex 65
    $res = "<h1 class=\"annuaire_titre1\">".ANN_TITRE."</h1>\n" ;
243 alex 66
    if (!$GLOBALS['AUTH']->getAuth())  {
245 alex 67
        $res .= AUTH_formulaire_login() ;
235 alex 68
    } else {
69
        // Le code javascript des cases à cocher
70
        $java =
71
            "function setCheckboxes(the_form)
72
            {
73
            var do_check=document.forms[the_form].elements['selecttotal'].checked;
74
            var elts            = document.forms[the_form].elements['select[]'];
75
            var elts_cnt = (typeof(elts.length) != 'undefined')
76
                                ? elts.length
77
                                : 0;
78
            if (elts_cnt) {
79
                for (var i = 0; i < elts_cnt; i++) {
80
                    elts[i].checked = do_check;
81
                } // Fin for
82
            } else {
83
                elts.checked = do_check;
84
            } // Fin if... else
85
            return true;
86
        } // Fin de la fonction 'setCheckboxes()'";
245 alex 87
        GEN_stockerCodeScript($java) ;
235 alex 88
 
89
        $res .= "<h2 class=\"annuaire_titre2\">".ANN_CLIQUEZ_LETTRE."</h2>\n";
90
 
91
        global $baseURL ;
243 alex 92
        $baseURL = $GLOBALS['ann_url']->getURL() ;
235 alex 93
            // S'il y a un mail a envoyé, on l'envoie
94
        if ($action == ENVOIE_MAIL) $res .= envoie_mail () ;
95
 
96
        $res .= parcourrirAnnu("") ;
97
    }
98
    return $res;
99
}
100
 
101
//==============================================================================
102
// FUNCTION putFooter ()
103
//
104
// Generation of footer.
105
//==============================================================================
106
 
107
function putFooter () {
108
  return '&nbsp;';
109
}
110
 
111
 
112
 
113
function envoie_mail () {
114
    global $titre, $corps, $HTTP_POST_VARS, $select, $AUTH, $db ;
115
 
116
    // On vérifie qu'un email aie été sélectionné
117
    if (!is_array($select)) {
118
        $res ="<div class=\"annuaire_erreur\">".ANN_VERIF_MAIL_COCHE."</divr>";
119
        return $res ;
120
    }
121
    if ($titre == "" || $corps == "") {
122
        $res = "<div class=\"annuaire_erreur\">".ANN_VERIF_TITRE."</div>\n" ;
123
        return $res ;
124
    }
125
 
126
    // On récupère le mail de l'expéditeur
127
    $req_exp = "select ".ANN_CHAMPS_MAIL." from ".ANN_ANNUAIRE." where ".ANN_CHAMPS_ID."=".$AUTH->getAuthData(ANN_CHAMPS_ID) ;
128
    $res_exp = $db->query($req_exp) ;
129
    if (DB::isError($res_exp)) {
130
	die ("Echec de la requete sur annuaire_tela <br>".$res_exp->getMessage()) ;
131
    }
132
    $ligne_exp = $res_exp->fetchRow(DB_FETCHMODE_ASSOC) ;
133
    $expediteur = $ligne_exp[ANN_CHAMPS_MAIL] ;
134
 
135
    $corps .= ANN_PIED_MESSAGE ;
136
    $liste = "" ;
137
    for ($i = 0; $i < count($select); $i++) {
138
        $requete = "select ".ANN_CHAMPS_MAIL." from ".ANN_ANUAIRE." where ".ANN_CHAMPS_ID."=".$select[$i] ;
139
        $resultat = $db->query($requete) ;
140
 
141
        if (DB::isError($resultat)) {
142
            die ("Echec de la requete sur annuaire_tela <br>".$resultat->getMessage()) ;
143
        }
144
        $ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC) ;
145
 
146
        // L'envoie du mail proprement dit
147
        if (!mail($ligne[ANN_CHAMPS_MAIL], stripslashes($titre), stripslashes($corps), "From: $expediteur")) {
148
            return "<div class=\"annuaire_erreur\">Le mail n'est pas partie</div>\n" ;
149
        }
150
        $liste .= $ligne[ANN_CHAMPS_MAIL]."\n" ;
151
    }
152
    $corps .= "\n----------------------------------------------------------------------------
153
                Ce message a été envoyé à :\n $liste" ;
154
    mail ("ANN_MAIL_ADMIN", stripslashes($titre), stripslashes($corps), "From: $expediteur");
155
}
156
/**------------------------------------------------------------------------------
157
* $Log: not supported by cvs2svn $
245 alex 158
* Revision 1.2  2005/01/06 15:17:39  alex
159
* ajout de commentaires
160
*
243 alex 161
* Revision 1.1.1.1  2005/01/03 17:27:49  alex
162
* Import initial
163
*
235 alex 164
* Revision 1.1  2005/01/03 17:18:43  alex
165
* retour vers la liste des participants après un ajout.
166
*
167
*
168
*-- End of source  ------------------------------------------------------------*/
169
?>