325 |
florian |
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-04-06 13:33:32 florian 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 |
var_dump($resultat);
|
|
|
84 |
if ($resultat->numRows()>0) {
|
|
|
85 |
$i=0;
|
|
|
86 |
while ($ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
|
|
|
87 |
$donnees_membres[$i++]=$ligne;
|
|
|
88 |
}
|
|
|
89 |
$res .= listes_inscrit($donnees_membres, $GLOBALS['annuaire_champs_visibles']['label_champs']);
|
|
|
90 |
} else {$res .= ANN_PAS_D_INSCRITS;}
|
|
|
91 |
}
|
|
|
92 |
return $res ;
|
|
|
93 |
}
|
|
|
94 |
|
|
|
95 |
/**
|
|
|
96 |
* Renvoie le code HTML de la liste des inscrits
|
|
|
97 |
* en fonction de la requete passé en parametre
|
|
|
98 |
*
|
|
|
99 |
* @return Renvoie le code HTML de la liste des inscrits
|
|
|
100 |
*/
|
|
|
101 |
|
|
|
102 |
function listes_inscrit(& $donnees_membres, & $entete , $case_a_cocher=true) {
|
|
|
103 |
$res = '<div>'."\n";
|
|
|
104 |
if ($case_a_cocher) {$res .= '<form action="'.$GLOBALS['ins_url']->getURL().'"&lettre='.$_REQUEST['lettre'].'" method="post" name="formmail">'."\n";}
|
|
|
105 |
$res .= '<table id="table_inscrit">'."\n".'<colgroup>'."\n";
|
|
|
106 |
if ($case_a_cocher) {$res .= '<col />';}
|
|
|
107 |
foreach($entete as $i) {$res .= '<col />'; }
|
|
|
108 |
$res .= '</colgroup>'."\n".'<thead>'."\n";
|
|
|
109 |
if ($case_a_cocher) {$res .= '<th> </th>'."\n";}
|
|
|
110 |
foreach($entete as $i) {
|
|
|
111 |
$res .= '<th>'.$i.'</th>'."\n";
|
|
|
112 |
}
|
|
|
113 |
$res .= '</thead>'."\n";
|
|
|
114 |
|
|
|
115 |
$indic=0;
|
|
|
116 |
$i=1;
|
|
|
117 |
foreach($entete as $i) {
|
|
|
118 |
if ($indic==0) {
|
|
|
119 |
$res.='<tr class="ligne_impaire">'."\n";
|
|
|
120 |
$indic=1;
|
|
|
121 |
}
|
|
|
122 |
else {
|
|
|
123 |
$res.='<tr class="ligne_paire">'."\n";
|
|
|
124 |
$indic=0;
|
|
|
125 |
}
|
|
|
126 |
}
|
|
|
127 |
for ($i=0;$i<count($donnees_membres);$i++) {
|
|
|
128 |
$id = array_shift($donnees_membres[$i]);
|
|
|
129 |
if ($case_a_cocher) {$res.='<td><input type="checkbox" name="select[]" value="'.$id.'"></td>'."\n";}
|
|
|
130 |
foreach($donnees_membres[$i] as $valeur) $res .= '<td>'.$valeur.'</td>'."\n" ;
|
|
|
131 |
$res .= '</tr>'."\n";
|
|
|
132 |
}
|
|
|
133 |
|
|
|
134 |
$res .= '</table></div>'."\n";
|
|
|
135 |
if ($case_a_cocher) {
|
|
|
136 |
$res .= '<div class="texte">'.ANN_CHECK_UNCHECK ;
|
|
|
137 |
$res .= ' <input type="checkbox" name="selecttotal" onclick="javascript:setCheckboxes(\'formmail\');"></div>';
|
|
|
138 |
$res .= '<h3>'.ANN_ENVOYER_MAIL.'</h3>'."\n";
|
|
|
139 |
$res .= '<div>'."\n".'<table border="0">'."\n"
|
|
|
140 |
.'<tr><td class="texte">'.ANN_SUJET.' :</td>'."\n"
|
|
|
141 |
.'<td><input class="forml" type="text" name="titre_mail" size="60"></td>'."\n"
|
|
|
142 |
.'</tr><tr><td class="texte" valign="top">'.ANN_MESSAGE.' : </td>'."\n"
|
|
|
143 |
.'<td><textarea class="forml" name="corps" rows="5" cols="60"></textarea></td>'."\n"
|
|
|
144 |
.'</tr><tr><td></td><td align="center">';
|
|
|
145 |
$res.='<input type="submit" value="'.ANN_ENVOYER.'">';
|
|
|
146 |
$res.='</td>'."\n".'</tr>'."\n".'</table>'."\n".'</div>'."\n".'</form>'."\n";
|
|
|
147 |
}
|
|
|
148 |
return $res ;
|
|
|
149 |
}
|
|
|
150 |
|
|
|
151 |
|
|
|
152 |
|
|
|
153 |
/** envoie_mail_depuis_annuaire()
|
|
|
154 |
*
|
|
|
155 |
*
|
|
|
156 |
* @return envoie l'email
|
|
|
157 |
*/
|
|
|
158 |
|
|
|
159 |
function envoie_mail_depuis_annuaire() {
|
|
|
160 |
$requete = "select ".ANN_CHAMPS_MAIL." from ".ANN_ANNUAIRE.
|
|
|
161 |
" where ".ANN_CHAMPS_ID."='".$GLOBALS['AUTH']->getAuthData (ANN_CHAMPS_ID)."'";
|
|
|
162 |
$resultat = $GLOBALS['ann_db']->query($requete);
|
|
|
163 |
if (DB::isError($resultat)) {
|
|
|
164 |
die ($resultat->getMessage().'<br />'.$resultat->getDebugInfo());
|
|
|
165 |
}
|
|
|
166 |
$ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC);
|
|
|
167 |
$entete = "From: <".$ligne[ANN_CHAMPS_MAIL].">\n";
|
|
|
168 |
|
|
|
169 |
$_POST['corps'] .= ANN_PIED_MESSAGE;
|
|
|
170 |
$_POST['corps'] = stripslashes($_POST['corps']) ;
|
|
|
171 |
$liste = "" ;
|
|
|
172 |
foreach ($_POST['select'] as $key => $value) {
|
|
|
173 |
mail ($value, stripslashes($_POST['titre_mail']), $_POST['corps'] , $entete) ;
|
|
|
174 |
$liste .= $value."\n" ;
|
|
|
175 |
}
|
|
|
176 |
|
|
|
177 |
$_POST['corps'] .= "\n----------------------------------------------------------------------------";
|
|
|
178 |
$_POST['corps'] .= "\n".ANN_MESSAGE_ENVOYE_A." :\n $liste" ;
|
|
|
179 |
|
|
|
180 |
mail (CAR_MAIL_ADMIN, stripslashes($_POST['titre_mail']), $_POST['corps'], $entete);
|
|
|
181 |
$_POST['corps'] = '';
|
|
|
182 |
$_POST['titre_mail'] = '';
|
|
|
183 |
return '<div>'.ANN_MAIL_ENVOYER.'</div>' ;
|
|
|
184 |
}
|
|
|
185 |
|
|
|
186 |
/* +--Fin du code ----------------------------------------------------------------------------------------+
|
|
|
187 |
*
|
|
|
188 |
* $Log: not supported by cvs2svn $
|
|
|
189 |
* Revision 1.3 2005/03/24 08:24:29 alex
|
|
|
190 |
* --
|
|
|
191 |
*
|
|
|
192 |
* Revision 1.2 2005/01/06 15:18:31 alex
|
|
|
193 |
* modification de la fonction de formulaire d'authentification
|
|
|
194 |
*
|
|
|
195 |
* Revision 1.1.1.1 2005/01/03 17:27:49 alex
|
|
|
196 |
* Import initial
|
|
|
197 |
*
|
|
|
198 |
* Revision 1.1 2005/01/03 17:18:49 alex
|
|
|
199 |
* retour vers la liste des participants après un ajout.
|
|
|
200 |
*
|
|
|
201 |
*
|
|
|
202 |
*
|
|
|
203 |
* +-- Fin du code ----------------------------------------------------------------------------------------+
|
|
|
204 |
*/
|
|
|
205 |
?>
|