448 |
ddelon |
1 |
<?php
|
|
|
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 |
// +------------------------------------------------------------------------------------------------------+
|
|
|
22 |
// CVS : $Id: annuaire.fonct.php,v 1.1 2005-09-22 14:02:49 ddelon Exp $
|
|
|
23 |
/**
|
|
|
24 |
* Fonctions du module annuaire
|
|
|
25 |
*
|
|
|
26 |
* Fonctions 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
|
|
|
34 |
*@version $Revision: 1.1 $
|
|
|
35 |
// +------------------------------------------------------------------------------------------------------+
|
|
|
36 |
*/
|
|
|
37 |
|
|
|
38 |
// +------------------------------------------------------------------------------------------------------+
|
|
|
39 |
// | ENTETE du PROGRAMME |
|
|
|
40 |
// +------------------------------------------------------------------------------------------------------+
|
|
|
41 |
|
|
|
42 |
include_once "HTML/QuickForm.php" ;
|
|
|
43 |
|
|
|
44 |
// +------------------------------------------------------------------------------------------------------+
|
|
|
45 |
// | LISTE de FONCTIONS |
|
|
|
46 |
// +------------------------------------------------------------------------------------------------------+
|
|
|
47 |
|
|
|
48 |
/** function parcourirAnnu () Affiche l'annuaire à partir d'une lettre
|
|
|
49 |
*
|
|
|
50 |
*
|
|
|
51 |
*
|
|
|
52 |
* @return string HTML
|
|
|
53 |
*/
|
|
|
54 |
|
|
|
55 |
function parcourirAnnu() {
|
|
|
56 |
|
|
|
57 |
$res = '<div><table><tr>';
|
|
|
58 |
|
|
|
59 |
// ecrire toutes les lettres avec un lien
|
|
|
60 |
for ($i = 65 ; $i <91 ; $i++) {
|
|
|
61 |
$res .= '<td><a style="font-size:15px;" href="'.$GLOBALS['ins_url']->getURL().'&lettre=';
|
|
|
62 |
$res .= chr($i) ;
|
|
|
63 |
$res .= '">';
|
|
|
64 |
$res .= chr($i) ;
|
|
|
65 |
$res .= '</a></td>'."\n";
|
|
|
66 |
}
|
|
|
67 |
$res .= '</tr></table></div>'."\n";
|
|
|
68 |
|
|
|
69 |
// si une lettre est selectionne
|
|
|
70 |
if (!empty($_REQUEST['lettre'])) {
|
|
|
71 |
$requete = 'SELECT '.INS_CHAMPS_ID;
|
|
|
72 |
foreach($GLOBALS['annuaire_champs_visibles']['champs_db'] as $i) {
|
|
|
73 |
$requete .= ', '.$i;
|
|
|
74 |
}
|
|
|
75 |
$requete .= ' FROM '.INS_ANNUAIRE.' WHERE ';
|
|
|
76 |
if ($_REQUEST['lettre'] != 'tous') {
|
|
|
77 |
$requete .= INS_CHAMPS_NOM.' LIKE "'.$_REQUEST['lettre'].'%"';
|
|
|
78 |
} else {
|
|
|
79 |
$requete .= '1';
|
|
|
80 |
}
|
|
|
81 |
$requete .= ' ORDER BY '.INS_CHAMPS_NOM ;
|
|
|
82 |
$resultat = $GLOBALS['ins_db']->query($requete);
|
|
|
83 |
if ($resultat->numRows()>0) {
|
|
|
84 |
$i=0;
|
|
|
85 |
while ($ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
|
|
|
86 |
$donnees_membres[$i++]=$ligne;
|
|
|
87 |
}
|
|
|
88 |
$res .= listes_inscrit($donnees_membres, $GLOBALS['annuaire_champs_visibles']['label_champs']);
|
|
|
89 |
} else {$res .= ANN_PAS_D_INSCRITS;}
|
|
|
90 |
}
|
|
|
91 |
return $res ;
|
|
|
92 |
}
|
|
|
93 |
|
|
|
94 |
/**
|
|
|
95 |
* Renvoie le code HTML de la liste des inscrits
|
|
|
96 |
* en fonction de la requete passé en parametre
|
|
|
97 |
*
|
|
|
98 |
* @return Renvoie le code HTML de la liste des inscrits
|
|
|
99 |
*/
|
|
|
100 |
|
|
|
101 |
function listes_inscrit(& $donnees_membres, & $entete , $case_a_cocher=true) {
|
|
|
102 |
$res = '<div>'."\n";
|
|
|
103 |
if ($case_a_cocher) {$res .= '<form action="'.$GLOBALS['ins_url']->getURL().'"&lettre='.$_REQUEST['lettre'].'" method="post" name="formmail">'."\n";}
|
|
|
104 |
$res .= '<table id="table_inscrit">'."\n".'<colgroup>'."\n";
|
|
|
105 |
if ($case_a_cocher) {$res .= '<col />';}
|
|
|
106 |
foreach($entete as $i) {$res .= '<col />'; }
|
|
|
107 |
$res .= '</colgroup>'."\n".'<thead>'."\n";
|
|
|
108 |
if ($case_a_cocher) {$res .= '<th> </th>'."\n";}
|
|
|
109 |
foreach($entete as $i) {
|
|
|
110 |
$res .= '<th>'.$i.'</th>'."\n";
|
|
|
111 |
}
|
|
|
112 |
$res .= '</thead>'."\n";
|
|
|
113 |
|
|
|
114 |
$indic=0;
|
|
|
115 |
$i=1;
|
|
|
116 |
foreach($entete as $i) {
|
|
|
117 |
if ($indic==0) {
|
|
|
118 |
$res.='<tr class="ligne_impaire">'."\n";
|
|
|
119 |
$indic=1;
|
|
|
120 |
}
|
|
|
121 |
else {
|
|
|
122 |
$res.='<tr class="ligne_paire">'."\n";
|
|
|
123 |
$indic=0;
|
|
|
124 |
}
|
|
|
125 |
}
|
|
|
126 |
for ($i=0;$i<count($donnees_membres);$i++) {
|
|
|
127 |
$id = array_shift($donnees_membres[$i]);
|
|
|
128 |
if ($case_a_cocher) {$res.='<td><input type="checkbox" name="select[]" value="'.$id.'"></td>'."\n";}
|
|
|
129 |
foreach($donnees_membres[$i] as $valeur) $res .= '<td>'.$valeur.'</td>'."\n" ;
|
|
|
130 |
$res .= '</tr>'."\n";
|
|
|
131 |
}
|
|
|
132 |
|
|
|
133 |
$res .= '</table></div>'."\n";
|
|
|
134 |
if ($case_a_cocher) {
|
|
|
135 |
$res .= '<div class="texte">'.ANN_CHECK_UNCHECK ;
|
|
|
136 |
$res .= ' <input type="checkbox" name="selecttotal" onclick="javascript:setCheckboxes(\'formmail\');"></div>';
|
|
|
137 |
$res .= '<h3>'.ANN_ENVOYER_MAIL.'</h3>'."\n";
|
|
|
138 |
$res .= '<div>'."\n".'<table border="0">'."\n"
|
|
|
139 |
.'<tr><td class="texte">'.ANN_SUJET.' :</td>'."\n"
|
|
|
140 |
.'<td><input class="forml" type="text" name="titre_mail" size="60"></td>'."\n"
|
|
|
141 |
.'</tr><tr><td class="texte" valign="top">'.ANN_MESSAGE.' : </td>'."\n"
|
|
|
142 |
.'<td><textarea class="forml" name="corps" rows="5" cols="60"></textarea></td>'."\n"
|
|
|
143 |
.'</tr><tr><td></td><td align="center">';
|
|
|
144 |
$res.='<input type="submit" value="'.ANN_ENVOYER.'">';
|
|
|
145 |
$res.='</td>'."\n".'</tr>'."\n".'</table>'."\n".'</div>'."\n".'</form>'."\n";
|
|
|
146 |
}
|
|
|
147 |
return $res ;
|
|
|
148 |
}
|
|
|
149 |
|
|
|
150 |
|
|
|
151 |
|
|
|
152 |
/** envoie_mail_depuis_annuaire()
|
|
|
153 |
*
|
|
|
154 |
*
|
|
|
155 |
* @return envoie l'email
|
|
|
156 |
*/
|
|
|
157 |
|
|
|
158 |
function envoie_mail_depuis_annuaire() {
|
|
|
159 |
$requete = "select ".ANN_CHAMPS_MAIL." from ".ANN_ANNUAIRE.
|
|
|
160 |
" where ".ANN_CHAMPS_ID."='".$GLOBALS['AUTH']->getAuthData (ANN_CHAMPS_ID)."'";
|
|
|
161 |
$resultat = $GLOBALS['ann_db']->query($requete);
|
|
|
162 |
if (DB::isError($resultat)) {
|
|
|
163 |
die ($resultat->getMessage().'<br />'.$resultat->getDebugInfo());
|
|
|
164 |
}
|
|
|
165 |
$ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC);
|
|
|
166 |
$entete = "From: <".$ligne[ANN_CHAMPS_MAIL].">\n";
|
|
|
167 |
|
|
|
168 |
$_POST['corps'] .= ANN_PIED_MESSAGE;
|
|
|
169 |
$_POST['corps'] = stripslashes($_POST['corps']) ;
|
|
|
170 |
$liste = "" ;
|
|
|
171 |
foreach ($_POST['select'] as $key => $value) {
|
|
|
172 |
mail ($value, stripslashes($_POST['titre_mail']), $_POST['corps'] , $entete) ;
|
|
|
173 |
$liste .= $value."\n" ;
|
|
|
174 |
}
|
|
|
175 |
|
|
|
176 |
$_POST['corps'] .= "\n----------------------------------------------------------------------------";
|
|
|
177 |
$_POST['corps'] .= "\n".ANN_MESSAGE_ENVOYE_A." :\n $liste" ;
|
|
|
178 |
|
|
|
179 |
mail (CAR_MAIL_ADMIN, stripslashes($_POST['titre_mail']), $_POST['corps'], $entete);
|
|
|
180 |
$_POST['corps'] = '';
|
|
|
181 |
$_POST['titre_mail'] = '';
|
|
|
182 |
return '<div>'.ANN_MAIL_ENVOYER.'</div>' ;
|
|
|
183 |
}
|
|
|
184 |
|
|
|
185 |
/* +--Fin du code ----------------------------------------------------------------------------------------+
|
|
|
186 |
*
|
|
|
187 |
* $Log: not supported by cvs2svn $
|
|
|
188 |
* Revision 1.4 2005/09/22 13:30:49 florian
|
|
|
189 |
* modifs pour compatibilité XHTML Strict + corrections de bugs (mais ya encore du boulot!!)
|
|
|
190 |
*
|
|
|
191 |
* Revision 1.3 2005/03/24 08:24:29 alex
|
|
|
192 |
* --
|
|
|
193 |
*
|
|
|
194 |
* Revision 1.2 2005/01/06 15:18:31 alex
|
|
|
195 |
* modification de la fonction de formulaire d'authentification
|
|
|
196 |
*
|
|
|
197 |
* Revision 1.1.1.1 2005/01/03 17:27:49 alex
|
|
|
198 |
* Import initial
|
|
|
199 |
*
|
|
|
200 |
* Revision 1.1 2005/01/03 17:18:49 alex
|
|
|
201 |
* retour vers la liste des participants après un ajout.
|
|
|
202 |
*
|
|
|
203 |
*
|
|
|
204 |
*
|
|
|
205 |
* +-- Fin du code ----------------------------------------------------------------------------------------+
|
|
|
206 |
*/
|
|
|
207 |
?>
|