Subversion Repositories Applications.papyrus

Rev

Rev 1186 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1186 Rev 1292
1
<?php
1
<?php
2
/*vim: set expandtab tabstop=4 shiftwidth=4: */ 
2
/*vim: set expandtab tabstop=4 shiftwidth=4: */ 
3
// +------------------------------------------------------------------------------------------------------+
3
// +------------------------------------------------------------------------------------------------------+
4
// | PHP version 4.1                                                                                      |
4
// | PHP version 4.1                                                                                      |
5
// +------------------------------------------------------------------------------------------------------+
5
// +------------------------------------------------------------------------------------------------------+
6
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org)                                         |
6
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org)                                         |
7
// +------------------------------------------------------------------------------------------------------+
7
// +------------------------------------------------------------------------------------------------------+
8
// | This library is free software; you can redistribute it and/or                                        |
8
// | This library is free software; you can redistribute it and/or                                        |
9
// | modify it under the terms of the GNU Lesser General Public                                           |
9
// | modify it under the terms of the GNU Lesser General Public                                           |
10
// | License as published by the Free Software Foundation; either                                         |
10
// | License as published by the Free Software Foundation; either                                         |
11
// | version 2.1 of the License, or (at your option) any later version.                                   |
11
// | version 2.1 of the License, or (at your option) any later version.                                   |
12
// |                                                                                                      |
12
// |                                                                                                      |
13
// | This library is distributed in the hope that it will be useful,                                      |
13
// | This library is distributed in the hope that it will be useful,                                      |
14
// | but WITHOUT ANY WARRANTY; without even the implied warranty of                                       |
14
// | but WITHOUT ANY WARRANTY; without even the implied warranty of                                       |
15
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU                                    |
15
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU                                    |
16
// | Lesser General Public License for more details.                                                      |
16
// | Lesser General Public License for more details.                                                      |
17
// |                                                                                                      |
17
// |                                                                                                      |
18
// | You should have received a copy of the GNU Lesser General Public                                     |
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                                  |
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                            |
20
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                            |
21
// +------------------------------------------------------------------------------------------------------+
21
// +------------------------------------------------------------------------------------------------------+
22
// CVS : $Id: annuaire.fonct.php,v 1.5 2007-01-04 16:34:31 alexandre_tb Exp $
22
// CVS : $Id: annuaire.fonct.php,v 1.6 2007-04-06 08:35:46 neiluj Exp $
23
/**
23
/**
24
* Fonctions du module annuaire
24
* Fonctions du module annuaire
25
*
25
*
26
* Fonctions du module annuaire
26
* Fonctions du module annuaire
27
*
27
*
28
*@package annuaire
28
*@package annuaire
29
//Auteur original :
29
//Auteur original :
30
*@author        Alexandre Granier <alexandre@tela-botanica.org>
30
*@author        Alexandre Granier <alexandre@tela-botanica.org>
31
//Autres auteurs :
31
//Autres auteurs :
32
*@author        Aucun
32
*@author        Aucun
33
*@copyright     Tela-Botanica 2000-2004
33
*@copyright     Tela-Botanica 2000-2004
34
*@version       $Revision: 1.5 $
34
*@version       $Revision: 1.6 $
35
// +------------------------------------------------------------------------------------------------------+
35
// +------------------------------------------------------------------------------------------------------+
36
*/
36
*/
37
 
37
 
38
// +------------------------------------------------------------------------------------------------------+
38
// +------------------------------------------------------------------------------------------------------+
39
// |                                            ENTETE du PROGRAMME                                       |
39
// |                                            ENTETE du PROGRAMME                                       |
40
// +------------------------------------------------------------------------------------------------------+
40
// +------------------------------------------------------------------------------------------------------+
41
 
41
 
42
//include_once "HTML/QuickForm.php" ;
42
include_once "HTML/QuickForm.php" ;
43
 
43
 
44
// +------------------------------------------------------------------------------------------------------+
44
// +------------------------------------------------------------------------------------------------------+
45
// |                                           LISTE de FONCTIONS                                         |
45
// |                                           LISTE de FONCTIONS                                         |
46
// +------------------------------------------------------------------------------------------------------+
46
// +------------------------------------------------------------------------------------------------------+
47
 
-
 
48
/** function inscription_onglets()  Affiche les onglets de présentation de la structure
-
 
49
*
-
 
50
*
-
 
51
*
-
 
52
*	@return string HTML
-
 
53
*/
-
 
54
function inscription_onglets() {
-
 
55
	$res='<ul id="onglets_inscription">'."\n";
-
 
56
	//partie présentation
-
 
57
	$GLOBALS['ins_url']->addQueryString('voir_fiche', $_GET['voir_fiche']);
-
 
58
	$res .= '<li id="fiche"><a href="'.$GLOBALS['ins_url']->getURL().'">'.INS_PRESENTATION.'</a>'."\n".'</li>'."\n";
-
 
59
	$GLOBALS['ins_url']->removeQueryString('voir_fiche');
-
 
60
	//partie abonnement
-
 
61
	$GLOBALS['ins_url']->addQueryString('voir_abonnement', $_GET['voir_fiche']);
-
 
62
	$res .= '<li id="abonnements"><a href="'.$GLOBALS['ins_url']->getURL().'">'.INS_ABONNEMENTS.'</a></li>'."\n" ;
-
 
63
	$GLOBALS['ins_url']->removeQueryString('voir_abonnement');
-
 
64
	//partie actualites
-
 
65
	$GLOBALS['ins_url']->addQueryString('voir_actus', $_GET['voir_fiche']);
-
 
66
	$res .= '<li id="actus"><a href="'.$GLOBALS['ins_url']->getURL().'">'.INS_ACTUALITES.'</a>'."\n".'</li>'."\n";
-
 
67
	$GLOBALS['ins_url']->removeQueryString('voir_actus');
-
 
68
	//partie ressources
-
 
69
	$GLOBALS['ins_url']->addQueryString('voir_ressources', $_GET['voir_fiche']);
-
 
70
	$res .= '<li id="ressources"><a href="'.$GLOBALS['ins_url']->getURL().'">'.INS_RESSOURCES.'</a>'."\n".'</li>'."\n";
-
 
71
	$GLOBALS['ins_url']->removeQueryString('voir_ressources');
-
 
72
	//partie competences
-
 
73
	$GLOBALS['ins_url']->addQueryString('voir_competences', $_GET['voir_fiche']);
-
 
74
	$res .= '<li id="competences"><a href="'.$GLOBALS['ins_url']->getURL().'">'.INS_COMPETENCES.'</a>'."\n".'</li>'."\n";
-
 
75
	$GLOBALS['ins_url']->removeQueryString('voir_competences');
-
 
76
	$res.= '</ul>'."\n";
-
 
77
	return $res;
-
 
78
}
-
 
79
 
47
 
80
/** function Annuaire_recherche ()  Moteur de recherche dans l'annuaire des inscrits
48
/** function Annuaire_recherche ()  Moteur de recherche dans l'annuaire des inscrits
81
*
49
*
82
*
50
*
83
*
51
*
84
*	@return string HTML
52
*	@return string HTML
85
*/
53
*/
-
 
54
 
86
function Annuaire_recherche() {
55
function Annuaire_recherche() {
87
	$res ='<h2>'.INS_RECHERCHE_ANNUAIRE_DES_INSCRITS.'</h2>'."\n";
56
	$res ='<h2>'.INS_RECHERCHE_ANNUAIRE_DES_INSCRITS.'</h2>'."\n";
88
	$form =& new HTML_QuickForm('form_recherche_annuaire', 'post', str_replace('&amp;', '&', $GLOBALS['ins_url']->getURL()));
57
	$form =& new HTML_QuickForm('form_recherche_annuaire', 'post', str_replace('&amp;', '&', $GLOBALS['ins_url']->getURL()));
89
    $squelette =& $form->defaultRenderer();
58
    $squelette =& $form->defaultRenderer();
90
    $squelette->setFormTemplate("\n".'<form{attributes}>'."\n".'<table>'."\n".'{content}'."\n".'</table>'."\n".'</form>'."\n");
59
    $squelette->setFormTemplate("\n".'<form{attributes}>'."\n".'<table>'."\n".'{content}'."\n".'</table>'."\n".'</form>'."\n");
91
    $squelette->setElementTemplate( '<tr>'."\n".
60
    $squelette->setElementTemplate( '<tr>'."\n".
92
                                    '<td style="padding:5px;text-align:right;">{label}'.
61
                                    '<td style="padding:5px;text-align:right;">{label}'.
93
                                    '<!-- BEGIN required --><span class="symbole_obligatoire">*</span><!-- END required -->'."\n".
62
                                    '<!-- BEGIN required --><span class="symbole_obligatoire">*</span><!-- END required -->'."\n".
94
                                    '<!-- BEGIN error --><span class="erreur">{error}</span><!-- END error -->'."\n".
63
                                    '<!-- BEGIN error --><span class="erreur">{error}</span><!-- END error -->'."\n".
95
									' : </td>'."\n".
64
									' : </td>'."\n".
96
                                    '<td style="padding:5px;text-align:left;">{element}</td>'."\n".
65
                                    '<td style="padding:5px;text-align:left;">{element}</td>'."\n".
97
                                    '</tr>'."\n" );
66
                                    '</tr>'."\n" );
98
    $squelette->setElementTemplate( '<tr>'."\n".'<td colspan=2 style="padding:5px;">{label}{element}</td>'."\n".'</tr>'."\n", 'bouton_rechercher');
67
    $squelette->setElementTemplate( '<tr>'."\n".'<td colspan=2 style="padding:5px;">{label}{element}</td>'."\n".'</tr>'."\n", 'bouton_rechercher');
99
    
68
    
-
 
69
    //$option_type=array ('0' => INS_PERSONNES_OU_STRUCTURES,
100
    // La liste deroulante pour choisir entre structure et individus
70
    //                    '1' => INS_PERSONNES,
-
 
71
    //                    '2' => INS_STRUCTURES);
101
    // uniquement si la constante INS_FORMULAIRE_STRUCTURE vaut 1
-
 
102
    
-
 
103
    if (INS_FORMULAIRE_STRUCTURE == 1) {
-
 
104
	    $option_type=array ('0' => INS_PERSONNES_OU_STRUCTURES,
-
 
105
	                        '1' => INS_PERSONNES,
-
 
106
	                        '2' => INS_STRUCTURES);
-
 
107
	    $form->addElement('select', 'nom_type', INS_JE_RECHERCHE, $option_type);
72
    $form->addElement('hidden', 'nom_type', 0);
108
    }
73
    
109
    //requete pour recuperer la liste des pays
74
    //requete pour recuperer la liste des pays
110
    $requete = 'SELECT '.INS_CHAMPS_ID_PAYS.', '.INS_CHAMPS_LABEL_PAYS.' FROM '.INS_TABLE_PAYS.' WHERE '.INS_CHAMPS_I18N_PAYS.'="fr-FR"';
75
    $requete = 'SELECT '.INS_CHAMPS_ID_PAYS.', '.INS_CHAMPS_LABEL_PAYS.' FROM '.INS_TABLE_PAYS.' WHERE '.INS_CHAMPS_I18N_PAYS.'="fr-FR"';
111
	$resultat = $GLOBALS['ins_db']->query($requete) ;
76
	$resultat = $GLOBALS['ins_db']->query($requete) ;
112
	if (DB::isError($resultat)) {
77
	if (DB::isError($resultat)) {
113
	    die ("Echec de la requete : $requete<br />".$resultat->getMessage()) ;
78
	    die ("Echec de la requete : $requete<br />".$resultat->getMessage()) ;
114
	}
79
	}
115
	$option_pays = array('zz' => INS_TOUS_PAYS) ;
80
	$option_pays = array('zz' => INS_TOUS_PAYS) ;
116
	while ($ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
81
	while ($ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
117
	    $option_pays[$ligne[INS_CHAMPS_ID_PAYS]] = $ligne[INS_CHAMPS_LABEL_PAYS] ;
82
	    $option_pays[$ligne[INS_CHAMPS_ID_PAYS]] = $ligne[INS_CHAMPS_LABEL_PAYS] ;
118
	}
83
	}
119
    $form->addElement('select', 'nom_pays', INS_PAYS, $option_pays);
84
    $form->addElement('select', 'nom_pays', INS_PAYS, $option_pays);
120
    
85
    
121
    //requete pour recuperer la liste des départements
86
    //requete pour recuperer la liste des départements
122
    $requete = 'SELECT '.INS_CHAMPS_ID_DEPARTEMENT.', '.INS_CHAMPS_NOM_DEPARTEMENT.' FROM '.INS_TABLE_DPT;
87
    $requete = 'SELECT '.INS_CHAMPS_ID_DEPARTEMENT.', '.INS_CHAMPS_NOM_DEPARTEMENT.' FROM '.INS_TABLE_DPT;
123
	$resultat = $GLOBALS['ins_db']->query($requete) ;
88
	$resultat = $GLOBALS['ins_db']->query($requete) ;
124
	if (DB::isError($resultat)) {
89
	if (DB::isError($resultat)) {
125
	    die ("Echec de la requete : $requete<br />".$resultat->getMessage()) ;
90
	    die ("Echec de la requete : $requete<br />".$resultat->getMessage()) ;
126
	}
91
	}
127
	$option_departements = array('0' => INS_TOUS_DEPARTEMENTS) ;
92
	$option_departements = array('0' => INS_TOUS_DEPARTEMENTS) ;
128
	while ($ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
93
	while ($ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
129
	    $option_departements[$ligne[INS_CHAMPS_ID_DEPARTEMENT]] = $ligne[INS_CHAMPS_NOM_DEPARTEMENT] ;
94
	    $option_departements[$ligne[INS_CHAMPS_ID_DEPARTEMENT]] = $ligne[INS_CHAMPS_NOM_DEPARTEMENT] ;
130
	}
95
	}
131
    $form->addElement('select', 'nom_departement', INS_DEPARTEMENT_POUR_LA_FRANCE, $option_departements);
96
    $form->addElement('select', 'nom_departement', INS_DEPARTEMENT_POUR_LA_FRANCE, $option_departements);
132
	
97
	
133
	$form->addElement('text', 'nom_annuaire', INS_NOM_ANNUAIRE);
98
	$form->addElement('text', 'nom_annuaire', INS_NOM_ANNUAIRE);
134
	
99
	
135
	$form->addElement('submit', 'bouton_rechercher', INS_RECHERCHER);
100
	$form->addElement('submit', 'bouton_rechercher', INS_RECHERCHER);
136
	
101
	
137
	//valeurs par defaut
102
	//valeurs par defaut
138
	$defauts=array('nom_pays'=>'fr','nom_departement'=>'0');
103
	$defauts=array('nom_pays'=>'fr','nom_departement'=>'0');
139
	$form->setDefaults($defauts);
104
	$form->setDefaults($defauts);
140
	
105
	
141
	//affichage du formulaire
106
	//affichage du formulaire
142
	$res .=$form->toHtml();
107
	$res .=$form->toHtml();
143
	
-
 
144
	include_once INS_CHEMIN_APPLI.'/bibliotheque/bottin.class.php';
-
 
145
	// On ajoute la liste des lettres cliquables
-
 
146
	$lettre = new lettresAlphabet($GLOBALS['ins_url']) ;
-
 
147
	$res .= $lettre->toHMTL();
-
 
148
	
108
	
149
	//on teste si l'on affiche le resultat de la recherche ou 
109
	//on teste si l'on affiche le resultat de la recherche ou 
150
	if (isset($_POST['nom_type'])) {
110
	if (isset($_POST['nom_type'])) {
151
		$requete = 'SELECT '.INS_CHAMPS_ID.', '.INS_CHAMPS_NOM.', '.INS_CHAMPS_PRENOM.', '.INS_CHAMPS_VILLE.', '.INS_CHAMPS_CODE_POSTAL;
111
		$requete = 'SELECT '.INS_CHAMPS_ID.', '.INS_CHAMPS_NOM.', '.INS_CHAMPS_PRENOM.', '.INS_CHAMPS_VILLE.', '.INS_CHAMPS_CODE_POSTAL;
152
		$requete .= ' FROM '.INS_ANNUAIRE.' WHERE ';
112
		$requete .= ' FROM '.INS_ANNUAIRE.' WHERE ';
153
		$req_where=0;
113
		$req_where=0;
154
		if ($_POST['nom_type']==1) {
114
		if ($_POST['nom_type']==1) {
155
			$requete .= INS_CHAMPS_EST_STRUCTURE.'=0 ';
115
			$requete .= INS_CHAMPS_EST_STRUCTURE.'=0 ';
156
			$req_where=1;
116
			$req_where=1;
157
		} elseif ($_POST['nom_type']==2) {
117
		} elseif ($_POST['nom_type']==2) {
158
			$requete .= INS_CHAMPS_EST_STRUCTURE.'=1 ';
118
			$requete .= INS_CHAMPS_EST_STRUCTURE.'=1 ';
159
			$req_where=1;
119
			$req_where=1;
160
		}
120
		}
161
		if ($_POST['nom_pays']!='0'and$_POST['nom_pays']!='zz') {
121
		if ($_POST['nom_pays']!='0'and$_POST['nom_pays']!='zz') {
162
			if ($req_where) {
122
			if ($req_where) {
163
				$requete .= 'AND ';
123
				$requete .= 'AND ';
164
			} else {
124
			} else {
165
				$req_where=1;
125
				$req_where=1;
166
			} 
126
			} 
167
			$requete .= INS_CHAMPS_PAYS.'="'.$_POST['nom_pays'].'" ';
127
			$requete .= INS_CHAMPS_PAYS.'="'.$_POST['nom_pays'].'" ';
168
		}
128
		}
169
		if ($_POST['nom_departement']!='0') {
129
		if ($_POST['nom_departement']!='0') {
170
			if ($req_where) {
130
			if ($req_where) {
171
				$requete .= 'AND ';
131
				$requete .= 'AND ';
172
			} else {
132
			} else {
173
				$req_where=1;
133
				$req_where=1;
174
			} 
134
			} 
175
			$requete .= INS_CHAMPS_DEPARTEMENT.'="'.$_POST['nom_departement'].'" ';
135
			$requete .= INS_CHAMPS_DEPARTEMENT.'="'.$_POST['nom_departement'].'" ';
176
		}
136
		}
177
		if ($_POST['nom_annuaire']!='') {
137
		if ($_POST['nom_annuaire']!='') {
178
			if ($req_where) {
138
			if ($req_where) {
179
				$requete .= 'AND ';
139
				$requete .= 'AND ';
180
			} else {
140
			} else {
181
				$req_where=1;
141
				$req_where=1;
182
			} 
142
			} 
183
			$requete .= '('.INS_CHAMPS_NOM.' LIKE "%'.$_POST['nom_annuaire'].'%"'.
143
			$requete .= '('.INS_CHAMPS_NOM.' LIKE "%'.$_POST['nom_annuaire'].'%"'.
184
						' OR '.INS_CHAMPS_PRENOM.' LIKE "%'.$_POST['nom_annuaire'].'%"'.
144
						' OR '.INS_CHAMPS_PRENOM.' LIKE "%'.$_POST['nom_annuaire'].'%"'.
185
						' OR '.INS_CHAMPS_SIGLE_STRUCTURE.' LIKE "%'.$_POST['nom_annuaire'].'%"'.
145
						' OR '.INS_CHAMPS_SIGLE_STRUCTURE.' LIKE "%'.$_POST['nom_annuaire'].'%"'.
186
						' OR '.INS_CHAMPS_DESCRIPTION.' LIKE "%'.$_POST['nom_annuaire'].'%") ';
146
						' OR '.INS_CHAMPS_DESCRIPTION.' LIKE "%'.$_POST['nom_annuaire'].'%") ';
187
		}
147
		}
188
		if (isset($_GET['lettre'])) {
-
 
189
			$requete .= 'AND '.INS_CHAMPS_NOM.'like "'.$_GET['lettre'].'%"';
-
 
190
		}
-
 
191
		if (!$req_where) $requete .= '1';
148
		if (!$req_where) $requete .= '1';
192
		$requete .=' ORDER BY '.INS_CHAMPS_NOM;
149
		$requete .=' ORDER BY '.INS_CHAMPS_NOM;
193
		$resultat = $GLOBALS['ins_db']->query($requete);
150
		$resultat = $GLOBALS['ins_db']->query($requete);
194
		if ($resultat->numRows()>0) {
151
		if ($resultat->numRows()>0) {
195
			$res .='<h2>'.INS_RESULTATS_RECHERCHE.' ('.$resultat->numRows().' '.INS_ENTREES.')</h2>'."\n";
152
			$res .='<h2>'.INS_RESULTATS_RECHERCHE.' ('.$resultat->numRows().' '.INS_ENTREES.')</h2>'."\n";
196
			$res .='<p class="zone_info">'.INS_CLIQUER_ELEMENT_LISTE.'</p>'."\n";
153
			$res .='<p class="zone_info">'.INS_CLIQUER_ELEMENT_LISTE.'</p>'."\n";
197
			$i=0;
154
			$i=0;
198
			while ($ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
155
			while ($ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
199
				$donnees_membres[$i++]=$ligne;
156
				$donnees_membres[$i++]=$ligne;
200
			}
157
			}
201
		    $res .= listes_inscrit($donnees_membres);
158
		    $res .= listes_inscrit($donnees_membres);
202
		}
159
		}
203
		else {
160
		else {
204
			$res .='<h2>'.INS_RESULTATS_RECHERCHE.'</h2>'."\n";
161
			$res .='<h2>'.INS_RESULTATS_RECHERCHE.'</h2>'."\n";
205
			$res .= '<p class="zone_alert">'.INS_PAS_DE_RESULTATS.'</p>'."\n";
162
			$res .= '<p class="zone_alert">'.INS_PAS_DE_RESULTATS.'</p>'."\n";
206
		}
163
		}
207
	} else {		
164
	} else {		
208
		$res .='<h2>'.INS_DIX_DERNIERES_INSCRIPTIONS.'</h2>'."\n";
165
		$res .='<h2>'.INS_DIX_DERNIERES_INSCRIPTIONS.'</h2>'."\n";
209
		$requete = 'SELECT '.INS_CHAMPS_ID.', '.INS_CHAMPS_NOM.', '.INS_CHAMPS_PRENOM.', '.INS_CHAMPS_VILLE.', '.INS_CHAMPS_CODE_POSTAL;
166
		$requete = 'SELECT '.INS_CHAMPS_ID.', '.INS_CHAMPS_NOM.', '.INS_CHAMPS_PRENOM.', '.INS_CHAMPS_VILLE.', '.INS_CHAMPS_CODE_POSTAL;
210
		$requete .= ' FROM '.INS_ANNUAIRE.' ORDER BY '.INS_CHAMPS_DATE.' DESC LIMIT 0 , 10';
167
		$requete .= ' FROM '.INS_ANNUAIRE.' ORDER BY '.INS_CHAMPS_DATE.' DESC LIMIT 0 , 10';
211
		$resultat = $GLOBALS['ins_db']->query($requete);
168
		$resultat = $GLOBALS['ins_db']->query($requete);
212
		if ($resultat->numRows()>0) {
169
		if ($resultat->numRows()>0) {
213
			$i=0;
170
			$i=0;
214
			while ($ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
171
			while ($ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
215
				$donnees_membres[$i++]=$ligne;
172
				$donnees_membres[$i++]=$ligne;
216
			}
173
			}
217
		    $res .= listes_inscrit($donnees_membres, 0);
174
		    $res .= listes_inscrit($donnees_membres, 0);
218
		}
175
		}
219
		else {
176
		else {
220
			$res .= '<p class="zone_alert">'.INS_PAS_DE_RESULTATS.'</p>'."\n";
177
			$res .= '<p class="zone_alert">'.INS_PAS_DE_RESULTATS.'</p>'."\n";
221
		}
178
		}
222
	}
179
	}
223
    return $res ;
180
    return $res ;
224
}
181
}
225
 
182
 
226
/**
183
/**
227
 *  Renvoie le code HTML de la liste des inscrits
184
 *  Renvoie le code HTML de la liste des inscrits
228
 *  en fonction de la requete passé en parametre
185
 *  en fonction de la requete passé en parametre
229
 *
186
 *
230
 * @return  Renvoie le code HTML de la liste des inscrits
187
 * @return  Renvoie le code HTML de la liste des inscrits
231
 */
188
 */
232
 
189
 
233
function listes_inscrit(& $donnees_membres, $affiche_form_mail=1) {
190
function listes_inscrit(& $donnees_membres, $affiche_form_mail=1) {
234
    $res = '';
191
    $res = '';
235
    if ($GLOBALS['AUTH']->getAuth()&&$affiche_form_mail) {$res .= '<form action="'.$GLOBALS['ins_url']->getURL().'" method="post" name="formmail">'."\n";}
192
    if ($GLOBALS['AUTH']->getAuth()&&$affiche_form_mail) {$res .= '<form action="'.$GLOBALS['ins_url']->getURL().'" method="post" name="formmail">'."\n";}
236
    $res .= '<ul>'."\n";
193
    $res .= '<ul>'."\n";
237
    for ($i=0;$i<count($donnees_membres);$i++) {
194
    for ($i=0;$i<count($donnees_membres);$i++) {
238
    	$id = array_shift($donnees_membres[$i]);
195
    	$id = array_shift($donnees_membres[$i]);
239
    	$GLOBALS['ins_url']->addQueryString('voir_fiche', $id);
196
    	$GLOBALS['ins_url']->addQueryString('voir_fiche', $id);
240
    	$res .= '<li><a href="'.$GLOBALS['ins_url']->getURL().'">'."\n";
197
    	$res .= '<li><a href="'.$GLOBALS['ins_url']->getURL().'">'."\n";
241
    	if ($GLOBALS['AUTH']->getAuth()&&$affiche_form_mail) {
198
    	if ($GLOBALS['AUTH']->getAuth()&&$affiche_form_mail) {
242
    		$res.='<input type="checkbox" name="select[]" value="'.$id.'">'."\n";
199
    		$res.='<input type="checkbox" name="select[]" value="'.$id.'">'."\n";
243
    	}
200
    	}
244
    	$res .= '<strong>'.$donnees_membres[$i][INS_CHAMPS_NOM].
201
    	$res .= '<strong>'.$donnees_membres[$i][INS_CHAMPS_NOM].
245
				'&nbsp;'.$donnees_membres[$i][INS_CHAMPS_PRENOM].'</strong>'."\n".
202
				'&nbsp;'.$donnees_membres[$i][INS_CHAMPS_PRENOM].'</strong>'."\n".
246
    	        '&nbsp;'.$donnees_membres[$i][INS_CHAMPS_CODE_POSTAL].
203
    	        '&nbsp;'.$donnees_membres[$i][INS_CHAMPS_CODE_POSTAL].
247
    	        '&nbsp;'.$donnees_membres[$i][INS_CHAMPS_VILLE];
204
    	        '&nbsp;'.$donnees_membres[$i][INS_CHAMPS_VILLE];
248
    	$res .= '</a></li>'."\n";
205
    	$res .= '</a></li>'."\n";
249
    }
206
    }
250
    $res .= '</ul>'."\n";
207
    $res .= '</ul>'."\n";
251
    if ($GLOBALS['AUTH']->getAuth()&&$affiche_form_mail) {
208
    if ($GLOBALS['AUTH']->getAuth()&&$affiche_form_mail) {
252
    	$res .= INS_CHECK_UNCHECK ;
209
    	$res .= INS_CHECK_UNCHECK ;
253
    	$res .= '&nbsp;<input type="checkbox" name="selecttotal" onclick="javascript:setCheckboxes(\'formmail\');"><br />';
210
    	$res .= '&nbsp;<input type="checkbox" name="selecttotal" onclick="javascript:setCheckboxes(\'formmail\');"><br />';
254
    	$res .= '<h3>'.INS_ENVOYER_MAIL.'</h3>'."\n";
211
    	$res .= '<h3>'.INS_ENVOYER_MAIL.'</h3>'."\n";
255
    	$res .= '<p style="text-align:right;">'.INS_SUJET.'&nbsp;:&nbsp;<input style="border:1px solid #000;width:450px;" type="text" name="titre_mail"><br />'."\n".
212
    	$res .= '<p style="text-align:right;">'.INS_SUJET.'&nbsp;:&nbsp;<input style="border:1px solid #000;width:450px;" type="text" name="titre_mail"><br />'."\n".
256
           		INS_MESSAGE.'&nbsp;:&nbsp;<textarea style="border:1px solid #000;width:450px;" name="corps" rows="5" cols="60"></textarea></p>'."\n".
213
           		INS_MESSAGE.'&nbsp;:&nbsp;<textarea style="border:1px solid #000;width:450px;" name="corps" rows="5" cols="60"></textarea></p>'."\n".
257
           		'<p style="width:100px;margin:4px auto;text-align:center;"><input type="submit" value="'.INS_ENVOYER.'" /></p>'."\n".
214
           		'<p style="width:100px;margin:4px auto;text-align:center;"><input type="submit" value="'.INS_ENVOYER.'" /></p>'."\n".
258
				'</form>'."\n";
215
				'</form>'."\n";
259
	} else {
216
	} else {
260
		if ($affiche_form_mail) $res .='<br /><p class="zone_info">'.INS_PAS_IDENTIFIE.'</p>'."\n";
217
		if ($affiche_form_mail) $res .='<br /><p class="zone_info">'.INS_PAS_IDENTIFIE.'</p>'."\n";
261
    }
218
    }
262
    return $res ;
219
    return $res ;
263
}
220
}
264
 
221
 
265
 
222
 
266
 
223
 
267
/** envoie_mail_depuis_annuaire()
224
/** envoie_mail_depuis_annuaire()
268
 *
225
 *
269
 *
226
 *
270
 * @return  envoie l'email
227
 * @return  envoie l'email
271
 */
228
 */
272
 
229
 
273
function envoie_mail_depuis_annuaire() {
230
function envoie_mail_depuis_annuaire() {
274
    $requete = "select ".INS_CHAMPS_MAIL." from ".INS_ANNUAIRE.
231
    $requete = "select ".INS_CHAMPS_MAIL." from ".INS_ANNUAIRE.
275
            " where ".INS_CHAMPS_ID."='".$GLOBALS['AUTH']->getAuthData (INS_CHAMPS_ID)."'";
232
            " where ".INS_CHAMPS_ID."='".$GLOBALS['AUTH']->getAuthData (INS_CHAMPS_ID)."'";
276
    $resultat = $GLOBALS['ins_db']->query($requete);
233
    $resultat = $GLOBALS['ins_db']->query($requete);
277
    if (DB::isError($resultat)) {
234
    if (DB::isError($resultat)) {
278
        die ($resultat->getMessage().'<br />'.$resultat->getDebugInfo());
235
        die ($resultat->getMessage().'<br />'.$resultat->getDebugInfo());
279
    }
236
    }
280
    $ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC);
237
    $ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC);
281
    $entete = "From: <".$ligne[INS_CHAMPS_MAIL].">\n";
238
    $entete = "From: <".$ligne[INS_CHAMPS_MAIL].">\n";
282
    
239
    
283
    $_POST['corps'] .= ANN_PIED_MESSAGE;
240
    $_POST['corps'] .= ANN_PIED_MESSAGE;
284
    $_POST['corps'] = stripslashes($_POST['corps']) ;
241
    $_POST['corps'] = stripslashes($_POST['corps']) ;
285
    $liste = "" ;
242
    $liste = "" ;
286
    $liste_numero = implode (',', $_POST['select']) ;
243
    $liste_numero = implode (',', $_POST['select']) ;
287
    $requete_liste_mail = 'select '.INS_CHAMPS_MAIL.' from '.INS_ANNUAIRE.' where '.INS_CHAMPS_ID.
244
    $requete_liste_mail = 'select '.INS_CHAMPS_MAIL.' from '.INS_ANNUAIRE.' where '.INS_CHAMPS_ID.
288
    						' in ('.$liste_numero.')' ; 
245
    						' in ('.$liste_numero.')' ; 
289
    $resultat_liste_mail = $GLOBALS['ins_db']->query($requete_liste_mail);
246
    $resultat_liste_mail = $GLOBALS['ins_db']->query($requete_liste_mail);
290
    
247
    
291
    while ($ligne_liste_mail = $resultat_liste_mail->fetchRow(DB_FETCHMODE_ASSOC)) {
248
    while ($ligne_liste_mail = $resultat_liste_mail->fetchRow(DB_FETCHMODE_ASSOC)) {
292
        mail ($ligne_liste_mail[INS_CHAMPS_MAIL], stripslashes($_POST['titre_mail']), $_POST['corps'] , $entete) ;
249
        mail ($ligne_liste_mail[INS_CHAMPS_MAIL], stripslashes($_POST['titre_mail']), $_POST['corps'] , $entete) ;
293
        $liste .= $ligne_liste_mail[INS_CHAMPS_MAIL]."\n" ;
250
        $liste .= $ligne_liste_mail[INS_CHAMPS_MAIL]."\n" ;
294
    }
251
    }
295
    
252
    
296
    $_POST['corps'] .= "\n----------------------------------------------------------------------------";
253
    $_POST['corps'] .= "\n----------------------------------------------------------------------------";
297
    $_POST['corps'] .= "\n".ANN_MESSAGE_ENVOYE_A." :\n $liste" ;
254
    $_POST['corps'] .= "\n".ANN_MESSAGE_ENVOYE_A." :\n $liste" ;
298
    
255
    
299
    mail (INS_MAIL_ADMIN_APRES_INSCRIPTION, stripslashes($_POST['titre_mail']), $_POST['corps'], $entete);
256
    mail (INS_MAIL_ADMIN_APRES_INSCRIPTION, stripslashes($_POST['titre_mail']), $_POST['corps'], $entete);
300
    $_POST['corps'] = '';
257
    $_POST['corps'] = '';
301
    $_POST['titre_mail'] = '';
258
    $_POST['titre_mail'] = '';
302
    return '<div>'.ANN_MAIL_ENVOYER.'</div>' ;
259
    return '<div>'.ANN_MAIL_ENVOYER.'</div>' ;
303
}
260
}
304
 
261
 
305
/* +--Fin du code ----------------------------------------------------------------------------------------+
262
/* +--Fin du code ----------------------------------------------------------------------------------------+
306
*
263
*
307
* $Log: not supported by cvs2svn $
264
* $Log: not supported by cvs2svn $
308
* Revision 1.4  2006/04/10 14:01:36  florian
-
 
309
* uniformisation de l'appli bottin: plus qu'un fichier de fonctions
-
 
310
*
-
 
311
* Revision 1.3  2006/04/04 12:23:05  florian
-
 
312
* modifs affichage fiches, généricité de la carto, modification totale de l'appli annuaire
-
 
313
*
-
 
314
* Revision 1.2  2005/09/29 16:13:54  alexandre_tb
265
* Revision 1.2  2005/09/29 16:13:54  alexandre_tb
315
* En cours de production.
266
* En cours de production.
316
*
267
*
317
* Revision 1.1  2005/09/22 14:02:49  ddelon
268
* Revision 1.1  2005/09/22 14:02:49  ddelon
318
* nettoyage annuaire et php5
269
* nettoyage annuaire et php5
319
*
270
*
320
* Revision 1.4  2005/09/22 13:30:49  florian
271
* Revision 1.4  2005/09/22 13:30:49  florian
321
* modifs pour compatibilité XHTML Strict + corrections de bugs (mais ya encore du boulot!!)
272
* modifs pour compatibilité XHTML Strict + corrections de bugs (mais ya encore du boulot!!)
322
*
273
*
323
* Revision 1.3  2005/03/24 08:24:29  alex
274
* Revision 1.3  2005/03/24 08:24:29  alex
324
* --
275
* --
325
*
276
*
326
* Revision 1.2  2005/01/06 15:18:31  alex
277
* Revision 1.2  2005/01/06 15:18:31  alex
327
* modification de la fonction de formulaire d'authentification
278
* modification de la fonction de formulaire d'authentification
328
*
279
*
329
* Revision 1.1.1.1  2005/01/03 17:27:49  alex
280
* Revision 1.1.1.1  2005/01/03 17:27:49  alex
330
* Import initial
281
* Import initial
331
*
282
*
332
* Revision 1.1  2005/01/03 17:18:49  alex
283
* Revision 1.1  2005/01/03 17:18:49  alex
333
* retour vers la liste des participants après un ajout.
284
* retour vers la liste des participants après un ajout.
334
*
285
*
335
*
286
*
336
*
287
*
337
* +-- Fin du code ----------------------------------------------------------------------------------------+
288
* +-- Fin du code ----------------------------------------------------------------------------------------+
338
*/
289
*/
339
?>
-
 
340
290
?>
-
 
291