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 |
// +------------------------------------------------------------------------------------------------------+
|
485 |
alexandre_ |
22 |
// CVS : $Id: annuaire.fonct.php,v 1.2 2005-09-29 16:13:54 alexandre_tb Exp $
|
448 |
ddelon |
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
|
485 |
alexandre_ |
34 |
*@version $Revision: 1.2 $
|
448 |
ddelon |
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;
|
485 |
alexandre_ |
72 |
foreach($GLOBALS['annuaire_champs_visibles']['champs_db'] as $i) {
|
448 |
ddelon |
73 |
$requete .= ', '.$i;
|
485 |
alexandre_ |
74 |
}
|
|
|
75 |
$requete .= ' FROM '.INS_ANNUAIRE.' WHERE ';
|
448 |
ddelon |
76 |
if ($_REQUEST['lettre'] != 'tous') {
|
|
|
77 |
$requete .= INS_CHAMPS_NOM.' LIKE "'.$_REQUEST['lettre'].'%"';
|
485 |
alexandre_ |
78 |
} else {
|
|
|
79 |
$requete .= '1';
|
|
|
80 |
}
|
448 |
ddelon |
81 |
$requete .= ' ORDER BY '.INS_CHAMPS_NOM ;
|
485 |
alexandre_ |
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 {
|
|
|
90 |
$res .= ANN_PAS_D_INSCRITS;
|
448 |
ddelon |
91 |
}
|
|
|
92 |
}
|
|
|
93 |
return $res ;
|
|
|
94 |
}
|
|
|
95 |
|
|
|
96 |
/**
|
|
|
97 |
* Renvoie le code HTML de la liste des inscrits
|
|
|
98 |
* en fonction de la requete passé en parametre
|
|
|
99 |
*
|
|
|
100 |
* @return Renvoie le code HTML de la liste des inscrits
|
|
|
101 |
*/
|
|
|
102 |
|
|
|
103 |
function listes_inscrit(& $donnees_membres, & $entete , $case_a_cocher=true) {
|
|
|
104 |
$res = '<div>'."\n";
|
|
|
105 |
if ($case_a_cocher) {$res .= '<form action="'.$GLOBALS['ins_url']->getURL().'"&lettre='.$_REQUEST['lettre'].'" method="post" name="formmail">'."\n";}
|
|
|
106 |
$res .= '<table id="table_inscrit">'."\n".'<colgroup>'."\n";
|
|
|
107 |
if ($case_a_cocher) {$res .= '<col />';}
|
|
|
108 |
foreach($entete as $i) {$res .= '<col />'; }
|
|
|
109 |
$res .= '</colgroup>'."\n".'<thead>'."\n";
|
|
|
110 |
if ($case_a_cocher) {$res .= '<th> </th>'."\n";}
|
|
|
111 |
foreach($entete as $i) {
|
|
|
112 |
$res .= '<th>'.$i.'</th>'."\n";
|
|
|
113 |
}
|
|
|
114 |
$res .= '</thead>'."\n";
|
|
|
115 |
|
|
|
116 |
$indic=0;
|
|
|
117 |
$i=1;
|
|
|
118 |
foreach($entete as $i) {
|
|
|
119 |
if ($indic==0) {
|
|
|
120 |
$res.='<tr class="ligne_impaire">'."\n";
|
|
|
121 |
$indic=1;
|
|
|
122 |
}
|
|
|
123 |
else {
|
|
|
124 |
$res.='<tr class="ligne_paire">'."\n";
|
|
|
125 |
$indic=0;
|
|
|
126 |
}
|
|
|
127 |
}
|
|
|
128 |
for ($i=0;$i<count($donnees_membres);$i++) {
|
|
|
129 |
$id = array_shift($donnees_membres[$i]);
|
|
|
130 |
if ($case_a_cocher) {$res.='<td><input type="checkbox" name="select[]" value="'.$id.'"></td>'."\n";}
|
|
|
131 |
foreach($donnees_membres[$i] as $valeur) $res .= '<td>'.$valeur.'</td>'."\n" ;
|
|
|
132 |
$res .= '</tr>'."\n";
|
|
|
133 |
}
|
|
|
134 |
|
|
|
135 |
$res .= '</table></div>'."\n";
|
|
|
136 |
if ($case_a_cocher) {
|
|
|
137 |
$res .= '<div class="texte">'.ANN_CHECK_UNCHECK ;
|
|
|
138 |
$res .= ' <input type="checkbox" name="selecttotal" onclick="javascript:setCheckboxes(\'formmail\');"></div>';
|
|
|
139 |
$res .= '<h3>'.ANN_ENVOYER_MAIL.'</h3>'."\n";
|
|
|
140 |
$res .= '<div>'."\n".'<table border="0">'."\n"
|
|
|
141 |
.'<tr><td class="texte">'.ANN_SUJET.' :</td>'."\n"
|
|
|
142 |
.'<td><input class="forml" type="text" name="titre_mail" size="60"></td>'."\n"
|
|
|
143 |
.'</tr><tr><td class="texte" valign="top">'.ANN_MESSAGE.' : </td>'."\n"
|
|
|
144 |
.'<td><textarea class="forml" name="corps" rows="5" cols="60"></textarea></td>'."\n"
|
|
|
145 |
.'</tr><tr><td></td><td align="center">';
|
|
|
146 |
$res.='<input type="submit" value="'.ANN_ENVOYER.'">';
|
|
|
147 |
$res.='</td>'."\n".'</tr>'."\n".'</table>'."\n".'</div>'."\n".'</form>'."\n";
|
|
|
148 |
}
|
|
|
149 |
return $res ;
|
|
|
150 |
}
|
|
|
151 |
|
|
|
152 |
|
|
|
153 |
|
|
|
154 |
/** envoie_mail_depuis_annuaire()
|
|
|
155 |
*
|
|
|
156 |
*
|
|
|
157 |
* @return envoie l'email
|
|
|
158 |
*/
|
|
|
159 |
|
|
|
160 |
function envoie_mail_depuis_annuaire() {
|
485 |
alexandre_ |
161 |
$requete = "select ".INS_CHAMPS_MAIL." from ".INS_ANNUAIRE.
|
|
|
162 |
" where ".INS_CHAMPS_ID."='".$GLOBALS['AUTH']->getAuthData (INS_CHAMPS_ID)."'";
|
|
|
163 |
$resultat = $GLOBALS['ins_db']->query($requete);
|
448 |
ddelon |
164 |
if (DB::isError($resultat)) {
|
|
|
165 |
die ($resultat->getMessage().'<br />'.$resultat->getDebugInfo());
|
|
|
166 |
}
|
|
|
167 |
$ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC);
|
485 |
alexandre_ |
168 |
$entete = "From: <".$ligne[INS_CHAMPS_MAIL].">\n";
|
448 |
ddelon |
169 |
|
|
|
170 |
$_POST['corps'] .= ANN_PIED_MESSAGE;
|
|
|
171 |
$_POST['corps'] = stripslashes($_POST['corps']) ;
|
|
|
172 |
$liste = "" ;
|
485 |
alexandre_ |
173 |
$liste_numero = implode (',', $_POST['select']) ;
|
|
|
174 |
$requete_liste_mail = 'select '.INS_CHAMPS_MAIL.' from '.INS_ANNUAIRE.' where '.INS_CHAMPS_ID.
|
|
|
175 |
' in ('.$liste_numero.')' ;
|
|
|
176 |
$resultat_liste_mail = $GLOBALS['ins_db']->query($requete_liste_mail);
|
|
|
177 |
|
|
|
178 |
while ($ligne_liste_mail = $resultat_liste_mail->fetchRow(DB_FETCHMODE_ASSOC)) {
|
|
|
179 |
mail ($ligne_liste_mail[INS_CHAMPS_MAIL], stripslashes($_POST['titre_mail']), $_POST['corps'] , $entete) ;
|
|
|
180 |
$liste .= $ligne_liste_mail[INS_CHAMPS_MAIL]."\n" ;
|
448 |
ddelon |
181 |
}
|
|
|
182 |
|
|
|
183 |
$_POST['corps'] .= "\n----------------------------------------------------------------------------";
|
|
|
184 |
$_POST['corps'] .= "\n".ANN_MESSAGE_ENVOYE_A." :\n $liste" ;
|
|
|
185 |
|
485 |
alexandre_ |
186 |
mail (INS_MAIL_ADMIN_APRES_INSCRIPTION, stripslashes($_POST['titre_mail']), $_POST['corps'], $entete);
|
448 |
ddelon |
187 |
$_POST['corps'] = '';
|
|
|
188 |
$_POST['titre_mail'] = '';
|
|
|
189 |
return '<div>'.ANN_MAIL_ENVOYER.'</div>' ;
|
|
|
190 |
}
|
|
|
191 |
|
|
|
192 |
/* +--Fin du code ----------------------------------------------------------------------------------------+
|
|
|
193 |
*
|
|
|
194 |
* $Log: not supported by cvs2svn $
|
485 |
alexandre_ |
195 |
* Revision 1.1 2005/09/22 14:02:49 ddelon
|
|
|
196 |
* nettoyage annuaire et php5
|
|
|
197 |
*
|
448 |
ddelon |
198 |
* Revision 1.4 2005/09/22 13:30:49 florian
|
|
|
199 |
* modifs pour compatibilité XHTML Strict + corrections de bugs (mais ya encore du boulot!!)
|
|
|
200 |
*
|
|
|
201 |
* Revision 1.3 2005/03/24 08:24:29 alex
|
|
|
202 |
* --
|
|
|
203 |
*
|
|
|
204 |
* Revision 1.2 2005/01/06 15:18:31 alex
|
|
|
205 |
* modification de la fonction de formulaire d'authentification
|
|
|
206 |
*
|
|
|
207 |
* Revision 1.1.1.1 2005/01/03 17:27:49 alex
|
|
|
208 |
* Import initial
|
|
|
209 |
*
|
|
|
210 |
* Revision 1.1 2005/01/03 17:18:49 alex
|
|
|
211 |
* retour vers la liste des participants après un ajout.
|
|
|
212 |
*
|
|
|
213 |
*
|
|
|
214 |
*
|
|
|
215 |
* +-- Fin du code ----------------------------------------------------------------------------------------+
|
|
|
216 |
*/
|
|
|
217 |
?>
|