Subversion Repositories Applications.bazar

Rev

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

Rev 188 Rev 189
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: bazar.fonct.rss.php,v 1.60.2.8 2007-02-27 15:11:00 alexandre_tb Exp $
22
// CVS : $Id: bazar.fonct.rss.php,v 1.60.2.9 2007-02-27 15:32:40 alexandre_tb Exp $
23
/**
23
/**
24
* 
24
* 
25
*@package bazar
25
*@package bazar
26
//Auteur original :
26
//Auteur original :
27
*@author        Alexandre GRANIER <alexandre@tela-botanica.org>
27
*@author        Alexandre GRANIER <alexandre@tela-botanica.org>
28
*@author        Florian Schmitt <florian@ecole-et-nature.org>
28
*@author        Florian Schmitt <florian@ecole-et-nature.org>
29
//Autres auteurs :
29
//Autres auteurs :
30
*@copyright     Tela-Botanica 2000-2006
30
*@copyright     Tela-Botanica 2000-2006
31
*@version       $Revision: 1.60.2.8 $
31
*@version       $Revision: 1.60.2.9 $
32
// +------------------------------------------------------------------------------------------------------+
32
// +------------------------------------------------------------------------------------------------------+
33
*/
33
*/
34
 
34
 
35
// +------------------------------------------------------------------------------------------------------+
35
// +------------------------------------------------------------------------------------------------------+
36
// |                                            ENTETE du PROGRAMME                                       |
36
// |                                            ENTETE du PROGRAMME                                       |
37
// +------------------------------------------------------------------------------------------------------+
37
// +------------------------------------------------------------------------------------------------------+
38
 
38
 
39
require_once BAZ_CHEMIN_APPLI.'bibliotheque/bazar.class.php';
39
require_once BAZ_CHEMIN_APPLI.'bibliotheque/bazar.class.php';
40
require_once BAZ_CHEMIN_APPLI.'bibliotheque/bazar.fonct.php';
40
require_once BAZ_CHEMIN_APPLI.'bibliotheque/bazar.fonct.php';
41
 
41
 
42
 
42
 
43
/** baz_valeur_template() - Renvoi des valeurs inscrite dans le fichier de template
43
/** baz_valeur_template() - Renvoi des valeurs inscrite dans le fichier de template
44
*
44
*
45
* @param   string valeur du template de bazar_nature
45
* @param   string valeur du template de bazar_nature
46
*
46
*
47
* @return   mixed  tableau contenant les champs du fichier template
47
* @return   mixed  tableau contenant les champs du fichier template
48
*/
48
*/
49
function baz_valeurs_template($valeur_template) {
49
function baz_valeurs_template($valeur_template) {
50
	//Parcours du fichier de templates, pour mettre les champs specifiques
50
	//Parcours du fichier de templates, pour mettre les champs specifiques
51
	$tableau= array();
51
	$tableau= array();
52
	$nblignes=0;
52
	$nblignes=0;
53
	$chaine = explode ("\n", $valeur_template);
53
	$chaine = explode ("\n", $valeur_template);
54
	array_pop($chaine);
54
	array_pop($chaine);
55
	foreach ($chaine as $ligne)  {
55
	foreach ($chaine as $ligne)  {
56
		$souschaine = explode ("***", $ligne) ;
56
		$souschaine = explode ("***", $ligne) ;
57
		$tableau[$nblignes]['type'] = trim($souschaine[0]) ;
57
		$tableau[$nblignes]['type'] = trim($souschaine[0]) ;
58
		if (isset($souschaine[1])) {$tableau[$nblignes]['nom_bdd'] = trim($souschaine[1]);}
58
		if (isset($souschaine[1])) {$tableau[$nblignes]['nom_bdd'] = trim($souschaine[1]);}
59
		else {$tableau[$nblignes]['nom_bdd'] ='';}
59
		else {$tableau[$nblignes]['nom_bdd'] ='';}
60
		if (isset($souschaine[2])) $tableau[$nblignes]['label'] = trim($souschaine[2]);
60
		if (isset($souschaine[2])) $tableau[$nblignes]['label'] = trim($souschaine[2]);
61
		else {$tableau[$nblignes]['label'] ='';}
61
		else {$tableau[$nblignes]['label'] ='';}
62
		if (isset($souschaine[3])) $tableau[$nblignes]['limite1'] = trim($souschaine[3]);
62
		if (isset($souschaine[3])) $tableau[$nblignes]['limite1'] = trim($souschaine[3]);
63
		else {$tableau[$nblignes]['limite1'] ='';}
63
		else {$tableau[$nblignes]['limite1'] ='';}
64
		if (isset($souschaine[4])) $tableau[$nblignes]['limite2'] = trim($souschaine[4]);
64
		if (isset($souschaine[4])) $tableau[$nblignes]['limite2'] = trim($souschaine[4]);
65
		else {$tableau[$nblignes]['limite2'] ='';}
65
		else {$tableau[$nblignes]['limite2'] ='';}
66
		if (isset($souschaine[5])) $tableau[$nblignes]['defaut'] = trim($souschaine[5]);
66
		if (isset($souschaine[5])) $tableau[$nblignes]['defaut'] = trim($souschaine[5]);
67
		else {$tableau[$nblignes]['defaut'] ='';}
67
		else {$tableau[$nblignes]['defaut'] ='';}
68
		if (isset($souschaine[6])) $tableau[$nblignes]['table_source'] = trim($souschaine[6]);
68
		if (isset($souschaine[6])) $tableau[$nblignes]['table_source'] = trim($souschaine[6]);
69
		else {$tableau[$nblignes]['table_source'] ='';}
69
		else {$tableau[$nblignes]['table_source'] ='';}
70
		if (isset($souschaine[7])) $tableau[$nblignes]['id_source'] = trim($souschaine[7]);
70
		if (isset($souschaine[7])) $tableau[$nblignes]['id_source'] = trim($souschaine[7]);
71
		else {$tableau[$nblignes]['id_source'] ='';}
71
		else {$tableau[$nblignes]['id_source'] ='';}
72
		if (isset($souschaine[8])) $tableau[$nblignes]['obligatoire'] = trim($souschaine[8]);
72
		if (isset($souschaine[8])) $tableau[$nblignes]['obligatoire'] = trim($souschaine[8]);
73
		else {$tableau[$nblignes]['obligatoire'] ='';}
73
		else {$tableau[$nblignes]['obligatoire'] ='';}
74
		if (isset($souschaine[9])) $tableau[$nblignes]['recherche'] = trim($souschaine[9]);
74
		if (isset($souschaine[9])) $tableau[$nblignes]['recherche'] = trim($souschaine[9]);
75
		else {$tableau[$nblignes]['recherche'] ='';}
75
		else {$tableau[$nblignes]['recherche'] ='';}
76
		
76
		
77
		
77
		
78
		// traitement des cases à cocher, dans ce cas la, on a une table de jointure entre la table
78
		// traitement des cases à cocher, dans ce cas la, on a une table de jointure entre la table
79
		// de liste et la table bazar_fiche (elle porte un nom du genre bazar_ont_***)
79
		// de liste et la table bazar_fiche (elle porte un nom du genre bazar_ont_***)
80
		// dans le template, à la place d'un nom de champs dans 'nom_bdd', on a un nom de table
80
		// dans le template, à la place d'un nom de champs dans 'nom_bdd', on a un nom de table
81
		// et 2 noms de champs séparés par un virgule ex : bazar_ont_theme,bot_id_theme,bot_id_fiche
81
		// et 2 noms de champs séparés par un virgule ex : bazar_ont_theme,bot_id_theme,bot_id_fiche
82
		
82
		
83
		if (isset($tableau[$nblignes]['nom_bdd']) && preg_match('/,/', $tableau[$nblignes]['nom_bdd'])) {
83
		if (isset($tableau[$nblignes]['nom_bdd']) && preg_match('/,/', $tableau[$nblignes]['nom_bdd'])) {
84
			$tableau_info_jointe = explode (',', $tableau[$nblignes]['nom_bdd']) ;
84
			$tableau_info_jointe = explode (',', $tableau[$nblignes]['nom_bdd']) ;
85
			$tableau[$nblignes]['table_jointe'] = $tableau_info_jointe[0] ;
85
			$tableau[$nblignes]['table_jointe'] = $tableau_info_jointe[0] ;
86
			$tableau[$nblignes]['champs_id_fiche'] = $tableau_info_jointe[1] ;
86
			$tableau[$nblignes]['champs_id_fiche'] = $tableau_info_jointe[1] ;
87
			$tableau[$nblignes]['champs_id_table_jointe'] = $tableau_info_jointe[2] ;		
87
			$tableau[$nblignes]['champs_id_table_jointe'] = $tableau_info_jointe[2] ;		
88
		}
88
		}
89
		$nblignes++;
89
		$nblignes++;
90
	}
90
	}
91
	return $tableau;
91
	return $tableau;
92
}
92
}
93
 
93
 
94
/**  baz_voir_fiches() - Permet de visualiser en detail une liste de fiche  au format XHTML
94
/**  baz_voir_fiches() - Permet de visualiser en detail une liste de fiche  au format XHTML
95
*
95
*
96
* @global boolean Rajoute des informations internes à l'application (date de modification, lien vers la page de départ de l'appli)
96
* @global boolean Rajoute des informations internes à l'application (date de modification, lien vers la page de départ de l'appli)
97
* @global integer Tableau d(Identifiant des fiches à afficher
97
* @global integer Tableau d(Identifiant des fiches à afficher
98
*
98
*
99
* @return   string  HTML
99
* @return   string  HTML
100
*/
100
*/
101
function baz_voir_fiches($danslappli, $idfiches=array()) {
101
function baz_voir_fiches($danslappli, $idfiches=array()) {
102
	$res='';
102
	$res='';
103
	foreach($idfiches as $idfiche) {
103
	foreach($idfiches as $idfiche) {
104
			$res.=baz_voir_fiche($danslappli, $idfiche);
104
			$res.=baz_voir_fiche($danslappli, $idfiche);
105
	}
105
	}
106
	return $res;
106
	return $res;
107
}
107
}
108
 
108
 
109
 
109
 
110
/**  baz_voir_fiche() - Permet de visualiser en detail une fiche  au format XHTML
110
/**  baz_voir_fiche() - Permet de visualiser en detail une fiche  au format XHTML
111
*
111
*
112
* @global boolean Rajoute des informations internes a l'application (date de modification, lien vers la page de départ de l'appli) si a 1
112
* @global boolean Rajoute des informations internes a l'application (date de modification, lien vers la page de départ de l'appli) si a 1
113
* @global integer Identifiant de la fiche a afficher
113
* @global integer Identifiant de la fiche a afficher
114
*
114
*
115
* @return   string  HTML
115
* @return   string  HTML
116
*/
116
*/
117
function baz_voir_fiche($danslappli, $idfiche='') {
117
function baz_voir_fiche($danslappli, $idfiche='') {
118
	$res='';
118
	$res='';
119
	if (isset($_GET['id_fiche'])) $GLOBALS['_BAZAR_']['id_fiche']=$_GET['id_fiche'];
119
	if (isset($_GET['id_fiche'])) $GLOBALS['_BAZAR_']['id_fiche']=$_GET['id_fiche'];
120
	if ($idfiche!='') $GLOBALS['_BAZAR_']['id_fiche']=$idfiche;	
120
	if ($idfiche!='') $GLOBALS['_BAZAR_']['id_fiche']=$idfiche;	
121
	$url= $GLOBALS['_BAZAR_']['url'];
121
	$url= $GLOBALS['_BAZAR_']['url'];
122
	$url->addQueryString('action', BAZ_VOIR_FICHE);
122
	$url->addQueryString('action', BAZ_VOIR_FICHE);
123
	$url->addQueryString('id_fiche', $GLOBALS['_BAZAR_']['id_fiche']);
123
	$url->addQueryString('id_fiche', $GLOBALS['_BAZAR_']['id_fiche']);
124
	$url = preg_replace ('/&amp;/', '&', $url->getURL()) ;
124
	$url = preg_replace ('/&amp;/', '&', $url->getURL()) ;
125
	
125
	
126
	//cas ou la fiche a été validee
126
	//cas ou la fiche a été validee
127
	if (isset($_GET['publiee'])) {
127
	if (isset($_GET['publiee'])) {
128
		publier_fiche($_GET['publiee']);			
128
		publier_fiche($_GET['publiee']);			
129
	}
129
	}
130
	
130
	
131
	//cas on une structure s'approprie une ressource
131
	//cas on une structure s'approprie une ressource
132
	if (isset($_GET['appropriation'])) {
132
	if (isset($_GET['appropriation'])) {
133
		if ($_GET['appropriation']==1) {
133
		if ($_GET['appropriation']==1) {
134
			$requete = 'INSERT INTO bazar_appropriation VALUES ('.$GLOBALS['_BAZAR_']['id_fiche'].', '.$GLOBALS['AUTH']->getAuthData(BAZ_CHAMPS_ID).')';
134
			$requete = 'INSERT INTO bazar_appropriation VALUES ('.$GLOBALS['_BAZAR_']['id_fiche'].', '.$GLOBALS['AUTH']->getAuthData(BAZ_CHAMPS_ID).')';
135
			$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
135
			$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
136
		}
136
		}
137
		elseif ($_GET['appropriation']==0) {
137
		elseif ($_GET['appropriation']==0) {
138
			$requete = 'DELETE FROM bazar_appropriation WHERE  ba_ce_id_fiche='.$GLOBALS['_BAZAR_']['id_fiche'].' AND ba_ce_id_structure='.$GLOBALS['AUTH']->getAuthData(BAZ_CHAMPS_ID);
138
			$requete = 'DELETE FROM bazar_appropriation WHERE  ba_ce_id_fiche='.$GLOBALS['_BAZAR_']['id_fiche'].' AND ba_ce_id_structure='.$GLOBALS['AUTH']->getAuthData(BAZ_CHAMPS_ID);
139
			$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
139
			$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
140
		}
140
		}
141
	}
141
	}
142
		
142
		
143
	//cas ou un commentaire a été entre
143
	//cas ou un commentaire a été entre
144
	if (isset($_POST['Nom'])) {
144
	if (isset($_POST['Nom'])) {
145
		$requete = 'INSERT INTO bazar_commentaires VALUES ('.
145
		$requete = 'INSERT INTO bazar_commentaires VALUES ('.
146
					baz_nextid('bazar_commentaires', 'bc_id_commentaire', $GLOBALS['_BAZAR_']['db']).
146
					baz_nextid('bazar_commentaires', 'bc_id_commentaire', $GLOBALS['_BAZAR_']['db']).
147
					', '.$GLOBALS['_BAZAR_']['id_fiche'].', "'.$_POST['Nom'].'", "'.$_POST['Commentaire'].
147
					', '.$GLOBALS['_BAZAR_']['id_fiche'].', "'.$_POST['Nom'].'", "'.$_POST['Commentaire'].
148
					'", NOW() )';
148
					'", NOW() )';
149
		$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
149
		$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
150
	}
150
	}
151
	//cas ou un commentaire va etre supprime
151
	//cas ou un commentaire va etre supprime
152
	elseif (isset($_GET['id_commentaire'])) {
152
	elseif (isset($_GET['id_commentaire'])) {
153
		$requete = 'DELETE FROM bazar_commentaires WHERE bc_id_commentaire='.$_GET['id_commentaire'].' LIMIT 1';
153
		$requete = 'DELETE FROM bazar_commentaires WHERE bc_id_commentaire='.$_GET['id_commentaire'].' LIMIT 1';
154
		$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
154
		$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
155
	}
155
	}
156
	else {
156
	else {
157
		if (isset($_GET['action'])) {
157
		if (isset($_GET['action'])) {
158
			if ($_GET['action']==BAZ_VOIR_FICHE) {
158
			if ($_GET['action']==BAZ_VOIR_FICHE) {
159
				//sinon on met a jour le nb de visites pour la fiche, puisque c'est une simple consultation
159
				//sinon on met a jour le nb de visites pour la fiche, puisque c'est une simple consultation
160
				$requete = 'UPDATE bazar_fiche SET bf_nb_consultations=bf_nb_consultations+1 WHERE bf_id_fiche='.$GLOBALS['_BAZAR_']['id_fiche'];
160
				$requete = 'UPDATE bazar_fiche SET bf_nb_consultations=bf_nb_consultations+1 WHERE bf_id_fiche='.$GLOBALS['_BAZAR_']['id_fiche'];
161
				$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
161
				$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
162
			}
162
			}
163
		}
163
		}
164
	}
164
	}
165
	$requete = 'SELECT * FROM bazar_fiche WHERE bf_id_fiche='.$GLOBALS['_BAZAR_']['id_fiche'];
165
	$requete = 'SELECT * FROM bazar_fiche WHERE bf_id_fiche='.$GLOBALS['_BAZAR_']['id_fiche'];
166
	
166
	
167
	$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
167
	$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
168
	(DB::isError($resultat)) ? die(BOG_afficherErreurSql(__FILE__, __LINE__, $resultat->getMessage(), $requete))
168
	(DB::isError($resultat)) ? die(BOG_afficherErreurSql(__FILE__, __LINE__, $resultat->getMessage(), $requete))
169
	    : '';
169
	    : '';
170
	
170
	
171
		$ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC) ;
171
		$ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC) ;
172
	if (!isset($GLOBALS['_BAZAR_']['typeannonce'])) $GLOBALS['_BAZAR_']['typeannonce'] = $ligne['bf_ce_nature'];
172
	if (!isset($GLOBALS['_BAZAR_']['typeannonce'])) $GLOBALS['_BAZAR_']['typeannonce'] = $ligne['bf_ce_nature'];
173
	
173
	
174
	//on verifie si l'utilisateur est administrateur
174
	//on verifie si l'utilisateur est administrateur
175
	$est_admin=0;
175
	$est_admin=0;
176
	$requete='SELECT bn_id_nature, bn_template, bn_commentaire FROM bazar_nature WHERE bn_id_nature="'.$GLOBALS['_BAZAR_']['typeannonce'].'"';
176
	$requete='SELECT bn_id_nature, bn_template, bn_commentaire FROM bazar_nature WHERE bn_id_nature="'.$GLOBALS['_BAZAR_']['typeannonce'].'"';
177
 
177
 
178
	$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
178
	$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
179
	if (DB::isError($resultat)) {
179
	if (DB::isError($resultat)) {
180
		die ($resultat->getMessage().$resultat->getDebugInfo()) ;
180
		die ($resultat->getMessage().$resultat->getDebugInfo()) ;
181
	}
181
	}
182
	$result = $resultat->fetchRow(DB_FETCHMODE_ASSOC);
182
	$result = $resultat->fetchRow(DB_FETCHMODE_ASSOC);
183
	$id_nature = $result['bn_id_nature'];
183
	$id_nature = $result['bn_id_nature'];
184
	if (!isset($GLOBALS['_BAZAR_']['template'])) $GLOBALS['_BAZAR_']['template'] = $result['bn_template'];
184
	if (!isset($GLOBALS['_BAZAR_']['template'])) $GLOBALS['_BAZAR_']['template'] = $result['bn_template'];
185
	if (!isset($GLOBALS['_BAZAR_']['commentaire'])) $GLOBALS['_BAZAR_']['commentaire'] = $result['bn_commentaire'];
185
	if (!isset($GLOBALS['_BAZAR_']['commentaire'])) $GLOBALS['_BAZAR_']['commentaire'] = $result['bn_commentaire'];
186
	if ($GLOBALS['AUTH']->getAuth()) {
186
	if ($GLOBALS['AUTH']->getAuth()) {
187
		if ((niveau_droit($result['bn_id_nature'],$GLOBALS['AUTH']->getAuthData(BAZ_CHAMPS_ID))=='administrateur')
187
		if ((niveau_droit($result['bn_id_nature'],$GLOBALS['AUTH']->getAuthData(BAZ_CHAMPS_ID))=='administrateur')
188
		     or(niveau_droit('0',$GLOBALS['AUTH']->getAuthData(BAZ_CHAMPS_ID))=='superadministrateur'))
188
		     or(niveau_droit('0',$GLOBALS['AUTH']->getAuthData(BAZ_CHAMPS_ID))=='superadministrateur'))
189
		{
189
		{
190
		        $est_admin=1;
190
		        $est_admin=1;
191
		}
191
		}
192
	}
192
	}
193
	//affiche le titre sous forme d'image
193
	//affiche le titre sous forme d'image
194
	if (isset ($GLOBALS['_BAZAR_']['image_titre']) && $GLOBALS['_BAZAR_']['image_titre']!='') {
194
	if (isset ($GLOBALS['_BAZAR_']['image_titre']) && $GLOBALS['_BAZAR_']['image_titre']!='') {
195
		$res .= '<img id="BAZ_img_titre" src="client/bazar/images/'.$GLOBALS['_BAZAR_']['image_titre'].'" alt="'.$result['bn_label_nature'].'" />'.'<br />'."\n";
195
		$res .= '<img id="BAZ_img_titre" src="client/bazar/images/'.$GLOBALS['_BAZAR_']['image_titre'].'" alt="'.$result['bn_label_nature'].'" />'.'<br />'."\n";
196
	}
196
	}
197
	//affiche le texte sinon
197
	//affiche le texte sinon
198
	else {
198
	else {
199
		//$res .= '<h2 class="BAZ_titre">'.$GLOBALS['_BAZAR_']['typeannonce'].'</h2>'."\n";
199
		//$res .= '<h2 class="BAZ_titre">'.$GLOBALS['_BAZAR_']['typeannonce'].'</h2>'."\n";
200
	}
200
	}
201
	$res .= '<div class="BAZ_cadre_fiche">'."\n";
201
	$res .= '<div class="BAZ_cadre_fiche">'."\n";
202
	
202
	
203
	$GLOBALS['_BAZAR_']['annonceur'] = $ligne['bf_ce_utilisateur'] ;
203
	$GLOBALS['_BAZAR_']['annonceur'] = $ligne['bf_ce_utilisateur'] ;
204
	//si le template existe, on genere le template
204
	//si le template existe, on genere le template
205
	if ((file_exists(BAZ_CHEMIN_APPLI.'templates/'.$GLOBALS['_BAZAR_']['typeannonce'].'-fiche.php'))) {
205
	if ((file_exists(BAZ_CHEMIN_APPLI.'templates/'.$GLOBALS['_BAZAR_']['typeannonce'].'-fiche.php'))) {
206
		include_once(BAZ_CHEMIN_APPLI.'templates/'.$GLOBALS['_BAZAR_']['typeannonce'].'-fiche.php');
206
		include_once(BAZ_CHEMIN_APPLI.'templates/'.$GLOBALS['_BAZAR_']['typeannonce'].'-fiche.php');
207
		$res .=genere_fiche($ligne);
207
		$res .=genere_fiche($ligne);
208
	}
208
	}
209
	//on affiche ligne par ligne sinon
209
	//on affiche ligne par ligne sinon
210
	else {
210
	else {
211
		//cas d'une image personalisée
211
		//cas d'une image personalisée
212
		if (isset($ligne['bf_url_image'])) {
212
		if (isset($ligne['bf_url_image'])) {
213
			$res .= '<div id="fiche_image">'."\n";
213
			$res .= '<div id="fiche_image">'."\n";
214
			$res .= '<img src="client/bazar/upload/'.$ligne['bf_url_image'].'" border=0 alt="'.BAZ_TEXTE_IMG_ALTERNATIF.'" />'."\n";
214
			$res .= '<img src="client/bazar/upload/'.$ligne['bf_url_image'].'" border=0 alt="'.BAZ_TEXTE_IMG_ALTERNATIF.'" />'."\n";
215
			$res .= '</div>'."\n";
215
			$res .= '</div>'."\n";
216
		}
216
		}
217
		//cas d'une image par défaut
217
		//cas d'une image par défaut
218
		elseif (isset ($GLOBALS['_BAZAR_']['image_logo']) && $GLOBALS['_BAZAR_']['image_logo']!='') {
218
		elseif (isset ($GLOBALS['_BAZAR_']['image_logo']) && $GLOBALS['_BAZAR_']['image_logo']!='') {
219
			$res .= '<div id="fiche_image">'."\n";
219
			$res .= '<div id="fiche_image">'."\n";
220
			$res .= '<img src="client/bazar/images/'.$GLOBALS['_BAZAR_']['image_logo'].'" border=0 alt="'.BAZ_TEXTE_IMG_ALTERNATIF.'" width="130" height="130" />'."\n";
220
			$res .= '<img src="client/bazar/images/'.$GLOBALS['_BAZAR_']['image_logo'].'" border=0 alt="'.BAZ_TEXTE_IMG_ALTERNATIF.'" width="130" height="130" />'."\n";
221
			$res .= '</div>'."\n";
221
			$res .= '</div>'."\n";
222
		}
222
		}
223
		$res .= '<h1 id="fiche_titre">'.$ligne['bf_titre'].'</h1>'."\n";
223
		$res .= '<h1 id="fiche_titre">'.$ligne['bf_titre'].'</h1>'."\n";
224
		$res .= '<div id="BAZ_description">'.nl2br($ligne['bf_description']).'</div>'."\n";
224
		$res .= '<div id="BAZ_description">'.nl2br($ligne['bf_description']).'</div>'."\n";
225
		$tableau=baz_valeurs_template($GLOBALS['_BAZAR_']['template']);
225
		$tableau=baz_valeurs_template($GLOBALS['_BAZAR_']['template']);
226
		for ($i=0; $i<count($tableau); $i++) {
226
		for ($i=0; $i<count($tableau); $i++) {
227
			if (isset($ligne[$tableau[$i]['nom_bdd']]) && ( $tableau[$i]['type']=='texte' || $tableau[$i]['type']=='textelong' ) ) {
227
			if (isset($ligne[$tableau[$i]['nom_bdd']]) && ( $tableau[$i]['type']=='texte' || $tableau[$i]['type']=='textelong' ) ) {
228
				$val=$tableau[$i]['nom_bdd'];
228
				$val=$tableau[$i]['nom_bdd'];
229
				if (!in_array($val, array ('bf_titre', 'bf_description'))) {
229
				if (!in_array($val, array ('bf_titre', 'bf_description'))) {
230
					if ($ligne[$val] != '' and $ligne[$val] != BAZ_CHOISIR and $ligne[$val] != BAZ_NON_PRECISE) {
230
					if ($ligne[$val] != '' and $ligne[$val] != BAZ_CHOISIR and $ligne[$val] != BAZ_NON_PRECISE) {
231
						$res .= '<span class="rubrique">'.$tableau[$i]['label'].':</span>'."\n";
231
						$res .= '<span class="rubrique">'.$tableau[$i]['label'].':</span>'."\n";
232
						$res .= '<span class="description"> '.nl2br($ligne[$val]).'</span>'."\n".'<br />'."\n";
232
						$res .= '<span class="description"> '.nl2br($ligne[$val]).'</span>'."\n".'<br />'."\n";
233
					}
233
					}
234
				}
234
				}
235
			}
235
			}
236
			elseif ( $tableau[$i]['type']=='liste' || $tableau[$i]['type']=='checkbox' ) {
236
			elseif ( $tableau[$i]['type']=='liste' || $tableau[$i]['type']=='checkbox' ) {
237
				//pour les champs renseignes par une liste, on va chercher le label de la liste, plutot que l'id				
237
				//pour les champs renseignes par une liste, on va chercher le label de la liste, plutot que l'id				
238
				$requete = 'SELECT blv_label FROM bazar_fiche_valeur_liste, bazar_liste_valeurs WHERE bfvl_ce_fiche='.$GLOBALS['_BAZAR_']['id_fiche'].
238
				$requete = 'SELECT blv_label FROM bazar_fiche_valeur_liste, bazar_liste_valeurs WHERE bfvl_ce_fiche='.$GLOBALS['_BAZAR_']['id_fiche'].
239
				' AND  bfvl_ce_liste='.$tableau[$i]['nom_bdd'].' AND bfvl_valeur=blv_valeur AND blv_ce_liste='.$tableau[$i]['nom_bdd'].' AND blv_ce_i18n="'.$GLOBALS['_BAZAR_']['langue'].'"';
239
				' AND  bfvl_ce_liste='.$tableau[$i]['nom_bdd'].' AND bfvl_valeur=blv_valeur AND blv_ce_liste='.$tableau[$i]['nom_bdd'].' AND blv_ce_i18n="'.$GLOBALS['_BAZAR_']['langue'].'"';
240
				$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
240
				$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
241
				if (DB::isError ($resultat)) {
241
				if (DB::isError ($resultat)) {
242
					die ($resultat->getMessage().'<br />'.$resultat->getDebugInfo()) ;
242
					die ($resultat->getMessage().'<br />'.$resultat->getDebugInfo()) ;
243
				}
243
				}
244
				$val='';$nb=0;
244
				$val='';$nb=0;
245
				while ($tab = $resultat->fetchRow()) {
245
				while ($tab = $resultat->fetchRow()) {
246
					if ($nb>0) $val .= ', ';
246
					if ($nb>0) $val .= ', ';
247
					$val .= $tab[0];
247
					$val .= $tab[0];
248
					$nb++;
248
					$nb++;
249
				}				
249
				}				
250
				if ($val != '' and $val != BAZ_CHOISIR and $val != BAZ_NON_PRECISE) {
250
				if ($val != '' and $val != BAZ_CHOISIR and $val != BAZ_NON_PRECISE) {
251
					$res .= '<span class="rubrique">'.$tableau[$i]['label'].':</span>'."\n";
251
					$res .= '<span class="rubrique">'.$tableau[$i]['label'].':</span>'."\n";
252
					$res .= '<span class="description"> '.$val.'</span>'."\n".'<br />'."\n";
252
					$res .= '<span class="description"> '.$val.'</span>'."\n".'<br />'."\n";
253
				}
253
				}
254
			}
254
			}
255
			elseif ( $tableau[$i]['type']=='listedatedeb' || $tableau[$i]['type']=='listedatefin' ) {
255
			elseif ( $tableau[$i]['type']=='listedatedeb' || $tableau[$i]['type']=='listedatefin' ) {
256
				$val=$tableau[$i]['nom_bdd'];
256
				$val=$tableau[$i]['nom_bdd'];
257
				if (!in_array($val, array ('bf_date_debut_validite_fiche', 'bf_date_fin_validite_fiche'))) {
257
				if (!in_array($val, array ('bf_date_debut_validite_fiche', 'bf_date_fin_validite_fiche'))) {
258
					if ($ligne[$val] != '' && $ligne[$val] != '0000-00-00') {
258
					if ($ligne[$val] != '' && $ligne[$val] != '0000-00-00') {
259
						$res .= '<span class="rubrique">'.$tableau[$i]['label'].':</span>'."\n";
259
						$res .= '<span class="rubrique">'.$tableau[$i]['label'].':</span>'."\n";
260
						$res .= '<span class="description"> '.strftime('%d.%m.%Y',strtotime($ligne[$val])).'</span>'."\n".'<br />'."\n";
260
						$res .= '<span class="description"> '.strftime('%d.%m.%Y',strtotime($ligne[$val])).'</span>'."\n".'<br />'."\n";
261
					}
261
					}
262
				}		
262
				}		
263
			}
263
			}
264
			elseif ( $tableau[$i]['type']=='wikini' ) {
264
			elseif ( $tableau[$i]['type']=='wikini' ) {
265
				$res .= '<div class="lien_wikini"><a href="wikini/'.baz_titre_wiki($ligne["bf_titre"]).'">'.BAZ_ENTRER_PROJET.'</a></div>'."\n";
265
				$res .= '<div class="lien_wikini"><a href="wikini/'.baz_titre_wiki($ligne["bf_titre"]).'">'.BAZ_ENTRER_PROJET.'</a></div>'."\n";
266
			}
266
			}
267
		}
267
		}
268
	//afficher les liens pour l'annonce
268
	//afficher les liens pour l'annonce
269
	$requete = 'SELECT  bu_url, bu_descriptif_url FROM bazar_url WHERE bu_ce_fiche='.$GLOBALS['_BAZAR_']['id_fiche'];
269
	$requete = 'SELECT  bu_url, bu_descriptif_url FROM bazar_url WHERE bu_ce_fiche='.$GLOBALS['_BAZAR_']['id_fiche'];
270
	$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
270
	$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
271
	if (DB::isError($resultat)) {
271
	if (DB::isError($resultat)) {
272
		die ($resultat->getMessage().$resultat->getDebugInfo()) ;
272
		die ($resultat->getMessage().$resultat->getDebugInfo()) ;
273
	}
273
	}
274
	if ($resultat->numRows()>0) {
274
	if ($resultat->numRows()>0) {
275
		$res .= '<span class="rubrique">'.BAZ_LIEN_INTERNET.':</span>'."\n";
275
		$res .= '<span class="rubrique">'.BAZ_LIEN_INTERNET.':</span>'."\n";
276
		$res .= '<span class="description">'."\n";
276
		$res .= '<span class="description">'."\n";
277
		$res .= '<ul>'."\n";
277
		$res .= '<ul>'."\n";
278
		while ($ligne1 = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
278
		while ($ligne1 = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
279
			$res .= '<li><a href="'.$ligne1['bu_url'].'" target="_blank">'.$ligne1['bu_descriptif_url'].'</a></li>'."\n";
279
			$res .= '<li><a href="'.$ligne1['bu_url'].'" target="_blank">'.$ligne1['bu_descriptif_url'].'</a></li>'."\n";
280
		}
280
		}
281
		$res .= '</ul></span>'."\n";
281
		$res .= '</ul></span>'."\n";
282
	}
282
	}
283
	
283
	
284
	//afficher les fichiers pour l'annonce
284
	//afficher les fichiers pour l'annonce
285
	$requete = 'SELECT  bfj_description, bfj_fichier FROM bazar_fichier_joint WHERE bfj_ce_fiche='.$GLOBALS['_BAZAR_']['id_fiche'];
285
	$requete = 'SELECT  bfj_description, bfj_fichier FROM bazar_fichier_joint WHERE bfj_ce_fiche='.$GLOBALS['_BAZAR_']['id_fiche'];
286
	$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
286
	$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
287
	if (DB::isError($resultat)) {
287
	if (DB::isError($resultat)) {
288
		die ($resultat->getMessage().$resultat->getDebugInfo()) ;
288
		die ($resultat->getMessage().$resultat->getDebugInfo()) ;
289
	}
289
	}
290
	if ($resultat->numRows()>0) {
290
	if ($resultat->numRows()>0) {
291
		$res .= '<span class="rubrique">'.BAZ_LISTE_FICHIERS_JOINTS.':</span>'."\n";
291
		$res .= '<span class="rubrique">'.BAZ_LISTE_FICHIERS_JOINTS.':</span>'."\n";
292
		$res .= '<span class="description">'."\n";
292
		$res .= '<span class="description">'."\n";
293
		$res .= '<ul>'."\n";
293
		$res .= '<ul>'."\n";
294
		while ($ligne2 = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
294
		while ($ligne2 = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
295
			$res .= '<li><a href="client/bazar/upload/'.$ligne2['bfj_fichier'].'">'.$ligne2['bfj_description'].'</a></li>'."\n";
295
			$res .= '<li><a href="client/bazar/upload/'.$ligne2['bfj_fichier'].'">'.$ligne2['bfj_description'].'</a></li>'."\n";
296
		}
296
		}
297
		$res .= '</ul></span>'."\n";
297
		$res .= '</ul></span>'."\n";
298
	}
298
	}
299
	$res .= '<div class="bulle_haut">&nbsp;</div>'."\n";
299
	$res .= '<div class="bulle_haut">&nbsp;</div>'."\n";
300
	$res .= '<div class="bulle_corps">'."\n";
300
	$res .= '<div class="bulle_corps">'."\n";
301
	
301
	
302
	//affichage du redacteur de la fiche
302
	//affichage du redacteur de la fiche
303
	$requete = 'SELECT '.BAZ_CHAMPS_NOM.', '.BAZ_CHAMPS_PRENOM.', '.BAZ_CHAMPS_EMAIL.
303
	$requete = 'SELECT '.BAZ_CHAMPS_NOM.', '.BAZ_CHAMPS_PRENOM.', '.BAZ_CHAMPS_EMAIL.
304
					' FROM '.BAZ_ANNUAIRE.' WHERE '.BAZ_CHAMPS_ID.'='.$ligne['bf_ce_utilisateur'];
304
					' FROM '.BAZ_ANNUAIRE.' WHERE '.BAZ_CHAMPS_ID.'='.$ligne['bf_ce_utilisateur'];
305
	$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
305
	$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
306
	if (DB::isError($resultat)) {
306
	if (DB::isError($resultat)) {
307
		die ($resultat->getMessage().$resultat->getDebugInfo()) ;
307
		die ($resultat->getMessage().$resultat->getDebugInfo()) ;
308
	}
308
	}
309
	while ($redacteur = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
309
	while ($redacteur = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
310
		$res .= BAZ_FICHE_ECRITE.'<a href="mailto:'.$redacteur[BAZ_CHAMPS_EMAIL].'">'.$redacteur[BAZ_CHAMPS_PRENOM].' '.$redacteur[BAZ_CHAMPS_NOM].'</a><br />'."\n";
310
		$res .= BAZ_FICHE_ECRITE.'<a href="mailto:'.$redacteur[BAZ_CHAMPS_EMAIL].'">'.$redacteur[BAZ_CHAMPS_PRENOM].' '.$redacteur[BAZ_CHAMPS_NOM].'</a><br />'."\n";
311
	}
311
	}
312
	$res .= BAZ_NB_VUS.'<strong>'.$ligne['bf_nb_consultations'].'</strong>'.BAZ_FOIS.'<br />'."\n";
312
	$res .= BAZ_NB_VUS.'<strong>'.$ligne['bf_nb_consultations'].'</strong>'.BAZ_FOIS.'<br />'."\n";
313
	$res .= '</div>'."\n";
313
	$res .= '</div>'."\n";
314
	$res .= '<div class="bulle_bas">&nbsp;</div>'."\n";
314
	$res .= '<div class="bulle_bas">&nbsp;</div>'."\n";
315
	$res .= '<div id="BAZ_bas_page">';
315
	$res .= '<div id="BAZ_bas_page">';
316
	}
316
	}
317
	
317
	
318
	//informations complementaires (id fiche, etat publication,... )
318
	//informations complementaires (id fiche, etat publication,... )
319
	if ($danslappli==1) {
319
	if ($danslappli==1) {
320
		if ($ligne['bf_statut_fiche']==1 && $GLOBALS['_BAZAR_']['appropriation']!=1) {
320
		if ($ligne['bf_statut_fiche']==1 && $GLOBALS['_BAZAR_']['appropriation']!=1) {
321
			if ($ligne['bf_date_debut_validite_fiche'] != '0000-00-00' && $ligne['bf_date_fin_validite_fiche'] != '0000-00-00') {
321
			if ($ligne['bf_date_debut_validite_fiche'] != '0000-00-00' && $ligne['bf_date_fin_validite_fiche'] != '0000-00-00') {
322
			$res .= '<span class="rubrique">'.BAZ_PUBLIEE.':</span> '.BAZ_DU.
322
			$res .= '<span class="rubrique">'.BAZ_PUBLIEE.':</span> '.BAZ_DU.
323
					' '.strftime('%d.%m.%Y',strtotime($ligne['bf_date_debut_validite_fiche'])).' '.
323
					' '.strftime('%d.%m.%Y',strtotime($ligne['bf_date_debut_validite_fiche'])).' '.
324
					BAZ_AU.' '.strftime('%d.%m.%Y',strtotime($ligne['bf_date_fin_validite_fiche'])).'<br />'."\n";
324
					BAZ_AU.' '.strftime('%d.%m.%Y',strtotime($ligne['bf_date_fin_validite_fiche'])).'<br />'."\n";
325
			}
325
			}
326
		}
326
		}
327
		elseif ($GLOBALS['_BAZAR_']['appropriation']!=1 || $ligne['bf_statut_fiche']!=1) {
327
		elseif ($GLOBALS['_BAZAR_']['appropriation']!=1 || $ligne['bf_statut_fiche']!=1) {
328
			$res .= '<span class="rubrique">'.BAZ_PUBLIEE.':</span> '.BAZ_NON;							
328
			$res .= '<span class="rubrique">'.BAZ_PUBLIEE.':</span> '.BAZ_NON;							
329
			if ( $est_admin ) {
329
			if ( $est_admin ) {
330
				$res .= '&nbsp;&nbsp;&nbsp;<strong>'.BAZ_VALIDER_PUBLICATION.'&nbsp;:&nbsp;</strong>'."\n";
330
				$res .= '&nbsp;&nbsp;&nbsp;<strong>'.BAZ_VALIDER_PUBLICATION.'&nbsp;:&nbsp;</strong>'."\n";
331
				$lien_publie = &$GLOBALS['_BAZAR_']['url'];
331
				$lien_publie = &$GLOBALS['_BAZAR_']['url'];
332
				$lien_publie->addQueryString('action', BAZ_VOIR_FICHE);
332
				$lien_publie->addQueryString('action', BAZ_VOIR_FICHE);
333
				$lien_publie->addQueryString('id_fiche', $GLOBALS['_BAZAR_']['id_fiche']);
333
				$lien_publie->addQueryString('id_fiche', $GLOBALS['_BAZAR_']['id_fiche']);
334
				$lien_publie->addQueryString('typeannonce', $ligne['bf_ce_nature']);
334
				$lien_publie->addQueryString('typeannonce', $ligne['bf_ce_nature']);
335
				$lien_publie->addQueryString('publiee', 1);
335
				$lien_publie->addQueryString('publiee', 1);
336
				$res .= '<a href="'.$lien_publie->getURL().'">'.BAZ_OUI.'</a>&nbsp;/&nbsp;';
336
				$res .= '<a href="'.$lien_publie->getURL().'">'.BAZ_OUI.'</a>&nbsp;/&nbsp;';
337
				$lien_publie->removeQueryString('publiee');
337
				$lien_publie->removeQueryString('publiee');
338
				$lien_publie->addQueryString('publiee', 0);
338
				$lien_publie->addQueryString('publiee', 0);
339
				$res .='<a href="'.$lien_publie->getURL().'">'.BAZ_NON.'</a>'."\n";
339
				$res .='<a href="'.$lien_publie->getURL().'">'.BAZ_NON.'</a>'."\n";
340
				$lien_publie->removeQueryString('publiee');
340
				$lien_publie->removeQueryString('publiee');
341
			}
341
			}
342
			$res .= '<br />'."\n";
342
			$res .= '<br />'."\n";
343
		}
343
		}
344
		//affichage des infos pouvant interesser les admins
344
		//affichage des infos pouvant interesser les admins
345
		if ( $est_admin ) {
345
		if ( $est_admin ) {
346
			$res .= '<span class="rubrique" id="numero_fiche">'.BAZ_NUM_FICHE.':</span> '.$GLOBALS['_BAZAR_']['id_fiche'].'<br />'."\n";
346
			$res .= '<span class="rubrique" id="numero_fiche">'.BAZ_NUM_FICHE.':</span> '.$GLOBALS['_BAZAR_']['id_fiche'].'<br />'."\n";
347
			$res .= '<span class="rubrique" id="date_creation">'.BAZ_DATE_CREATION.' :</span> '.strftime('%d.%m.%Y &agrave; %H:%M',strtotime($ligne['bf_date_creation_fiche'])).'<br />'."\n";			
347
			$res .= '<span class="rubrique" id="date_creation">'.BAZ_DATE_CREATION.' :</span> '.strftime('%d.%m.%Y &agrave; %H:%M',strtotime($ligne['bf_date_creation_fiche'])).'<br />'."\n";			
348
		}		
348
		}		
349
		//affichage des infos et du lien pour la mise a jour de la fiche
349
		//affichage des infos et du lien pour la mise a jour de la fiche
350
		if ( $est_admin || $GLOBALS['_BAZAR_']['annonceur']==$GLOBALS['AUTH']->getAuthData(BAZ_CHAMPS_ID) ) {			
350
		if ( $est_admin || $GLOBALS['_BAZAR_']['annonceur']==$GLOBALS['AUTH']->getAuthData(BAZ_CHAMPS_ID) ) {			
351
			$res .= '<span class="rubrique" id="date_mise_a_jour">'.BAZ_DATE_MAJ.' :</span> '.strftime('%d.%m.%Y &agrave; %H:%M',strtotime($ligne['bf_date_maj_fiche']))."\n";
351
			$res .= '<span class="rubrique" id="date_mise_a_jour">'.BAZ_DATE_MAJ.' :</span> '.strftime('%d.%m.%Y &agrave; %H:%M',strtotime($ligne['bf_date_maj_fiche']))."\n";
352
			$lien_modifier=$GLOBALS['_BAZAR_']['url'];
352
			$lien_modifier=$GLOBALS['_BAZAR_']['url'];
353
			$lien_modifier->addQueryString('action', BAZ_ACTION_MODIFIER);
353
			$lien_modifier->addQueryString('action', BAZ_ACTION_MODIFIER);
354
			$lien_modifier->addQueryString('id_fiche', $GLOBALS['_BAZAR_']['id_fiche']);
354
			$lien_modifier->addQueryString('id_fiche', $GLOBALS['_BAZAR_']['id_fiche']);
355
			$lien_modifier->addQueryString('typeannonce', $ligne['bf_ce_nature']);
355
			$lien_modifier->addQueryString('typeannonce', $ligne['bf_ce_nature']);
356
			$res .= '&nbsp;&nbsp;&nbsp;<a href="'.$lien_modifier->getURL().'" id="modifier_fiche">'.BAZ_MODIFIER_LA_FICHE.'</a>'."\n";
356
			$res .= '&nbsp;&nbsp;&nbsp;<a href="'.$lien_modifier->getURL().'" id="modifier_fiche">'.BAZ_MODIFIER_LA_FICHE.'</a>'."\n";
357
		}
357
		}
358
	}
358
	}
359
	$res .= '</div>'."\n";
359
	$res .= '</div>'."\n";
360
	$res .= '</div>'."\n";
360
	$res .= '</div>'."\n";
361
	
361
	
362
	//on ajoute les appropriations, s'il le faut
362
	//on ajoute les appropriations, s'il le faut
363
	if (($danslappli==1)and($GLOBALS['_BAZAR_']['appropriation']==1)) {
363
	if (($danslappli==1)and($GLOBALS['_BAZAR_']['appropriation']==1)) {
364
		$res .= '<br />'."\n".'<div class="BAZ_cadre_fiche">'."\n";
364
		$res .= '<br />'."\n".'<div class="BAZ_cadre_fiche">'."\n";
365
		$res .= '<h3>'.BAZ_LES_STRUCTURES_POSSEDANT_UNE_RESSOURCE.'</h3>'."\n";		
365
		$res .= '<h3>'.BAZ_LES_STRUCTURES_POSSEDANT_UNE_RESSOURCE.'</h3>'."\n";		
366
		$requete = 'SELECT '.BAZ_CHAMPS_ID.', '.BAZ_CHAMPS_NOM.' FROM bazar_appropriation,'.BAZ_ANNUAIRE.' WHERE ba_ce_id_fiche='.$GLOBALS['_BAZAR_']['id_fiche'].' AND ba_ce_id_structure='.BAZ_CHAMPS_ID.' ORDER BY '.BAZ_CHAMPS_NOM.' ASC';
366
		$requete = 'SELECT '.BAZ_CHAMPS_ID.', '.BAZ_CHAMPS_NOM.' FROM bazar_appropriation,'.BAZ_ANNUAIRE.' WHERE ba_ce_id_fiche='.$GLOBALS['_BAZAR_']['id_fiche'].' AND ba_ce_id_structure='.BAZ_CHAMPS_ID.' ORDER BY '.BAZ_CHAMPS_NOM.' ASC';
367
		$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
367
		$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
368
		if (DB::isError ($resultat)) {
368
		if (DB::isError ($resultat)) {
369
			die ($resultat->getMessage().'<br />'.$resultat->getDebugInfo()) ;
369
			die ($resultat->getMessage().'<br />'.$resultat->getDebugInfo()) ;
370
		}
370
		}
371
		$possede_ressource=0;
371
		$possede_ressource=0;
372
		if ($resultat->numRows()>0) {
372
		if ($resultat->numRows()>0) {
373
			$res .= BAZ_IL_Y_A.$resultat->numRows().' ';
373
			$res .= BAZ_IL_Y_A.$resultat->numRows().' ';
374
			if ($resultat->numRows()==1) $res .= BAZ_STRUCTURE_POSSEDANT.'<br />'."\n";
374
			if ($resultat->numRows()==1) $res .= BAZ_STRUCTURE_POSSEDANT.'<br />'."\n";
375
			else $res .= BAZ_STRUCTURES_POSSEDANT.'<br />'."\n";
375
			else $res .= BAZ_STRUCTURES_POSSEDANT.'<br />'."\n";
376
			$res .= '<ul>'."\n";
376
			$res .= '<ul>'."\n";
377
			while ($ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
377
			while ($ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
378
				$res .= '<li><a href="'.BAZ_URL_ANNUAIRE.'&amp;voir_fiche='.$ligne[BAZ_CHAMPS_ID].'" onclick="javascript:window.open(this.href);return false;">'.$ligne[BAZ_CHAMPS_NOM].'</a></li>'."\n";
378
				$res .= '<li><a href="'.BAZ_URL_ANNUAIRE.'&amp;voir_fiche='.$ligne[BAZ_CHAMPS_ID].'" onclick="javascript:window.open(this.href);return false;">'.$ligne[BAZ_CHAMPS_NOM].'</a></li>'."\n";
379
				if ($GLOBALS['AUTH']->getAuth() && $GLOBALS['AUTH']->getAuthData(BAZ_CHAMPS_ID)==$ligne[BAZ_CHAMPS_ID]) $possede_ressource=1;
379
				if ($GLOBALS['AUTH']->getAuth() && $GLOBALS['AUTH']->getAuthData(BAZ_CHAMPS_ID)==$ligne[BAZ_CHAMPS_ID]) $possede_ressource=1;
380
			}
380
			}
381
			$res .= '</ul><br />'."\n";
381
			$res .= '</ul><br />'."\n";
382
		}
382
		}
383
		else $res .= BAZ_PAS_D_APPROPRIATION.'<br /><br />'."\n";
383
		else $res .= BAZ_PAS_D_APPROPRIATION.'<br /><br />'."\n";
384
		$res .='<p class="bulle_corps">'."\n";
384
		$res .='<p class="bulle_corps">'."\n";
385
		$lien_appropriation = $GLOBALS['_BAZAR_']['url'];
385
		$lien_appropriation = $GLOBALS['_BAZAR_']['url'];
386
		$lien_appropriation->addQueryString('action', BAZ_VOIR_FICHE);
386
		$lien_appropriation->addQueryString('action', BAZ_VOIR_FICHE);
387
		$lien_appropriation->addQueryString('id_fiche', $GLOBALS['_BAZAR_']['id_fiche']);			
387
		$lien_appropriation->addQueryString('id_fiche', $GLOBALS['_BAZAR_']['id_fiche']);			
388
		if ($possede_ressource) {
388
		if ($possede_ressource) {
389
			$lien_appropriation->addQueryString('appropriation', 0);
389
			$lien_appropriation->addQueryString('appropriation', 0);
390
			$res .= BAZ_POSSEDE_DEJA_RESSOURCE.'<br />'."\n".'<a href="'.$lien_appropriation->getURL().'">'.BAZ_CLIQUER_POUR_VOUS_ENLEVER.'</a>'."\n";
390
			$res .= BAZ_POSSEDE_DEJA_RESSOURCE.'<br />'."\n".'<a href="'.$lien_appropriation->getURL().'">'.BAZ_CLIQUER_POUR_VOUS_ENLEVER.'</a>'."\n";
391
			$lien_appropriation->removeQueryString('appropriation');
391
			$lien_appropriation->removeQueryString('appropriation');
392
		}
392
		}
393
		elseif ($GLOBALS['AUTH']->getAuth() && $GLOBALS['AUTH']->getAuthData(BAZ_CHAMPS_EST_STRUCTURE)) {
393
		elseif ($GLOBALS['AUTH']->getAuth() && $GLOBALS['AUTH']->getAuthData(BAZ_CHAMPS_EST_STRUCTURE)) {
394
			$lien_appropriation->addQueryString('appropriation', 1);
394
			$lien_appropriation->addQueryString('appropriation', 1);
395
			$res .= BAZ_SI_POSSEDE_RESSOURCE.'<br />'."\n".'<a href="'.$lien_appropriation->getURL().'">'.BAZ_CLIQUER_POUR_APPARAITRE.'</a>'."\n";
395
			$res .= BAZ_SI_POSSEDE_RESSOURCE.'<br />'."\n".'<a href="'.$lien_appropriation->getURL().'">'.BAZ_CLIQUER_POUR_APPARAITRE.'</a>'."\n";
396
			$lien_appropriation->removeQueryString('appropriation');
396
			$lien_appropriation->removeQueryString('appropriation');
397
		}
397
		}
398
		elseif ($GLOBALS['AUTH']->getAuth() && !$GLOBALS['AUTH']->getAuthData(BAZ_CHAMPS_EST_STRUCTURE)) {
398
		elseif ($GLOBALS['AUTH']->getAuth() && !$GLOBALS['AUTH']->getAuthData(BAZ_CHAMPS_EST_STRUCTURE)) {
399
			$res .= BAZ_IL_FAUT_ETRE_STRUCTURE."\n";
399
			$res .= BAZ_IL_FAUT_ETRE_STRUCTURE."\n";
400
		}
400
		}
401
		elseif (!$GLOBALS['AUTH']->getAuth()) {
401
		elseif (!$GLOBALS['AUTH']->getAuth()) {
402
			$res .= BAZ_IL_FAUT_ETRE_IDENTIFIE_STRUCTURE."\n";
402
			$res .= BAZ_IL_FAUT_ETRE_IDENTIFIE_STRUCTURE."\n";
403
		}
403
		}
404
		$res .='</p>'."\n";
404
		$res .='</p>'."\n";
405
		$res .= '</div>'."\n";
405
		$res .= '</div>'."\n";
406
	}
406
	}
407
	
407
	
408
	//on ajoute les commentaires, s'il le faut
408
	//on ajoute les commentaires, s'il le faut
409
	if (($danslappli==1)and($GLOBALS['_BAZAR_']['commentaire']==1)) {
409
	if (($danslappli==1)and($GLOBALS['_BAZAR_']['commentaire']==1)) {
410
		$res .= '<br />'."\n".'<div class="BAZ_cadre_fiche">'."\n";
410
		$res .= '<br />'."\n".'<div class="BAZ_cadre_fiche">'."\n";
411
		$res .= '<h3>'.BAZ_LES_COMMENTAIRES.'</h3>'."\n";
411
		$res .= '<h3>'.BAZ_LES_COMMENTAIRES.'</h3>'."\n";
412
		$requete = 'SELECT * FROM bazar_commentaires WHERE bc_ce_id_fiche='.$GLOBALS['_BAZAR_']['id_fiche'].' ORDER BY bc_date ASC';
412
		$requete = 'SELECT * FROM bazar_commentaires WHERE bc_ce_id_fiche='.$GLOBALS['_BAZAR_']['id_fiche'].' ORDER BY bc_date ASC';
413
		$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
413
		$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
414
		if (DB::isError ($resultat)) {
414
		if (DB::isError ($resultat)) {
415
			die ($resultat->getMessage().'<br />'.$resultat->getDebugInfo()) ;
415
			die ($resultat->getMessage().'<br />'.$resultat->getDebugInfo()) ;
416
		}
416
		}
417
		if ($resultat->numRows()>0) {
417
		if ($resultat->numRows()>0) {
418
			$res .= BAZ_IL_Y_A.$resultat->numRows().' ';
418
			$res .= BAZ_IL_Y_A.$resultat->numRows().' ';
419
			if ($resultat->numRows()==1) $res .= BAZ_COMMENTAIRE.'<br />'."\n";
419
			if ($resultat->numRows()==1) $res .= BAZ_COMMENTAIRE.'<br />'."\n";
420
			else $res .= BAZ_COMMENTAIRES.'<br />'."\n";
420
			else $res .= BAZ_COMMENTAIRES.'<br />'."\n";
421
			while ($ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
421
			while ($ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
422
				$res .= '<div class="bulle_haut">&nbsp;</div>'."\n";
422
				$res .= '<div class="bulle_haut">&nbsp;</div>'."\n";
423
				$res .= '<div class="bulle_corps">'."\n";
423
				$res .= '<div class="bulle_corps">'."\n";
424
				//affichage du commentaire
424
				//affichage du commentaire
425
				$res .= $ligne['bc_commentaire'].'<br />'."\n";
425
				$res .= $ligne['bc_commentaire'].'<br />'."\n";
426
				$res .= '</div>'."\n";
426
				$res .= '</div>'."\n";
427
				$res .= '<div class="bulle_bas">'."\n";
427
				$res .= '<div class="bulle_bas">'."\n";
428
				$res .= '<div style="font-size:9px;margin-left:10px;">'.BAZ_PAR.' : <strong>'.$ligne['bc_nom'].'</strong>'.BAZ_ECRIT_LE.$ligne['bc_date'].'</div>'."\n";
428
				$res .= '<div style="font-size:9px;margin-left:10px;">'.BAZ_PAR.' : <strong>'.$ligne['bc_nom'].'</strong>'.BAZ_ECRIT_LE.$ligne['bc_date'].'</div>'."\n";
429
				//pour les identifies seulement, administrateurs de la rubrique ou superadmins
429
				//pour les identifies seulement, administrateurs de la rubrique ou superadmins
430
				if ($est_admin==1) {
430
				if ($est_admin==1) {
431
					$url_comment= $GLOBALS['_BAZAR_']['url'];
431
					$url_comment= $GLOBALS['_BAZAR_']['url'];
432
					$url_comment->addQueryString('action', BAZ_VOIR_FICHE);
432
					$url_comment->addQueryString('action', BAZ_VOIR_FICHE);
433
					$url_comment->addQueryString('id_fiche', $GLOBALS['_BAZAR_']['id_fiche']);
433
					$url_comment->addQueryString('id_fiche', $GLOBALS['_BAZAR_']['id_fiche']);
434
					$url_comment->addQueryString('id_commentaire', $ligne['bc_id_commentaire']);
434
					$url_comment->addQueryString('id_commentaire', $ligne['bc_id_commentaire']);
435
					$res .= '<a href="'.$url_comment->getURL().'" style="font-size:9px;float:right;">'.BAZ_SUPPRIMER.'</a>'."\n";
435
					$res .= '<a href="'.$url_comment->getURL().'" style="font-size:9px;float:right;">'.BAZ_SUPPRIMER.'</a>'."\n";
436
				}
436
				}
437
				$res .= '</div>'."\n";
437
				$res .= '</div>'."\n";
438
			}
438
			}
439
		}
439
		}
440
		else $res .= BAZ_PAS_DE_COMMENTAIRES.'<br /><br />'."\n";
440
		else $res .= BAZ_PAS_DE_COMMENTAIRES.'<br /><br />'."\n";
441
		
441
		
442
		//formulaire des commentaires
442
		//formulaire des commentaires
443
		$form_commentaire = new HTML_QuickForm('bazar_commentaire', 'post', $url);
443
		$form_commentaire = new HTML_QuickForm('bazar_commentaire', 'post', $url);
444
		$squelette =& $form_commentaire->defaultRenderer();
444
		$squelette =& $form_commentaire->defaultRenderer();
445
		$squelette->setFormTemplate("\n".'<form {attributes}>'."\n".'{content}'."\n".'</form>'."\n");
445
		$squelette->setFormTemplate("\n".'<form {attributes}>'."\n".'{content}'."\n".'</form>'."\n");
446
		$squelette->setElementTemplate( '<label style="width:200px;">{label}'.
446
		$squelette->setElementTemplate( '<label style="width:200px;">{label}'.
447
										'<!-- BEGIN required --><span class="symbole_obligatoire">&nbsp;*</span><!-- END required -->'."\n".
447
										'<!-- BEGIN required --><span class="symbole_obligatoire">&nbsp;*</span><!-- END required -->'."\n".
448
									    '</label><br />'."\n".'{element}<br />'."\n");
448
									    '</label><br />'."\n".'{element}<br />'."\n");
449
		$squelette->setRequiredNoteTemplate("\n".'<span class="symbole_obligatoire"> *{requiredNote}</span>'."\n");
449
		$squelette->setRequiredNoteTemplate("\n".'<span class="symbole_obligatoire"> *{requiredNote}</span>'."\n");
450
		$option=array('style'=>'width:300px;border:1px solid #000;', 'maxlength'=>100);
450
		$option=array('style'=>'width:300px;border:1px solid #000;', 'maxlength'=>100);
451
		$form_commentaire->addElement('text', 'Nom', BAZ_ENTREZ_VOTRE_NOM, $option);
451
		$form_commentaire->addElement('text', 'Nom', BAZ_ENTREZ_VOTRE_NOM, $option);
452
		$option=array('style'=>'width:95%;height:100px;white-space: pre;padding:3px;border:1px solid #000;');
452
		$option=array('style'=>'width:95%;height:100px;white-space: pre;padding:3px;border:1px solid #000;');
453
		require_once PAP_CHEMIN_API_PEAR.'HTML/QuickForm/textarea.php';
453
		require_once PAP_CHEMIN_API_PEAR.'HTML/QuickForm/textarea.php';
454
		$formtexte= new HTML_QuickForm_textarea('Commentaire', BAZ_ENTREZ_VOTRE_COMMENTAIRE, $option);
454
		$formtexte= new HTML_QuickForm_textarea('Commentaire', BAZ_ENTREZ_VOTRE_COMMENTAIRE, $option);
455
		$form_commentaire->addElement($formtexte) ;
455
		$form_commentaire->addElement($formtexte) ;
456
		$option=array('style'=>'border:1px solid #000;');
456
		$option=array('style'=>'border:1px solid #000;');
457
		$form_commentaire->addElement('submit', 'Envoyer', BAZ_ENVOYER, $option);
457
		$form_commentaire->addElement('submit', 'Envoyer', BAZ_ENVOYER, $option);
458
		$form_commentaire->addRule('Nom', BAZ_NOM_REQUIS, 'required', '', 'client') ;
458
		$form_commentaire->addRule('Nom', BAZ_NOM_REQUIS, 'required', '', 'client') ;
459
		$form_commentaire->addRule('Commentaire', BAZ_COMMENTAIRE_REQUIS, 'required', '', 'client') ;
459
		$form_commentaire->addRule('Commentaire', BAZ_COMMENTAIRE_REQUIS, 'required', '', 'client') ;
460
		$form_commentaire->setRequiredNote(BAZ_CHAMPS_REQUIS) ;
460
		$form_commentaire->setRequiredNote(BAZ_CHAMPS_REQUIS) ;
461
		$res .= $form_commentaire->toHTML();
461
		$res .= $form_commentaire->toHTML();
462
		$res .= '</div>'."\n";
462
		$res .= '</div>'."\n";
463
	}
463
	}
464
	
464
	
465
	return $res ;
465
	return $res ;
466
}
466
}
467
 
467
 
468
 
468
 
469
/** RSSversHTML () transforme un flux RSS (en XML) en page HTML
469
/** RSSversHTML () transforme un flux RSS (en XML) en page HTML
470
*
470
*
471
*   On passe en paramètre le contenu du flux RSS, on affiche ou non la description,
471
*   On passe en paramètre le contenu du flux RSS, on affiche ou non la description,
472
*   et on choisit de format de la date à l'affichage. On a en sortie du code HTML à afficher 
472
*   et on choisit de format de la date à l'affichage. On a en sortie du code HTML à afficher 
473
*
473
*
474
*   @param  string   le contenu du flux RSS
474
*   @param  string   le contenu du flux RSS
475
*   @param  boolean  afficher ou non la description
475
*   @param  boolean  afficher ou non la description
476
*   @param  string  choisir le format de date: jmah (12/02/2004 12h34) jmh (12/02 12h34) jma (12/02/2004) jm (12/02) ou rien
476
*   @param  string  choisir le format de date: jmah (12/02/2004 12h34) jmh (12/02 12h34) jma (12/02/2004) jm (12/02) ou rien
477
*
477
*
478
*   @return  string    le code HTML
478
*   @return  string    le code HTML
479
*/
479
*/
480
function RSSversHTML($rss, $voirdesc, $formatdate, $affichenb) {
480
function RSSversHTML($rss, $voirdesc, $formatdate, $affichenb) {
481
	if ($rss!='') {
481
	if ($rss!='') {
482
		$rawitems='';$title='';$url='';$cat='';$date='';
482
		$rawitems='';$title='';$url='';$cat='';$date='';
483
		$res='';
483
		$res='';
484
		if( eregi('<item>(.*)</item>', $rss, $rawitems ) ) {
484
		if( eregi('<item>(.*)</item>', $rss, $rawitems ) ) {
485
			$items = explode('<item>', $rawitems[0]);
485
			$items = explode('<item>', $rawitems[0]);
486
			$res.='<ul id="BAZ_liste_fiche">'."\n";
486
			$res.='<ul id="BAZ_liste_fiche">'."\n";
487
			for( $i = 0; $i < count($items)-1; $i++ ) {
487
			for( $i = 0; $i < count($items)-1; $i++ ) {
488
				eregi('<title>(.*)</title>',$items[$i+1], $title );
488
				eregi('<title>(.*)</title>',$items[$i+1], $title );
489
				eregi('<link>(.*)</link>',$items[$i+1], $url );
489
				eregi('<link>(.*)</link>',$items[$i+1], $url );
490
				eregi('<description>(.*)</description>',$items[$i+1], $cat);
490
				eregi('<description>(.*)</description>',$items[$i+1], $cat);
491
				eregi('<pubDate>(.*)</pubDate>',$items[$i+1], $date);
491
				eregi('<pubDate>(.*)</pubDate>',$items[$i+1], $date);
492
				$res.='<li>';
492
				$res.='<li>';
493
				if ($formatdate=='jm') {$res.=strftime('%d.%m',strtotime($date[1])).': ';}
493
				if ($formatdate=='jm') {$res.=strftime('%d.%m',strtotime($date[1])).': ';}
494
				if ($formatdate=='jma') {$res.=strftime('%d.%m.%Y',strtotime($date[1])).': ';}
494
				if ($formatdate=='jma') {$res.=strftime('%d.%m.%Y',strtotime($date[1])).': ';}
495
				if ($formatdate=='jmh') {$res.=strftime('%d.%m %H:%M',strtotime($date[1])).': ';}
495
				if ($formatdate=='jmh') {$res.=strftime('%d.%m %H:%M',strtotime($date[1])).': ';}
496
				if ($formatdate=='jmah') {$res.=strftime('%d.%m.%Y %H:%M',strtotime($date[1])).': ';}
496
				if ($formatdate=='jmah') {$res.=strftime('%d.%m.%Y %H:%M',strtotime($date[1])).': ';}
497
				$res.='<a href="'.preg_replace ('/&amp;/', '&', $url[1]).'">'.$title[1].'</a>';
497
				$res.='<a href="'.preg_replace ('/&amp;/', '&', $url[1]).'">'.$title[1].'</a>';
498
				if ($voirdesc) {$res.=$cat[1];}
498
				if ($voirdesc) {$res.=$cat[1];}
499
				// Ajout du bouton supprimer pour les superadministrateur
499
				// Ajout du bouton supprimer pour les superadministrateur
500
				if (($GLOBALS['AUTH']->getAuth() && niveau_droit(0,$GLOBALS['AUTH']->getAuthData(BAZ_CHAMPS_ID))=='superadministrateur')and($url[1]!='#')) {
500
				if (($GLOBALS['AUTH']->getAuth() && niveau_droit(0,$GLOBALS['AUTH']->getAuthData(BAZ_CHAMPS_ID))=='superadministrateur')and($url[1]!='#')) {
501
					$mon_url = preg_replace ('/&amp;/', '&', $url[1]) ; 
501
					$mon_url = preg_replace ('/&amp;/', '&', $url[1]) ; 
502
					$url_suppr = new Net_URL(preg_replace ('/&amp;/', '&', $mon_url)) ;
502
					$url_suppr = new Net_URL(preg_replace ('/&amp;/', '&', $mon_url)) ;
503
					$url_suppr->addQueryString('action', BAZ_ACTION_SUPPRESSION) ;
503
					$url_suppr->addQueryString('action', BAZ_ACTION_SUPPRESSION) ;
504
		        	$res .= ' ( <a href="'.$url_suppr->getURL().
504
		        	$res .= ' ( <a href="'.$url_suppr->getURL().
505
							'" onclick="javascript:return confirm(\''.BAZ_SUPPRIMER.' ?\');">'.
505
							'" onclick="javascript:return confirm(\''.BAZ_SUPPRIMER.' ?\');">'.
506
							BAZ_SUPPRIMER.'</a> )'."\n" ;
506
							BAZ_SUPPRIMER.'</a> )'."\n" ;
507
					}
507
					}
508
				$res.='</li>'."\n";
508
				$res.='</li>'."\n";
509
			}
509
			}
510
			$res.='</ul>'."\n";
510
			$res.='</ul>'."\n";
511
			if ($affichenb==1) {
511
			if ($affichenb==1) {
512
				//une annonce trouvee, on accorde au singulier
512
				//une annonce trouvee, on accorde au singulier
513
				if (((count($items)-1)==1)and($title!=BAZ_PAS_D_ANNONCES)) {
513
				if (((count($items)-1)==1)and($title!=BAZ_PAS_D_ANNONCES)) {
514
					$res = '<br /><h4>'.BAZ_IL_Y_A.' 1 '.BAZ_FICHE_CORRESPONDANTE.'</h4><br />'."\n".$res;
514
					$res = '<br /><h4>'.BAZ_IL_Y_A.' 1 '.BAZ_FICHE_CORRESPONDANTE.'</h4><br />'."\n".$res;
515
				}
515
				}
516
				//plusieures annonces trouvees, on accorde au pluriel
516
				//plusieures annonces trouvees, on accorde au pluriel
517
				else {
517
				else {
518
					$res = '<br /><h4>'.BAZ_IL_Y_A.(count($items)-1).' '.BAZ_FICHES_CORRESPONDANTES.'</h4><br />'."\n".$res;
518
					$res = '<br /><h4>'.BAZ_IL_Y_A.(count($items)-1).' '.BAZ_FICHES_CORRESPONDANTES.'</h4><br />'."\n".$res;
519
				}
519
				}
520
			}
520
			}
521
			//cas des fiches pas trouvées
521
			//cas des fiches pas trouvées
522
			if (((count($items)-1)==1)and($title[1]==BAZ_PAS_D_ANNONCES)) {
522
			if (((count($items)-1)==1)and($title[1]==BAZ_PAS_D_ANNONCES)) {
523
				$res = '<br /><h4>'.BAZ_PAS_D_ANNONCES.'</h4><br />'."\n";
523
				$res = '<br /><h4>'.BAZ_PAS_D_ANNONCES.'</h4><br />'."\n";
524
			}  
524
			}  
525
		}
525
		}
526
	}
526
	}
527
	else $res = BAZ_PAS_D_ANNONCES;
527
	else $res = BAZ_PAS_D_ANNONCES;
528
	
528
	
529
	return $res;
529
	return $res;
530
}
530
}
531
 
531
 
532
/** gen_RSS() - generer un fichier de flux RSS par type d'annonce 
532
/** gen_RSS() - generer un fichier de flux RSS par type d'annonce 
533
*
533
*
534
* @param   string Le type de l'annonce (laisser vide pour tout type d'annonce)
534
* @param   string Le type de l'annonce (laisser vide pour tout type d'annonce)
535
* @param   integer Le nombre d'annonces a regrouper dans le fichier XML (laisser vide pour toutes)
535
* @param   integer Le nombre d'annonces a regrouper dans le fichier XML (laisser vide pour toutes)
536
* @param   integer L'identifiant de l'emetteur (laisser vide pour tous)
536
* @param   integer L'identifiant de l'emetteur (laisser vide pour tous)
537
* @param   integer L'etat de validation de l'annonce (laisser 1 pour les annonces validees, 0 pour les non-validees)
537
* @param   integer L'etat de validation de l'annonce (laisser 1 pour les annonces validees, 0 pour les non-validees)
538
* @param   string La requete SQL personnalisee
538
* @param   string La requete SQL personnalisee
539
* @param   integer La categorie des fiches bazar
539
* @param   integer La categorie des fiches bazar
540
*
540
*
541
* @return  string Le code du flux RSS
541
* @return  string Le code du flux RSS
542
*/
542
*/
543
function gen_RSS($typeannonce='', $nbitem='', $emetteur='', $valide=1, $requeteSQL='', $requeteSQLFrom = '', $requeteWhereListe = '', $categorie_nature='') {
543
function gen_RSS($typeannonce='', $nbitem='', $emetteur='', $valide=1, $requeteSQL='', $requeteSQLFrom = '', $requeteWhereListe = '', $categorie_nature='') {
544
	// generation de la requete MySQL personnalisee
544
	// generation de la requete MySQL personnalisee
545
	$req_where=0;
545
	$req_where=0;
546
	$requete = 'SELECT DISTINCT bf_id_fiche, bf_titre, bf_date_debut_validite_fiche, bf_description,  bn_label_nature, bf_date_creation_fiche '.
546
	$requete = 'SELECT DISTINCT bf_id_fiche, bf_titre, bf_date_debut_validite_fiche, bf_description,  bn_label_nature, bf_date_creation_fiche '.
547
				'FROM bazar_fiche, bazar_nature '.$requeteSQLFrom.' WHERE '.$requeteWhereListe;
547
				'FROM bazar_fiche, bazar_nature '.$requeteSQLFrom.' WHERE '.$requeteWhereListe;
548
	if ($valide!=2) {
548
	if ($valide!=2) {
549
		$requete .= 'bf_statut_fiche='.$valide;
549
		$requete .= 'bf_statut_fiche='.$valide;
550
		$req_where=1;
550
		$req_where=1;
551
	}
551
	}
552
	$nomflux=BAZ_DERNIERE_ACTU;
552
	$nomflux=BAZ_DERNIERE_ACTU;
553
	if (!is_array ($typeannonce) && $typeannonce!='' and $typeannonce!='toutes') {
553
	if (!is_array ($typeannonce) && $typeannonce!='' and $typeannonce!='toutes') {
554
		if ($req_where==1) {$requete .= ' AND ';}
554
		if ($req_where==1) {$requete .= ' AND ';}
555
		$requete .= 'bf_ce_nature='.$typeannonce.' and bf_ce_nature=bn_id_nature ';;
555
		$requete .= 'bf_ce_nature='.$typeannonce.' and bf_ce_nature=bn_id_nature ';;
556
		$req_where=1;
556
		$req_where=1;
557
		//le nom du flux devient le type d'annonce
557
		//le nom du flux devient le type d'annonce
558
		$requete_nom_flux = 'select bn_label_nature from bazar_nature where bn_id_nature = '.$typeannonce;
558
		$requete_nom_flux = 'select bn_label_nature from bazar_nature where bn_id_nature = '.$typeannonce;
559
		$nomflux = $GLOBALS['_BAZAR_']['db']->getOne($requete_nom_flux) ;
559
		$nomflux = $GLOBALS['_BAZAR_']['db']->getOne($requete_nom_flux) ;
560
	}
560
	}
561
	// Cas où il y plusieurs type d annonce demande
561
	// Cas où il y plusieurs type d annonce demande
562
	if (is_array ($typeannonce)) {
562
	if (is_array ($typeannonce)) {
563
		if ($req_where==1) {$requete .= ' AND ';}
563
		if ($req_where==1) {$requete .= ' AND ';}
564
		$requete .= 'bf_ce_nature IN (' ;
564
		$requete .= 'bf_ce_nature IN (' ;
565
		$chaine = '';
565
		$chaine = '';
566
		foreach ($typeannonce as $valeur) $chaine .= '"'.$valeur.'",' ;
566
		foreach ($typeannonce as $valeur) $chaine .= '"'.$valeur.'",' ;
567
		$requete .= substr ($chaine, 0, strlen ($chaine)-1) ; 
567
		$requete .= substr ($chaine, 0, strlen ($chaine)-1) ; 
568
		$requete .= ') ';
568
		$requete .= ') ';
569
	}
569
	}
570
	$utilisateur = new Administrateur_bazar ($GLOBALS['AUTH']) ;
570
	$utilisateur = new Administrateur_bazar ($GLOBALS['AUTH']) ;
571
	if ($valide!=0) {
571
	if ($valide!=0) {
572
		
572
		
573
		if ($utilisateur->isSuperAdmin()) {
573
		if ($utilisateur->isSuperAdmin()) {
574
			$req_where=1;
574
			$req_where=1;
575
		} else {
575
		} else {
576
			if ($req_where==1) {
576
			if ($req_where==1) {
577
				$requete .= ' AND ';
577
				$requete .= ' AND ';
578
			}
578
			}
579
			$requete .= '(bf_date_debut_validite_fiche<=NOW() or bf_date_debut_validite_fiche="0000-00-00")'.
579
			$requete .= '(bf_date_debut_validite_fiche<=NOW() or bf_date_debut_validite_fiche="0000-00-00")'.
580
						' AND (bf_date_fin_validite_fiche>=NOW() or bf_date_fin_validite_fiche="0000-00-00") AND bn_id_nature=bf_ce_nature';
580
						' AND (bf_date_fin_validite_fiche>=NOW() or bf_date_fin_validite_fiche="0000-00-00") AND bn_id_nature=bf_ce_nature';
581
		}
581
		}
582
	}
582
	}
583
	else $nomflux .= BAZ_A_MODERER;
583
	else $nomflux .= BAZ_A_MODERER;
584
	if ($emetteur!='' && $emetteur!='tous') {
584
	if ($emetteur!='' && $emetteur!='tous') {
585
		if ($req_where==1) {$requete .= ' AND ';}
585
		if ($req_where==1) {$requete .= ' AND ';}
586
		$requete .= 'bf_ce_utilisateur='.$emetteur;
586
		$requete .= 'bf_ce_utilisateur='.$emetteur;
587
		$req_where=1;
587
		$req_where=1;
588
		//requete pour afficher le nom de la structure
588
		//requete pour afficher le nom de la structure
589
		$requetenom = 'SELECT '.BAZ_CHAMPS_NOM.', '.BAZ_CHAMPS_PRENOM.' FROM '.
589
		$requetenom = 'SELECT '.BAZ_CHAMPS_NOM.', '.BAZ_CHAMPS_PRENOM.' FROM '.
590
						BAZ_ANNUAIRE.' WHERE '.BAZ_CHAMPS_ID.'='.$emetteur;
590
						BAZ_ANNUAIRE.' WHERE '.BAZ_CHAMPS_ID.'='.$emetteur;
591
		$resultat = $GLOBALS['_BAZAR_']['db']->query($requetenom) ;
591
		$resultat = $GLOBALS['_BAZAR_']['db']->query($requetenom) ;
592
		if (DB::isError($resultat)) {
592
		if (DB::isError($resultat)) {
593
			die ($resultat->getMessage().$resultat->getDebugInfo()) ;
593
			die ($resultat->getMessage().$resultat->getDebugInfo()) ;
594
		}
594
		}
595
		$ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC);
595
		$ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC);
596
		$nomflux .= ' ('.$ligne[BAZ_CHAMPS_NOM].' '.$ligne[BAZ_CHAMPS_PRENOM].')';
596
		$nomflux .= ' ('.$ligne[BAZ_CHAMPS_NOM].' '.$ligne[BAZ_CHAMPS_PRENOM].')';
597
	}
597
	}
598
	if ($requeteSQL!='') {
598
	if ($requeteSQL!='') {
599
		if ($req_where==1) {$requete .= ' AND ';}
599
		if ($req_where==1) {$requete .= ' AND ';}
600
		$requete .= '('.$requeteSQL.')';
600
		$requete .= '('.$requeteSQL.')';
601
		$req_where=1;
601
		$req_where=1;
602
	}
602
	}
603
	if ($categorie_nature!='') {
603
	if ($categorie_nature!='') {
604
		if ($req_where==1) {$requete .= ' AND ';}
604
		if ($req_where==1) {$requete .= ' AND ';}
605
		$requete .= 'bn_ce_id_menu IN ('.$categorie_nature.') ';
605
		$requete .= 'bn_ce_id_menu IN ('.$categorie_nature.') ';
606
		$req_where=1;
606
		$req_where=1;
607
	}
607
	}
608
	
608
	
609
	$requete .= ' ORDER BY   bf_date_creation_fiche DESC, bf_date_fin_validite_fiche DESC, bf_date_maj_fiche DESC';
609
	$requete .= ' ORDER BY   bf_date_creation_fiche DESC, bf_date_fin_validite_fiche DESC, bf_date_maj_fiche DESC';
610
	if ($nbitem!='') {$requete .= ' LIMIT 0,'.$nbitem;}
610
	if ($nbitem!='') {$requete .= ' LIMIT 0,'.$nbitem;}
611
	$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
611
	$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
612
	if (DB::isError($resultat)) {
612
	if (DB::isError($resultat)) {
613
		die ($resultat->getMessage().$resultat->getDebugInfo()) ;
613
		die ($resultat->getMessage().$resultat->getDebugInfo()) ;
614
	}
614
	}
615
 
615
	
-
 
616
	function xmlEntities($s){
-
 
617
		//build first an assoc. array with the entities we want to match
-
 
618
		$table1 = get_html_translation_table(HTML_ENTITIES, ENT_QUOTES);
-
 
619
		
-
 
620
		//now build another assoc. array with the entities we want to replace (numeric entities)
-
 
621
		foreach ($table1 as $k=>$v){
-
 
622
		  $table1[$k] = "/$v/";
-
 
623
		  $c = htmlentities($k,ENT_QUOTES,"UTF-8");
-
 
624
		  $table2[$c] = "&#".ord($k).";";
-
 
625
		}
-
 
626
		
-
 
627
		//now perform a replacement using preg_replace
-
 
628
		//each matched value in array 1 will be replaced with the corresponding value in array 2
-
 
629
		$s = preg_replace($table1,$table2,$s);
-
 
630
		return $s;
-
 
631
	}
-
 
632
	
616
	include_once 'XML/Util.php' ;
633
	include_once 'XML/Util.php' ;
617
 
634
 
618
	$xml = XML_Util::getXMLDeclaration('1.0', 'ISO-8859-1', 'no') ; 
635
	$xml = XML_Util::getXMLDeclaration('1.0', 'ISO-8859-1', 'no') ; 
619
	$xml .= XML_Util::createStartElement ('rss', array('version' => '2.0')) ;
636
	$xml .= XML_Util::createStartElement ('rss', array('version' => '2.0')) ;
620
	$xml .= XML_Util::createStartElement ('channel');
637
	$xml .= XML_Util::createStartElement ('channel');
621
	$xml .= XML_Util::createTag ('title', null, $nomflux, null, false);
638
	$xml .= XML_Util::createTag ('title', null, $nomflux, null, false);
622
	$xml .= XML_Util::createTag ('link', null, BAZ_RSS_ADRESSESITE);
639
	$xml .= XML_Util::createTag ('link', null, BAZ_RSS_ADRESSESITE);
623
	$xml .= XML_Util::createTag ('description', null, BAZ_RSS_DESCRIPTIONSITE);
640
	$xml .= XML_Util::createTag ('description', null, BAZ_RSS_DESCRIPTIONSITE);
624
	$xml .= XML_Util::createTag ('language', null, 'fr-FR');
641
	$xml .= XML_Util::createTag ('language', null, 'fr-FR');
625
	$xml .= XML_Util::createTag ('copyright', null, 'Copyright 2005 '.BAZ_RSS_NOMSITE);
642
	$xml .= XML_Util::createTag ('copyright', null, 'Copyright 2005 '.BAZ_RSS_NOMSITE);
626
	$xml .= XML_Util::createTag ('lastBuildDate', null, strftime('%d %b %Y %H:%M:%S GMT'));
643
	$xml .= XML_Util::createTag ('lastBuildDate', null, strftime('%d %b %Y %H:%M:%S GMT'));
627
	$xml .= XML_Util::createTag ('docs', null, 'http://www.stervinou.com/projets/rss/');
644
	$xml .= XML_Util::createTag ('docs', null, 'http://www.stervinou.com/projets/rss/');
628
	$xml .= XML_Util::createTag ('category', null, BAZ_RSS_CATEGORIE);
645
	$xml .= XML_Util::createTag ('category', null, BAZ_RSS_CATEGORIE);
629
	$xml .= XML_Util::createTag ('managingEditor', null, BAZ_RSS_MANAGINGEDITOR);
646
	$xml .= XML_Util::createTag ('managingEditor', null, BAZ_RSS_MANAGINGEDITOR);
630
	$xml .= XML_Util::createTag ('webMaster', null, BAZ_RSS_WEBMASTER);
647
	$xml .= XML_Util::createTag ('webMaster', null, BAZ_RSS_WEBMASTER);
631
	$xml .= XML_Util::createTag ('ttl', null, '60');
648
	$xml .= XML_Util::createTag ('ttl', null, '60');
632
	$xml .= XML_Util::createStartElement ('image');
649
	$xml .= XML_Util::createStartElement ('image');
633
		$xml .= XML_Util::createTag ('title', null, BAZ_RSS_NOMSITE);
650
		$xml .= XML_Util::createTag ('title', null, BAZ_RSS_NOMSITE);
634
		$xml .= XML_Util::createTag ('url', null, BAZ_RSS_LOGOSITE);
651
		$xml .= XML_Util::createTag ('url', null, BAZ_RSS_LOGOSITE);
635
		$xml .= XML_Util::createTag ('link', null, BAZ_RSS_ADRESSESITE);
652
		$xml .= XML_Util::createTag ('link', null, BAZ_RSS_ADRESSESITE);
636
	$xml .= XML_Util::createEndElement ('image');
653
	$xml .= XML_Util::createEndElement ('image');
637
	if ($resultat->numRows()>0) {
654
	if ($resultat->numRows()>0) {
638
		// Creation des items : titre + lien + description + date de publication
655
		// Creation des items : titre + lien + description + date de publication
639
		while ($ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
656
		while ($ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
640
			$xml .= XML_Util::createStartElement ('item');
657
			$xml .= XML_Util::createStartElement ('item');
641
			
658
			
642
			$xml .= XML_Util::createTag ('title', null, $ligne['bf_titre']);
659
			$xml .= XML_Util::createTag ('title', null, xmlEntities($ligne['bf_titre']));
643
			
660
			
644
			$lien=$GLOBALS['_BAZAR_']['url'];
661
			$lien=$GLOBALS['_BAZAR_']['url'];
645
			$lien->addQueryString('action', BAZ_VOIR_FICHE);
662
			$lien->addQueryString('action', BAZ_VOIR_FICHE);
646
			$lien->addQueryString('id_fiche', $ligne['bf_id_fiche']);
663
			$lien->addQueryString('id_fiche', $ligne['bf_id_fiche']);
647
			$xml .= XML_Util::createTag ('link', null, $lien->getURL());
664
			$xml .= XML_Util::createTag ('link', null, $lien->getURL());
648
			$xml .= XML_Util::createTag ('guid', null, $lien->getURL());
665
			$xml .= XML_Util::createTag ('guid', null, $lien->getURL());
649
			$xml .= XML_Util::createStartElement ('description');
666
			$xml .= XML_Util::createStartElement ('description');
650
			if ($_GET['action'] != BAZ_VOIR_TOUTES_ANNONCES) {
667
			if ($_GET['action'] != BAZ_VOIR_TOUTES_ANNONCES) {
651
				$xml .= XML_Util::createCDataSection ($ligne['bf_description']);
668
				$xml .= XML_Util::createCDataSection ($ligne['bf_description']);
652
			}
669
			}
653
			$xml .= XML_Util::createEndElement ('description');
670
			$xml .= XML_Util::createEndElement ('description');
654
			if ($ligne['bf_date_debut_validite_fiche'] == '0000-00-00') $date_pub = $ligne[' bf_date_creation_fiche'] ; else 
671
			if ($ligne['bf_date_debut_validite_fiche'] == '0000-00-00') $date_pub = $ligne[' bf_date_creation_fiche'] ; else 
655
					$date_pub =  $ligne['bf_date_debut_validite_fiche'];
672
					$date_pub =  $ligne['bf_date_debut_validite_fiche'];
656
			$xml .= XML_Util::createTag ('pubDate', null, strftime('%d %b %Y %H:%M:%S GMT',strtotime($date_pub)));
673
			$xml .= XML_Util::createTag ('pubDate', null, strftime('%d %b %Y %H:%M:%S GMT',strtotime($date_pub)));
657
			$xml .= XML_Util::createEndElement ('item');
674
			$xml .= XML_Util::createEndElement ('item');
658
		}
675
		}
659
	}
676
	}
660
	else {//pas d'annonces
677
	else {//pas d'annonces
661
		$xml .= XML_Util::createStartElement ('item');
678
		$xml .= XML_Util::createStartElement ('item');
662
		$xml .= XML_Util::createTag ('title', null, BAZ_PAS_D_ANNONCES);
679
		$xml .= XML_Util::createTag ('title', null, BAZ_PAS_D_ANNONCES);
663
		$xml .= XML_Util::createTag ('link', null, '#');
680
		$xml .= XML_Util::createTag ('link', null, '#');
664
		$xml .= XML_Util::createTag ('description', null, BAZ_PAS_D_ANNONCES);
681
		$xml .= XML_Util::createTag ('description', null, BAZ_PAS_D_ANNONCES);
665
		$xml .= XML_Util::createTag ('pubDate', null, strftime('%d %b %Y %H:%M:%S GMT',strtotime('12/12/2004')));
682
		$xml .= XML_Util::createTag ('pubDate', null, strftime('%d %b %Y %H:%M:%S GMT',strtotime('12/12/2004')));
666
		$xml .= XML_Util::createEndElement ('item');
683
		$xml .= XML_Util::createEndElement ('item');
667
		$xml .= '</item>'."\n";
684
		$xml .= '</item>'."\n";
668
	}
685
	}
669
	$xml .= XML_Util::createEndElement ('channel');
686
	$xml .= XML_Util::createEndElement ('channel');
670
	$xml .= XML_Util::createEndElement('rss') ;
687
	$xml .= XML_Util::createEndElement('rss') ;
671
	return $xml;
688
	return $xml;
672
}
689
}
673
 
690
 
674
 
691
 
675
/** baz_liste() Formate la liste de toutes les annonces actuelles
692
/** baz_liste() Formate la liste de toutes les annonces actuelles
676
*
693
*
677
*   @return  string    le code HTML a afficher
694
*   @return  string    le code HTML a afficher
678
*/
695
*/
679
function baz_liste($typeannonce='toutes') {
696
function baz_liste($typeannonce='toutes') {
680
	//creation du lien pour le formulaire de recherche
697
	//creation du lien pour le formulaire de recherche
681
	$GLOBALS['_BAZAR_']['url']->addQueryString('action', BAZ_VOIR_TOUTES_ANNONCES);
698
	$GLOBALS['_BAZAR_']['url']->addQueryString('action', BAZ_VOIR_TOUTES_ANNONCES);
682
	if (isset($_REQUEST['recherche_avancee'])) $GLOBALS['_BAZAR_']['url']->addQueryString ('recherche_avancee', $_REQUEST['recherche_avancee']);
699
	if (isset($_REQUEST['recherche_avancee'])) $GLOBALS['_BAZAR_']['url']->addQueryString ('recherche_avancee', $_REQUEST['recherche_avancee']);
683
	$lien_formulaire = preg_replace ('/&amp;/', '&', $GLOBALS['_BAZAR_']['url']->getURL()) ;
700
	$lien_formulaire = preg_replace ('/&amp;/', '&', $GLOBALS['_BAZAR_']['url']->getURL()) ;
684
	$formtemplate = new HTML_QuickForm('formulaire', 'post', $lien_formulaire) ;
701
	$formtemplate = new HTML_QuickForm('formulaire', 'post', $lien_formulaire) ;
685
	$squelette =& $formtemplate->defaultRenderer();
702
	$squelette =& $formtemplate->defaultRenderer();
686
   	$squelette->setFormTemplate("\n".'<form {attributes}>'."\n".'<table style="border:0;width:100%;">'."\n".'{content}'."\n".'</table>'."\n".'</form>'."\n");
703
   	$squelette->setFormTemplate("\n".'<form {attributes}>'."\n".'<table style="border:0;width:100%;">'."\n".'{content}'."\n".'</table>'."\n".'</form>'."\n");
687
    $squelette->setElementTemplate( '<tr>'."\n".'<td style="font-size:12px;width:120px;text-align:right;">'."\n".'{label}'.
704
    $squelette->setElementTemplate( '<tr>'."\n".'<td style="font-size:12px;width:120px;text-align:right;">'."\n".'{label}'.
688
    		                        '<!-- BEGIN required --><span class="symbole_obligatoire">&nbsp;*</span><!-- END required -->'."\n".
705
    		                        '<!-- BEGIN required --><span class="symbole_obligatoire">&nbsp;*</span><!-- END required -->'."\n".
689
    								' :</td>'."\n".'<td style="text-align:left;padding:5px;"> '."\n".'{element}'."\n".
706
    								' :</td>'."\n".'<td style="text-align:left;padding:5px;"> '."\n".'{element}'."\n".
690
                                    '<!-- BEGIN error --><span class="erreur">{error}</span><!-- END error -->'."\n".
707
                                    '<!-- BEGIN error --><span class="erreur">{error}</span><!-- END error -->'."\n".
691
                                    '</td>'."\n".'</tr>'."\n");
708
                                    '</td>'."\n".'</tr>'."\n");
692
 	$squelette->setElementTemplate( '<tr>'."\n".'<td colspan="2" class="liste_a_cocher"><strong>{label}&nbsp;{element}</strong>'."\n".
709
 	$squelette->setElementTemplate( '<tr>'."\n".'<td colspan="2" class="liste_a_cocher"><strong>{label}&nbsp;{element}</strong>'."\n".
693
                                    '<!-- BEGIN required --><span class="symbole_obligatoire">&nbsp;*</span><!-- END required -->'."\n".'</td>'."\n".'</tr>'."\n", 'accept_condition');
710
                                    '<!-- BEGIN required --><span class="symbole_obligatoire">&nbsp;*</span><!-- END required -->'."\n".'</td>'."\n".'</tr>'."\n", 'accept_condition');
694
  	$squelette->setElementTemplate( '<tr><td colspan="2">{label}{element}</td></tr>'."\n", 'rechercher');
711
  	$squelette->setElementTemplate( '<tr><td colspan="2">{label}{element}</td></tr>'."\n", 'rechercher');
695
  	  	
712
  	  	
696
 	$squelette->setRequiredNoteTemplate("\n".'<tr>'."\n".'<td colspan="2" class="symbole_obligatoire">* {requiredNote}</td></tr>'."\n");
713
 	$squelette->setRequiredNoteTemplate("\n".'<tr>'."\n".'<td colspan="2" class="symbole_obligatoire">* {requiredNote}</td></tr>'."\n");
697
	//Traduction de champs requis
714
	//Traduction de champs requis
698
	$formtemplate->setRequiredNote(BAZ_CHAMPS_REQUIS) ;
715
	$formtemplate->setRequiredNote(BAZ_CHAMPS_REQUIS) ;
699
	$formtemplate->setJsWarnings(BAZ_ERREUR_SAISIE,BAZ_VEUILLEZ_CORRIGER);	
716
	$formtemplate->setJsWarnings(BAZ_ERREUR_SAISIE,BAZ_VEUILLEZ_CORRIGER);	
700
	
717
	
701
		
718
		
702
	//cas du formulaire de recherche proposant de chercher parmis tous les types d'annonces 
719
	//cas du formulaire de recherche proposant de chercher parmis tous les types d'annonces 
703
	//requete pour obtenir l'id et le label des types d'annonces
720
	//requete pour obtenir l'id et le label des types d'annonces
704
	$requete = 'SELECT bn_id_nature, bn_label_nature '.
721
	$requete = 'SELECT bn_id_nature, bn_label_nature '.
705
	           'FROM bazar_nature WHERE bn_ce_id_menu IN ('.$GLOBALS['_BAZAR_']['categorie_nature'].') '.
722
	           'FROM bazar_nature WHERE bn_ce_id_menu IN ('.$GLOBALS['_BAZAR_']['categorie_nature'].') '.
706
			   'ORDER BY bn_label_nature ASC';
723
			   'ORDER BY bn_label_nature ASC';
707
	$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
724
	$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
708
	if (DB::isError($resultat)) {
725
	if (DB::isError($resultat)) {
709
		die ($resultat->getMessage().$resultat->getDebugInfo()) ;
726
		die ($resultat->getMessage().$resultat->getDebugInfo()) ;
710
	}
727
	}
711
	//on récupère le nb de types de fiches, pour plus tard
728
	//on récupère le nb de types de fiches, pour plus tard
712
	$nb_type_de_fiches=$resultat->numRows();
729
	$nb_type_de_fiches=$resultat->numRows();
713
	$type_annonce_select['toutes']=BAZ_TOUS_TYPES_FICHES;
730
	$type_annonce_select['toutes']=BAZ_TOUS_TYPES_FICHES;
714
	while ($ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
731
	while ($ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
715
		$type_annonce_select[$ligne['bn_id_nature']] = $ligne['bn_label_nature'];
732
		$type_annonce_select[$ligne['bn_id_nature']] = $ligne['bn_label_nature'];
716
		$tableau_typeannonces[] = $ligne['bn_id_nature'] ;
733
		$tableau_typeannonces[] = $ligne['bn_id_nature'] ;
717
	}
734
	}
718
	if ($nb_type_de_fiches>1 && $GLOBALS['_BAZAR_']['typeannonce']=='toutes') {
735
	if ($nb_type_de_fiches>1 && $GLOBALS['_BAZAR_']['typeannonce']=='toutes') {
719
		$res= '<h2>'.BAZ_TOUTES_LES_ANNONCES.'</h2><br />'."\n";
736
		$res= '<h2>'.BAZ_TOUTES_LES_ANNONCES.'</h2><br />'."\n";
720
		$option=array('style'=>'border:1px solid #000;width: 200px;font:12px Myriad, Arial, sans-serif;',
737
		$option=array('style'=>'border:1px solid #000;width: 200px;font:12px Myriad, Arial, sans-serif;',
721
						'onchange' => 'javascript:this.form.submit();');
738
						'onchange' => 'javascript:this.form.submit();');
722
		$formtemplate->addElement ('select', 'nature', BAZ_TYPEANNONCE, $type_annonce_select, $option) ;
739
		$formtemplate->addElement ('select', 'nature', BAZ_TYPEANNONCE, $type_annonce_select, $option) ;
723
		if (isset($_REQUEST['nature'])) {
740
		if (isset($_REQUEST['nature'])) {
724
			$defauts=array('nature'=>$_REQUEST['nature']);
741
			$defauts=array('nature'=>$_REQUEST['nature']);
725
			$formtemplate->setDefaults($defauts);
742
			$formtemplate->setDefaults($defauts);
726
		}		
743
		}		
727
	}
744
	}
728
	//cas du type d'annonces prédéfini 
745
	//cas du type d'annonces prédéfini 
729
	else {
746
	else {
730
		if ($nb_type_de_fiches==1) {
747
		if ($nb_type_de_fiches==1) {
731
			$GLOBALS['_BAZAR_']['typeannonce']=end($type_annonce_select);
748
			$GLOBALS['_BAZAR_']['typeannonce']=end($type_annonce_select);
732
			$GLOBALS['_BAZAR_']['id_typeannonce']=key($type_annonce_select);
749
			$GLOBALS['_BAZAR_']['id_typeannonce']=key($type_annonce_select);
733
		}
750
		}
734
		$res = '<h2>'.BAZ_TOUTES_LES_ANNONCES_DE_TYPE.' '.$GLOBALS['_BAZAR_']['typeannonce'].'</h2>'."\n";
751
		$res = '<h2>'.BAZ_TOUTES_LES_ANNONCES_DE_TYPE.' '.$GLOBALS['_BAZAR_']['typeannonce'].'</h2>'."\n";
735
	}
752
	}
736
 
753
 
737
	//requete pour obtenir l'id, le nom et prenom de toutes les personnes ayant depose une fiche
754
	//requete pour obtenir l'id, le nom et prenom de toutes les personnes ayant depose une fiche
738
	// dans le but de construire l'élément de formulaire select avec les noms des émetteurs de fiche	
755
	// dans le but de construire l'élément de formulaire select avec les noms des émetteurs de fiche	
739
	if (BAZ_RECHERCHE_PAR_EMETTEUR) {
756
	if (BAZ_RECHERCHE_PAR_EMETTEUR) {
740
		$requete = 'SELECT '.BAZ_CHAMPS_ID.', '.BAZ_CHAMPS_NOM.', '.BAZ_CHAMPS_PRENOM.' '.
757
		$requete = 'SELECT '.BAZ_CHAMPS_ID.', '.BAZ_CHAMPS_NOM.', '.BAZ_CHAMPS_PRENOM.' '.
741
		           'FROM bazar_fiche,'.BAZ_ANNUAIRE.' WHERE ' ;
758
		           'FROM bazar_fiche,'.BAZ_ANNUAIRE.' WHERE ' ;
742
	
759
	
743
		$requete .= ' bf_date_debut_validite_fiche<=NOW() AND bf_date_fin_validite_fiche>=NOW() and';	
760
		$requete .= ' bf_date_debut_validite_fiche<=NOW() AND bf_date_fin_validite_fiche>=NOW() and';	
744
	
761
	
745
		$requete .= ' bf_ce_utilisateur='.BAZ_CHAMPS_ID.' ';
762
		$requete .= ' bf_ce_utilisateur='.BAZ_CHAMPS_ID.' ';
746
	    if (!isset($_REQUEST['nature'])) {
763
	    if (!isset($_REQUEST['nature'])) {
747
	    		if (isset($GLOBALS['_BAZAR_']['id_typeannonce'])) {
764
	    		if (isset($GLOBALS['_BAZAR_']['id_typeannonce'])) {
748
	    			$requete .= 'AND bf_ce_nature="'.$GLOBALS['_BAZAR_']['id_typeannonce'].'" ';
765
	    			$requete .= 'AND bf_ce_nature="'.$GLOBALS['_BAZAR_']['id_typeannonce'].'" ';
749
	    		} 
766
	    		} 
750
		}
767
		}
751
		else {
768
		else {
752
	    		if ($_REQUEST['nature']!='toutes') {
769
	    		if ($_REQUEST['nature']!='toutes') {
753
	    			$requete .= 'AND bf_ce_nature='.$_REQUEST['nature'].' ';
770
	    			$requete .= 'AND bf_ce_nature='.$_REQUEST['nature'].' ';
754
	    		}
771
	    		}
755
	    }
772
	    }
756
	    
773
	    
757
	    $requete .= 'ORDER BY '.BAZ_CHAMPS_NOM.' ASC';
774
	    $requete .= 'ORDER BY '.BAZ_CHAMPS_NOM.' ASC';
758
		$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
775
		$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
759
		if (DB::isError($resultat)) {
776
		if (DB::isError($resultat)) {
760
			die ($resultat->getMessage().$resultat->getDebugInfo()) ;
777
			die ($resultat->getMessage().$resultat->getDebugInfo()) ;
761
		}
778
		}
762
		$personnes_select['tous']=BAZ_TOUS_LES_EMETTEURS;
779
		$personnes_select['tous']=BAZ_TOUS_LES_EMETTEURS;
763
		while ($ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
780
		while ($ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
764
			$personnes_select[$ligne[BAZ_CHAMPS_ID]] = $ligne[BAZ_CHAMPS_NOM]." ".$ligne[BAZ_CHAMPS_PRENOM] ;
781
			$personnes_select[$ligne[BAZ_CHAMPS_ID]] = $ligne[BAZ_CHAMPS_NOM]." ".$ligne[BAZ_CHAMPS_PRENOM] ;
765
		}
782
		}
766
		$option=array('style'=>'border:1px solid #000;width: 200px;font:12px Myriad, Arial, sans-serif;');
783
		$option=array('style'=>'border:1px solid #000;width: 200px;font:12px Myriad, Arial, sans-serif;');
767
		$formtemplate->addElement ('select', 'personnes', BAZ_EMETTEUR, $personnes_select, $option) ;
784
		$formtemplate->addElement ('select', 'personnes', BAZ_EMETTEUR, $personnes_select, $option) ;
768
	} else {
785
	} else {
769
		$formtemplate->addElement ('hidden', 'personnes', 'tous') ;
786
		$formtemplate->addElement ('hidden', 'personnes', 'tous') ;
770
	}
787
	}
771
	
788
	
772
		//pour les super-administrateurs, on peut voir les annonces non validées
789
		//pour les super-administrateurs, on peut voir les annonces non validées
773
	//on verifie si l'utilisateur est administrateur
790
	//on verifie si l'utilisateur est administrateur
774
	$utilisateur = new Administrateur_bazar($GLOBALS['AUTH']) ;
791
	$utilisateur = new Administrateur_bazar($GLOBALS['AUTH']) ;
775
 
792
 
776
	if ($utilisateur->isSuperAdmin()) {
793
	if ($utilisateur->isSuperAdmin()) {
777
		$option=array('style'=>'border:1px solid #000;width: 200px;font:12px Myriad, Arial, sans-serif;');
794
		$option=array('style'=>'border:1px solid #000;width: 200px;font:12px Myriad, Arial, sans-serif;');
778
		$valide_select[0] = BAZ_FICHES_PAS_VALIDEES;
795
		$valide_select[0] = BAZ_FICHES_PAS_VALIDEES;
779
		$valide_select[1] = BAZ_FICHES_VALIDEES;
796
		$valide_select[1] = BAZ_FICHES_VALIDEES;
780
		$valide_select[2] = BAZ_LES_DEUX;
797
		$valide_select[2] = BAZ_LES_DEUX;
781
		$formtemplate->addElement ('select', 'valides', BAZ_VALIDE, $valide_select, $option) ; 
798
		$formtemplate->addElement ('select', 'valides', BAZ_VALIDE, $valide_select, $option) ; 
782
		$defauts=array('valides'=>1);
799
		$defauts=array('valides'=>1);
783
		$formtemplate->setDefaults($defauts);
800
		$formtemplate->setDefaults($defauts);
784
	}
801
	}
785
	
802
	
786
	//champs texte pour entrer les mots cles
803
	//champs texte pour entrer les mots cles
787
	$option=array('maxlength'=>60,'style'=>'border:1px solid #000;width:200px;font:12px Myriad, Arial, sans-serif;');
804
	$option=array('maxlength'=>60,'style'=>'border:1px solid #000;width:200px;font:12px Myriad, Arial, sans-serif;');
788
	$formtemplate->addElement('text', 'recherche_mots_cles', BAZ_MOT_CLE, $option) ;
805
	$formtemplate->addElement('text', 'recherche_mots_cles', BAZ_MOT_CLE, $option) ;
789
	
806
	
790
	//option cachee pour savoir si le formulaire a ete appele deja 
807
	//option cachee pour savoir si le formulaire a ete appele deja 
791
	$formtemplate->addElement('hidden', 'recherche_effectuee', 1) ;
808
	$formtemplate->addElement('hidden', 'recherche_effectuee', 1) ;
792
	
809
	
793
	// Ajout des options si un type de fiche a ete choisie
810
	// Ajout des options si un type de fiche a ete choisie
794
	if ( (isset($_REQUEST['nature']) && $_REQUEST['nature'] != 'toutes') || (isset($GLOBALS['_BAZAR_']['categorie_nature']) && $nb_type_de_fiches==1)) {
811
	if ( (isset($_REQUEST['nature']) && $_REQUEST['nature'] != 'toutes') || (isset($GLOBALS['_BAZAR_']['categorie_nature']) && $nb_type_de_fiches==1)) {
795
		if ( BAZ_MOTEUR_RECHERCHE_AVANCEE || ( isset($_REQUEST['recherche_avancee'])&&$_REQUEST['recherche_avancee']==1) ) { 
812
		if ( BAZ_MOTEUR_RECHERCHE_AVANCEE || ( isset($_REQUEST['recherche_avancee'])&&$_REQUEST['recherche_avancee']==1) ) { 
796
			if ($GLOBALS['_BAZAR_']['categorie_nature'] != '') {
813
			if ($GLOBALS['_BAZAR_']['categorie_nature'] != '') {
797
				$champs_requete = '' ;
814
				$champs_requete = '' ;
798
				if (!isset($_REQUEST['nature']) || $_REQUEST['nature'] == '') {
815
				if (!isset($_REQUEST['nature']) || $_REQUEST['nature'] == '') {
799
					$_REQUEST['nature'] = $tableau_typeannonces[0];
816
					$_REQUEST['nature'] = $tableau_typeannonces[0];
800
				}
817
				}
801
			}
818
			}
802
			// Récupération du template
819
			// Récupération du template
803
			$requete = 'SELECT bn_template FROM bazar_nature WHERE bn_id_nature = '.$_REQUEST['nature'];
820
			$requete = 'SELECT bn_template FROM bazar_nature WHERE bn_id_nature = '.$_REQUEST['nature'];
804
			$resultat = $GLOBALS['_BAZAR_']['db']->getOne($requete) ;
821
			$resultat = $GLOBALS['_BAZAR_']['db']->getOne($requete) ;
805
			if (DB::isError($resultat)) {
822
			if (DB::isError($resultat)) {
806
				die ($resultat->getMessage().$resultat->getDebugInfo()) ;
823
				die ($resultat->getMessage().$resultat->getDebugInfo()) ;
807
			}
824
			}
808
			
825
			
809
			if (isset($_REQUEST['recherche_avancee']) && $_REQUEST['recherche_avancee']==1) {
826
			if (isset($_REQUEST['recherche_avancee']) && $_REQUEST['recherche_avancee']==1) {
810
				foreach(array_merge($_POST, $_GET) as $cle => $valeur) $GLOBALS['_BAZAR_']['url']->addQueryString($cle, $valeur); 
827
				foreach(array_merge($_POST, $_GET) as $cle => $valeur) $GLOBALS['_BAZAR_']['url']->addQueryString($cle, $valeur); 
811
				$GLOBALS['_BAZAR_']['url']->addQueryString('recherche_avancee', '0');
828
				$GLOBALS['_BAZAR_']['url']->addQueryString('recherche_avancee', '0');
812
				$lien_recherche_de_base = '<a href="'.$GLOBALS['_BAZAR_']['url']->getURL().'">'.BAZ_RECHERCHE_DE_BASE.'</a><br />';
829
				$lien_recherche_de_base = '<a href="'.$GLOBALS['_BAZAR_']['url']->getURL().'">'.BAZ_RECHERCHE_DE_BASE.'</a><br />';
813
				//lien recherche de base
830
				//lien recherche de base
814
				labelhtml($formtemplate,'',$lien_recherche_de_base,'','','','','');		
831
				labelhtml($formtemplate,'',$lien_recherche_de_base,'','','','','');		
815
			}
832
			}
816
			
833
			
817
			$tableau = baz_valeurs_template($resultat) ;
834
			$tableau = baz_valeurs_template($resultat) ;
818
			for ($i=0; $i<count($tableau); $i++) {
835
			for ($i=0; $i<count($tableau); $i++) {
819
				if (($tableau[$i]['type'] == 'liste' || $tableau[$i]['type'] == 'checkbox') && $tableau[$i]['recherche'] == 1) {
836
				if (($tableau[$i]['type'] == 'liste' || $tableau[$i]['type'] == 'checkbox') && $tableau[$i]['recherche'] == 1) {
820
					$tableau[$i]['type']($formtemplate, $tableau[$i]['nom_bdd'], $tableau[$i]['label'], $tableau[$i]['limite1'],
837
					$tableau[$i]['type']($formtemplate, $tableau[$i]['nom_bdd'], $tableau[$i]['label'], $tableau[$i]['limite1'],
821
			                         $tableau[$i]['limite2'], $tableau[$i]['defaut'], $tableau[$i]['table_source'], $tableau[$i]['obligatoire'], 1) ;
838
			                         $tableau[$i]['limite2'], $tableau[$i]['defaut'], $tableau[$i]['table_source'], $tableau[$i]['obligatoire'], 1) ;
822
				}
839
				}
823
			}
840
			}
824
			
841
			
825
		}
842
		}
826
		else {
843
		else {
827
			foreach(array_merge($_POST, $_GET) as $cle => $valeur) $GLOBALS['_BAZAR_']['url']->addQueryString($cle, $valeur); 
844
			foreach(array_merge($_POST, $_GET) as $cle => $valeur) $GLOBALS['_BAZAR_']['url']->addQueryString($cle, $valeur); 
828
			$GLOBALS['_BAZAR_']['url']->addQueryString('recherche_avancee', '1');
845
			$GLOBALS['_BAZAR_']['url']->addQueryString('recherche_avancee', '1');
829
			$lien_recherche_avancee = '<a href="'.$GLOBALS['_BAZAR_']['url']->getURL().'">'.BAZ_RECHERCHE_AVANCEE.'</a><br />';			
846
			$lien_recherche_avancee = '<a href="'.$GLOBALS['_BAZAR_']['url']->getURL().'">'.BAZ_RECHERCHE_AVANCEE.'</a><br />';			
830
		}		 	
847
		}		 	
831
	}
848
	}
832
	
849
	
833
	//lien recherche avancee
850
	//lien recherche avancee
834
	if (isset($lien_recherche_avancee)) {
851
	if (isset($lien_recherche_avancee)) {
835
		labelhtml($formtemplate,'',$lien_recherche_avancee,'','','','','');
852
		labelhtml($formtemplate,'',$lien_recherche_avancee,'','','','','');
836
	}
853
	}
837
	
854
	
838
	//Bouton de validation du formulaire
855
	//Bouton de validation du formulaire
839
	$option=array('style'=>'border:1px solid #000;width:100px;font:12px Myriad, Arial, sans-serif;');	
856
	$option=array('style'=>'border:1px solid #000;width:100px;font:12px Myriad, Arial, sans-serif;');	
840
	$formtemplate->addElement('submit', 'rechercher', BAZ_RECHERCHER, $option);
857
	$formtemplate->addElement('submit', 'rechercher', BAZ_RECHERCHER, $option);
841
	
858
	
842
	//affichage du formulaire
859
	//affichage du formulaire
843
	$res.=$formtemplate->toHTML()."\n";
860
	$res.=$formtemplate->toHTML()."\n";
844
	
861
	
845
 
862
 
846
	// Ajout de la table bazar_fiche_liste_valeur dans le from de la requete
863
	// Ajout de la table bazar_fiche_liste_valeur dans le from de la requete
847
	$case_coche = false ;
864
	$case_coche = false ;
848
	$nb_jointures=0;
865
	$nb_jointures=0;
849
	$requeteFrom = '' ;
866
	$requeteFrom = '' ;
850
	$requeteWhere = ' bn_ce_id_menu IN ('.$GLOBALS['_BAZAR_']['categorie_nature'].') AND bn_id_nature=bf_ce_nature AND ' ;
867
	$requeteWhere = ' bn_ce_id_menu IN ('.$GLOBALS['_BAZAR_']['categorie_nature'].') AND bn_id_nature=bf_ce_nature AND ' ;
851
	$requeteWhereListe = '' ;
868
	$requeteWhereListe = '' ;
852
	
869
	
853
 	if ( isset($tableau) ) {
870
 	if ( isset($tableau) ) {
854
	 	for ($i = 0; $i < count ($tableau); $i++) {
871
	 	for ($i = 0; $i < count ($tableau); $i++) {
855
			if ($tableau[$i]['type'] == 'checkbox' || $tableau[$i]['type'] == 'liste') {
872
			if ($tableau[$i]['type'] == 'checkbox' || $tableau[$i]['type'] == 'liste') {
856
				$nb_jointures++;
873
				$nb_jointures++;
857
				$nom_liste = $tableau[$i]['type'].$tableau[$i]['nom_bdd'] ;			
874
				$nom_liste = $tableau[$i]['type'].$tableau[$i]['nom_bdd'] ;			
858
				if (isset($_REQUEST[$nom_liste]) && is_array($_REQUEST[$nom_liste])) {
875
				if (isset($_REQUEST[$nom_liste]) && is_array($_REQUEST[$nom_liste])) {
859
					$case_coche = true;
876
					$case_coche = true;
860
					$requeteWhereListe .= ' bfvl'.$nb_jointures.'.bfvl_ce_liste='.$tableau[$i]['nom_bdd'].' AND ' ; // Numéro de la liste
877
					$requeteWhereListe .= ' bfvl'.$nb_jointures.'.bfvl_ce_liste='.$tableau[$i]['nom_bdd'].' AND ' ; // Numéro de la liste
861
					$requeteWhereListe .= ' bfvl'.$nb_jointures.'.bfvl_valeur IN (' ;
878
					$requeteWhereListe .= ' bfvl'.$nb_jointures.'.bfvl_valeur IN (' ;
862
					$chaine = '';
879
					$chaine = '';
863
					//var_dump($_REQUEST[$nom_liste]);
880
					//var_dump($_REQUEST[$nom_liste]);
864
					foreach ($_REQUEST[$nom_liste] as $cle =>$valeur) {
881
					foreach ($_REQUEST[$nom_liste] as $cle =>$valeur) {
865
						if ($valeur == 1) {						
882
						if ($valeur == 1) {						
866
							$chaine .= '"'.$cle.'",' ;
883
							$chaine .= '"'.$cle.'",' ;
867
						}
884
						}
868
					}	
885
					}	
869
					$requeteWhereListe .= substr ($chaine, 0, strlen ($chaine)-1) ;
886
					$requeteWhereListe .= substr ($chaine, 0, strlen ($chaine)-1) ;
870
					$requeteWhereListe .= ') AND ';									
887
					$requeteWhereListe .= ') AND ';									
871
				} else {
888
				} else {
872
					if (isset ($_REQUEST[$nom_liste]) && $_REQUEST[$nom_liste]!=0) {
889
					if (isset ($_REQUEST[$nom_liste]) && $_REQUEST[$nom_liste]!=0) {
873
						$requeteWhereListe .= ' bfvl'.$nb_jointures.'.bfvl_ce_liste='.$tableau[$i]['nom_bdd'].' AND ' ; // Numéro de la liste
890
						$requeteWhereListe .= ' bfvl'.$nb_jointures.'.bfvl_ce_liste='.$tableau[$i]['nom_bdd'].' AND ' ; // Numéro de la liste
874
						$requeteWhereListe .= ' bfvl'.$nb_jointures.'.bfvl_valeur='.$_REQUEST[$nom_liste].' AND ';
891
						$requeteWhereListe .= ' bfvl'.$nb_jointures.'.bfvl_valeur='.$_REQUEST[$nom_liste].' AND ';
875
						$case_coche = true;
892
						$case_coche = true;
876
					}
893
					}
877
				}
894
				}
878
			}
895
			}
879
		}
896
		}
880
 	}
897
 	}
881
	if ($case_coche) {
898
	if ($case_coche) {
882
		for ($i = 0; $i < $nb_jointures ; $i++) {			
899
		for ($i = 0; $i < $nb_jointures ; $i++) {			
883
			$requeteFrom .= ', bazar_fiche_valeur_liste  as bfvl'.($i+1) ;
900
			$requeteFrom .= ', bazar_fiche_valeur_liste  as bfvl'.($i+1) ;
884
			$requeteWhere .= ' bfvl'.($i+1).'.bfvl_ce_fiche=bf_id_fiche AND ';
901
			$requeteWhere .= ' bfvl'.($i+1).'.bfvl_ce_fiche=bf_id_fiche AND ';
885
		}
902
		}
886
		 $requeteWhere .= $requeteWhereListe;
903
		 $requeteWhere .= $requeteWhereListe;
887
	}
904
	}
888
	if (isset($_REQUEST['nature']) && $_REQUEST['nature']!='' && $_REQUEST['nature']!='toutes') {
905
	if (isset($_REQUEST['nature']) && $_REQUEST['nature']!='' && $_REQUEST['nature']!='toutes') {
889
		$requeteWhere = 'bf_ce_nature="'.$_REQUEST['nature'].'" AND '.$requeteWhere;
906
		$requeteWhere = 'bf_ce_nature="'.$_REQUEST['nature'].'" AND '.$requeteWhere;
890
	}
907
	}
891
	
908
	
892
	//affichage des resultats de la recherche si le formulaire a ete envoye
909
	//affichage des resultats de la recherche si le formulaire a ete envoye
893
	$requeteSQL='';
910
	$requeteSQL='';
894
	if (isset($_REQUEST['recherche_effectuee'])) {
911
	if (isset($_REQUEST['recherche_effectuee'])) {
895
		//preparation de la requete pour trouver les mots cles
912
		//preparation de la requete pour trouver les mots cles
896
		if (($_REQUEST['recherche_mots_cles']!='')and($_REQUEST['recherche_mots_cles']!=BAZ_MOT_CLE)) {
913
		if (($_REQUEST['recherche_mots_cles']!='')and($_REQUEST['recherche_mots_cles']!=BAZ_MOT_CLE)) {
897
			//decoupage des mots cles
914
			//decoupage des mots cles
898
			$recherche = split(' ', $_REQUEST['recherche_mots_cles']) ;
915
			$recherche = split(' ', $_REQUEST['recherche_mots_cles']) ;
899
			$nbmots=count($recherche);
916
			$nbmots=count($recherche);
900
			$requeteSQL=''; 
917
			$requeteSQL=''; 
901
			for ($i=0; $i<$nbmots; $i++) {
918
			for ($i=0; $i<$nbmots; $i++) {
902
				if ($i>0) $requeteSQL.=' OR ';
919
				if ($i>0) $requeteSQL.=' OR ';
903
				$requeteSQL.='bf_titre LIKE "%'.$recherche[$i].'%" OR bf_description LIKE "%'.$recherche[$i].'%" ';
920
				$requeteSQL.='bf_titre LIKE "%'.$recherche[$i].'%" OR bf_description LIKE "%'.$recherche[$i].'%" ';
904
			}
921
			}
905
		}
922
		}
906
		if (!isset($_REQUEST['nature'])) {
923
		if (!isset($_REQUEST['nature'])) {
907
			if (!isset ($GLOBALS['_BAZAR_']['id_nature'])) $typedefiches = $tableau_typeannonces;
924
			if (!isset ($GLOBALS['_BAZAR_']['id_nature'])) $typedefiches = $tableau_typeannonces;
908
			else $typedefiches = $GLOBALS['_BAZAR_']['id_nature'] ; 
925
			else $typedefiches = $GLOBALS['_BAZAR_']['id_nature'] ; 
909
		} else {
926
		} else {
910
			$typedefiches = $_REQUEST['nature'] ;
927
			$typedefiches = $_REQUEST['nature'] ;
911
			if ($typedefiches == 'toutes') $typedefiches = $tableau_typeannonces ;
928
			if ($typedefiches == 'toutes') $typedefiches = $tableau_typeannonces ;
912
		}
929
		}
913
		if ($typeannonce!='toutes') $typedefiches=$typeannonce;
930
		if ($typeannonce!='toutes') $typedefiches=$typeannonce;
914
		if (isset($_REQUEST['valides'])) {$valides=$_REQUEST['valides'];}
931
		if (isset($_REQUEST['valides'])) {$valides=$_REQUEST['valides'];}
915
		else {$valides=1;}
932
		else {$valides=1;}
916
		//generation de la liste de flux a afficher
933
		//generation de la liste de flux a afficher
917
		if (!isset($_REQUEST['personne'])) $_REQUEST['personne']='tous';
934
		if (!isset($_REQUEST['personne'])) $_REQUEST['personne']='tous';
918
		$res .= baz_liste_pagine_HTML($typedefiches, '', $_REQUEST['personne'], $valides, $requeteSQL, $requeteFrom, $requeteWhere);		
935
		$res .= baz_liste_pagine_HTML($typedefiches, '', $_REQUEST['personne'], $valides, $requeteSQL, $requeteFrom, $requeteWhere);		
919
	}
936
	}
920
	else {
937
	else {
921
		//on affiche toutes les annonces
938
		//on affiche toutes les annonces
922
		$res .= '<br /><p class="zone_info">'."\n".BAZ_ENTRER_VOS_CRITERES_DE_RECHERCHE.'</p>'."\n";
939
		$res .= '<br /><p class="zone_info">'."\n".BAZ_ENTRER_VOS_CRITERES_DE_RECHERCHE.'</p>'."\n";
923
		$GLOBALS['_BAZAR_']['url']->removeQueryString('action');
940
		$GLOBALS['_BAZAR_']['url']->removeQueryString('action');
924
		$GLOBALS['_BAZAR_']['url']->addQueryString('action', BAZ_VOIR_FLUX_RSS);
941
		$GLOBALS['_BAZAR_']['url']->addQueryString('action', BAZ_VOIR_FLUX_RSS);
925
		$GLOBALS['_BAZAR_']['url']->addQueryString('annonce', $typeannonce);
942
		$GLOBALS['_BAZAR_']['url']->addQueryString('annonce', $typeannonce);
926
		$GLOBALS['_BAZAR_']['url']->addQueryString('categorie_nature', $GLOBALS['_BAZAR_']['categorie_nature']);
943
		$GLOBALS['_BAZAR_']['url']->addQueryString('categorie_nature', $GLOBALS['_BAZAR_']['categorie_nature']);
927
		$res .= '{{Syndication titre="'.BAZ_DERNIERES_FICHES.'" url="'.preg_replace ('/&amp;/', '&', $GLOBALS['_BAZAR_']['url']->getURL()).
944
		$res .= '{{Syndication titre="'.BAZ_DERNIERES_FICHES.'" url="'.preg_replace ('/&amp;/', '&', $GLOBALS['_BAZAR_']['url']->getURL()).
928
                '" nb=10 nouvellefenetre=0 formatdate="'.BAZ_TYPE_AFFICHAGE_LISTE.'"}}';
945
                '" nb=10 nouvellefenetre=0 formatdate="'.BAZ_TYPE_AFFICHAGE_LISTE.'"}}';
929
	}
946
	}
930
	return $res;
947
	return $res;
931
}
948
}
932
 
949
 
933
/**
950
/**
934
 * Cette fonction renvoie du HTML
951
 * Cette fonction renvoie du HTML
935
 */
952
 */
936
function baz_liste_pagine_HTML($typeannonce, $nbitem, $emetteur, $valide, $requeteSQL = '', $requeteFrom = '', $requeteWhere = '') {	
953
function baz_liste_pagine_HTML($typeannonce, $nbitem, $emetteur, $valide, $requeteSQL = '', $requeteFrom = '', $requeteWhere = '') {	
937
	// generation de la requete MySQL personnalisee
954
	// generation de la requete MySQL personnalisee
938
	$req_where=0;
955
	$req_where=0;
939
	$requete = 'SELECT DISTINCT bf_id_fiche, bf_titre, bf_ce_utilisateur, bf_date_debut_validite_fiche '.
956
	$requete = 'SELECT DISTINCT bf_id_fiche, bf_titre, bf_ce_utilisateur, bf_date_debut_validite_fiche '.
940
				'FROM bazar_fiche, bazar_nature '.$requeteFrom.' WHERE '.$requeteWhere;
957
				'FROM bazar_fiche, bazar_nature '.$requeteFrom.' WHERE '.$requeteWhere;
941
	if ($valide!=2) {
958
	if ($valide!=2) {
942
		if ($req_where==1) {$requete .= ' AND ';}
959
		if ($req_where==1) {$requete .= ' AND ';}
943
		$req_where=1;
960
		$req_where=1;
944
		$requete .= 'bf_statut_fiche='.$valide;		
961
		$requete .= 'bf_statut_fiche='.$valide;		
945
	} else {
962
	} else {
946
		$requete .= '1 ' ;
963
		$requete .= '1 ' ;
947
	}
964
	}
948
	
965
	
949
	$utilisateur = new Administrateur_bazar ($GLOBALS['AUTH']) ;
966
	$utilisateur = new Administrateur_bazar ($GLOBALS['AUTH']) ;
950
	if ($valide!=0) {
967
	if ($valide!=0) {
951
		if ($utilisateur->isSuperAdmin()) {
968
		if ($utilisateur->isSuperAdmin()) {
952
			$req_where=1;
969
			$req_where=1;
953
		} else {
970
		} else {
954
			if ($req_where==1) {$requete .= ' AND ';}
971
			if ($req_where==1) {$requete .= ' AND ';}
955
			$requete .= '(bf_date_debut_validite_fiche<=NOW() or bf_date_debut_validite_fiche="0000-00-00")'.
972
			$requete .= '(bf_date_debut_validite_fiche<=NOW() or bf_date_debut_validite_fiche="0000-00-00")'.
956
						' AND (bf_date_fin_validite_fiche>=NOW() or bf_date_fin_validite_fiche="0000-00-00") AND bn_id_nature=bf_ce_nature';
973
						' AND (bf_date_fin_validite_fiche>=NOW() or bf_date_fin_validite_fiche="0000-00-00") AND bn_id_nature=bf_ce_nature';
957
			$req_where=1;
974
			$req_where=1;
958
		}
975
		}
959
	}
976
	}
960
	if ($emetteur!='' && $emetteur!='tous') {
977
	if ($emetteur!='' && $emetteur!='tous') {
961
		if ($req_where==1) {$requete .= ' AND ';}
978
		if ($req_where==1) {$requete .= ' AND ';}
962
		$requete .= 'bf_ce_utilisateur='.$emetteur;
979
		$requete .= 'bf_ce_utilisateur='.$emetteur;
963
		$req_where=1;
980
		$req_where=1;
964
		//requete pour afficher le nom de la structure
981
		//requete pour afficher le nom de la structure
965
		$requetenom = 'SELECT '.BAZ_CHAMPS_NOM.', '.BAZ_CHAMPS_PRENOM.' FROM '.
982
		$requetenom = 'SELECT '.BAZ_CHAMPS_NOM.', '.BAZ_CHAMPS_PRENOM.' FROM '.
966
						BAZ_ANNUAIRE.' WHERE '.BAZ_CHAMPS_ID.'='.$emetteur;
983
						BAZ_ANNUAIRE.' WHERE '.BAZ_CHAMPS_ID.'='.$emetteur;
967
		$resultat = $GLOBALS['_BAZAR_']['db']->query($requetenom) ;
984
		$resultat = $GLOBALS['_BAZAR_']['db']->query($requetenom) ;
968
		if (DB::isError($resultat)) {
985
		if (DB::isError($resultat)) {
969
			die ($resultat->getMessage().$resultat->getDebugInfo()) ;
986
			die ($resultat->getMessage().$resultat->getDebugInfo()) ;
970
		}
987
		}
971
		$ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC);
988
		$ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC);
972
		$nomflux .= ' ('.$ligne[BAZ_CHAMPS_NOM].' '.$ligne[BAZ_CHAMPS_PRENOM].')';
989
		$nomflux .= ' ('.$ligne[BAZ_CHAMPS_NOM].' '.$ligne[BAZ_CHAMPS_PRENOM].')';
973
	}
990
	}
974
	if ($requeteSQL!='') {
991
	if ($requeteSQL!='') {
975
		if ($req_where==1) {$requete .= ' AND ';}
992
		if ($req_where==1) {$requete .= ' AND ';}
976
		$requete .= '('.$requeteSQL.')';
993
		$requete .= '('.$requeteSQL.')';
977
		$req_where=1;
994
		$req_where=1;
978
	}
995
	}
979
	$requete .= ' ORDER BY  bf_date_debut_validite_fiche DESC, bf_date_fin_validite_fiche DESC, bf_date_maj_fiche DESC';
996
	$requete .= ' ORDER BY  bf_date_debut_validite_fiche DESC, bf_date_fin_validite_fiche DESC, bf_date_maj_fiche DESC';
980
	if ($nbitem!='') {$requete .= ' LIMIT 0,'.$nbitem;}
997
	if ($nbitem!='') {$requete .= ' LIMIT 0,'.$nbitem;}
981
	
998
	
982
	$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
999
	$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
983
	if (DB::isError($resultat)) {
1000
	if (DB::isError($resultat)) {
984
		die ($resultat->getMessage().$resultat->getDebugInfo()) ;
1001
		die ($resultat->getMessage().$resultat->getDebugInfo()) ;
985
	}
1002
	}
986
	$res = '<br /><h4>'.BAZ_IL_Y_A.($resultat->numRows()).' '.BAZ_FICHES_CORRESPONDANTES.'</h4><br />'."\n";
1003
	$res = '<br /><h4>'.BAZ_IL_Y_A.($resultat->numRows()).' '.BAZ_FICHES_CORRESPONDANTES.'</h4><br />'."\n";
987
	$res .= '<ul>' ;
1004
	$res .= '<ul>' ;
988
	$GLOBALS['_BAZAR_']['url']->addQueryString('action', BAZ_VOIR_FICHE);
1005
	$GLOBALS['_BAZAR_']['url']->addQueryString('action', BAZ_VOIR_FICHE);
989
	
1006
	
990
	$donnees = array();
1007
	$donnees = array();
991
	while ($ligne = $resultat->fetchRow(DB_FETCHMODE_OBJECT)) {
1008
	while ($ligne = $resultat->fetchRow(DB_FETCHMODE_OBJECT)) {
992
		$GLOBALS['_BAZAR_']['url']->addQueryString('id_fiche', $ligne->bf_id_fiche) ;
1009
		$GLOBALS['_BAZAR_']['url']->addQueryString('id_fiche', $ligne->bf_id_fiche) ;
993
		array_push ($donnees, array ($ligne->bf_id_fiche,$ligne->bf_titre,$ligne->bf_ce_utilisateur));		
1010
		array_push ($donnees, array ($ligne->bf_id_fiche,$ligne->bf_titre,$ligne->bf_ce_utilisateur));		
994
	}
1011
	}
995
	// Mise en place du Pager
1012
	// Mise en place du Pager
996
	include_once PAP_CHEMIN_API_PEAR.'Pager/Pager.php';
1013
	include_once PAP_CHEMIN_API_PEAR.'Pager/Pager.php';
997
	$params = array(
1014
	$params = array(
998
    'mode'       => BAZ_MODE_DIVISION,
1015
    'mode'       => BAZ_MODE_DIVISION,
999
    'perPage'    => BAZ_NOMBRE_RES_PAR_PAGE,
1016
    'perPage'    => BAZ_NOMBRE_RES_PAR_PAGE,
1000
    'delta'      => BAZ_DELTA,
1017
    'delta'      => BAZ_DELTA,
1001
    'httpMethod' => 'GET',
1018
    'httpMethod' => 'GET',
1002
    'extraVars' => array_merge($_POST, $_GET),
1019
    'extraVars' => array_merge($_POST, $_GET),
1003
    'altNext' => BAZ_SUIVANT,
1020
    'altNext' => BAZ_SUIVANT,
1004
    'altPrev' => BAZ_PRECEDENT,
1021
    'altPrev' => BAZ_PRECEDENT,
1005
    'nextImg' => BAZ_SUIVANT,
1022
    'nextImg' => BAZ_SUIVANT,
1006
    'prevImg' => BAZ_PRECEDENT,
1023
    'prevImg' => BAZ_PRECEDENT,
1007
    'itemData'   => $donnees
1024
    'itemData'   => $donnees
1008
	);
1025
	);
1009
	$pager = & Pager::factory($params);
1026
	$pager = & Pager::factory($params);
1010
	$data  = $pager->getPageData();
1027
	$data  = $pager->getPageData();
1011
	$links = $pager->getLinks();
1028
	$links = $pager->getLinks();
1012
    $res .= '<div class="bazar_numero">'.$pager->links.'</div>'."\n";
1029
    $res .= '<div class="bazar_numero">'.$pager->links.'</div>'."\n";
1013
	foreach ($data as $valeur) {
1030
	foreach ($data as $valeur) {
1014
		$GLOBALS['_BAZAR_']['url']->addQueryString('id_fiche', $valeur[0]) ;
1031
		$GLOBALS['_BAZAR_']['url']->addQueryString('id_fiche', $valeur[0]) ;
1015
		$GLOBALS['_BAZAR_']['url']->addQueryString('action', BAZ_VOIR_FICHE) ;
1032
		$GLOBALS['_BAZAR_']['url']->addQueryString('action', BAZ_VOIR_FICHE) ;
1016
		$res .= '<li><a href="'.$GLOBALS['_BAZAR_']['url']->getURL().'">'.$valeur[1].'</a>'."\n" ;
1033
		$res .= '<li><a href="'.$GLOBALS['_BAZAR_']['url']->getURL().'">'.$valeur[1].'</a>'."\n" ;
1017
		if ($utilisateur->isSuperAdmin() || $GLOBALS['id_user']==$valeur[2]) {
1034
		if ($utilisateur->isSuperAdmin() || $GLOBALS['id_user']==$valeur[2]) {
1018
			$GLOBALS['_BAZAR_']['url']->addQueryString('action', BAZ_ACTION_MODIFIER);
1035
			$GLOBALS['_BAZAR_']['url']->addQueryString('action', BAZ_ACTION_MODIFIER);
1019
			$GLOBALS['_BAZAR_']['url']->addQueryString('typeannonce', $GLOBALS['_BAZAR_']['id_typeannonce']);
1036
			$GLOBALS['_BAZAR_']['url']->addQueryString('typeannonce', $GLOBALS['_BAZAR_']['id_typeannonce']);
1020
			$GLOBALS['_BAZAR_']['url']->removeQueryString('personnes');
1037
			$GLOBALS['_BAZAR_']['url']->removeQueryString('personnes');
1021
			$GLOBALS['_BAZAR_']['url']->removeQueryString('recherche_effectuee');
1038
			$GLOBALS['_BAZAR_']['url']->removeQueryString('recherche_effectuee');
1022
			$res .= '<a href="'.$GLOBALS['_BAZAR_']['url']->getURL().'">('.BAZ_MODIFIER.')</a>&nbsp;' ;
1039
			$res .= '<a href="'.$GLOBALS['_BAZAR_']['url']->getURL().'">('.BAZ_MODIFIER.')</a>&nbsp;' ;
1023
			$GLOBALS['_BAZAR_']['url']->removeQueryString('action');
1040
			$GLOBALS['_BAZAR_']['url']->removeQueryString('action');
1024
			$GLOBALS['_BAZAR_']['url']->addQueryString('action', BAZ_ACTION_SUPPRESSION);
1041
			$GLOBALS['_BAZAR_']['url']->addQueryString('action', BAZ_ACTION_SUPPRESSION);
1025
			$res .= '<a href="'.$GLOBALS['_BAZAR_']['url']->getURL().'" onclick="javascript:return confirm(\''.BAZ_SUPPRIMER.'\');">('.BAZ_SUPPRIMER.')</a>' ;
1042
			$res .= '<a href="'.$GLOBALS['_BAZAR_']['url']->getURL().'" onclick="javascript:return confirm(\''.BAZ_SUPPRIMER.'\');">('.BAZ_SUPPRIMER.')</a>' ;
1026
			$GLOBALS['_BAZAR_']['url']->removeQueryString('action');
1043
			$GLOBALS['_BAZAR_']['url']->removeQueryString('action');
1027
		}
1044
		}
1028
		$res .= '</li>';
1045
		$res .= '</li>';
1029
	}
1046
	}
1030
	$res .= '</ul>';
1047
	$res .= '</ul>';
1031
	$res .= '<div class="bazar_numero">'.$pager->links.'</div>'."\n";
1048
	$res .= '<div class="bazar_numero">'.$pager->links.'</div>'."\n";
1032
 
1049
 
1033
	return $res ;
1050
	return $res ;
1034
}
1051
}
1035
 
1052
 
1036
/* +--Fin du code ----------------------------------------------------------------------------------------+
1053
/* +--Fin du code ----------------------------------------------------------------------------------------+
1037
*
1054
*
1038
* $Log: not supported by cvs2svn $
1055
* $Log: not supported by cvs2svn $
-
 
1056
* Revision 1.60.2.8  2007/02/27 15:11:00  alexandre_tb
-
 
1057
* correction d une jointure dans la requete pour les flux rss
-
 
1058
* utilisation de la librairie XML_Util de pear pour generer le flux RSS -> plus clair
-
 
1059
*
1039
* Revision 1.60.2.7  2007/02/15 17:39:00  jp_milcent
1060
* Revision 1.60.2.7  2007/02/15 17:39:00  jp_milcent
1040
* Remise dans le code d'un bogue...
1061
* Remise dans le code d'un bogue...
1041
* A corriger!
1062
* A corriger!
1042
*
1063
*
1043
* Revision 1.60.2.6  2007/02/15 13:42:16  jp_milcent
1064
* Revision 1.60.2.6  2007/02/15 13:42:16  jp_milcent
1044
* Utilisation de IN à la place du = dans les requêtes traitant les catégories de fiches.
1065
* Utilisation de IN à la place du = dans les requêtes traitant les catégories de fiches.
1045
* Permet d'utiliser la syntaxe 1,2,3 dans la configuration de categorie_nature.
1066
* Permet d'utiliser la syntaxe 1,2,3 dans la configuration de categorie_nature.
1046
*
1067
*
1047
* Revision 1.60.2.5  2007/02/02 13:46:54  alexandre_tb
1068
* Revision 1.60.2.5  2007/02/02 13:46:54  alexandre_tb
1048
* correction bug sur une date
1069
* correction bug sur une date
1049
*
1070
*
1050
* Revision 1.60.2.4  2007/01/30 15:45:01  alexandre_tb
1071
* Revision 1.60.2.4  2007/01/30 15:45:01  alexandre_tb
1051
* affichage de la date de création e la fiche lorsque la date de début de validité n'est plus bonne
1072
* affichage de la date de création e la fiche lorsque la date de début de validité n'est plus bonne
1052
*
1073
*
1053
* Revision 1.60.2.3  2007/01/29 10:53:46  alexandre_tb
1074
* Revision 1.60.2.3  2007/01/29 10:53:46  alexandre_tb
1054
* Mise en place de la constante BAZ_DERNIERES_FICHES pour remplacer le label en francais dans baz_liste
1075
* Mise en place de la constante BAZ_DERNIERES_FICHES pour remplacer le label en francais dans baz_liste
1055
*
1076
*
1056
* Revision 1.60.2.2  2007/01/17 16:01:27  alexandre_tb
1077
* Revision 1.60.2.2  2007/01/17 16:01:27  alexandre_tb
1057
* les dates ne s'affichent pas si elles sont vides.
1078
* les dates ne s'affichent pas si elles sont vides.
1058
* les champs dates propose 4 années avant l'année actuelle
1079
* les champs dates propose 4 années avant l'année actuelle
1059
*
1080
*
1060
* Revision 1.60.2.1  2007/01/05 14:41:49  alexandre_tb
1081
* Revision 1.60.2.1  2007/01/05 14:41:49  alexandre_tb
1061
* backport ordre d affichage des dernieres news et suppression de la taille des images uploadees
1082
* backport ordre d affichage des dernieres news et suppression de la taille des images uploadees
1062
*
1083
*
1063
* Revision 1.60  2006/10/05 08:53:50  florian
1084
* Revision 1.60  2006/10/05 08:53:50  florian
1064
* amelioration moteur de recherche, correction de bugs
1085
* amelioration moteur de recherche, correction de bugs
1065
*
1086
*
1066
* Revision 1.59  2006/09/21 14:19:39  florian
1087
* Revision 1.59  2006/09/21 14:19:39  florian
1067
* amélioration des fonctions liés au wikini
1088
* amélioration des fonctions liés au wikini
1068
*
1089
*
1069
* Revision 1.58  2006/09/15 12:31:40  alexandre_tb
1090
* Revision 1.58  2006/09/15 12:31:40  alexandre_tb
1070
* correction du nom du flux RSS.
1091
* correction du nom du flux RSS.
1071
*
1092
*
1072
* Revision 1.57  2006/07/25 13:22:27  alexandre_tb
1093
* Revision 1.57  2006/07/25 13:22:27  alexandre_tb
1073
* réorganisation du code, sans grand changement
1094
* réorganisation du code, sans grand changement
1074
*
1095
*
1075
* Revision 1.56  2006/07/18 14:13:35  alexandre_tb
1096
* Revision 1.56  2006/07/18 14:13:35  alexandre_tb
1076
* Ajout d identifiant HTML
1097
* Ajout d identifiant HTML
1077
*
1098
*
1078
* Revision 1.55  2006/07/04 14:29:18  alexandre_tb
1099
* Revision 1.55  2006/07/04 14:29:18  alexandre_tb
1079
* Ajout du bouton supprimer pour les administrateurs
1100
* Ajout du bouton supprimer pour les administrateurs
1080
*
1101
*
1081
* Revision 1.54  2006/07/03 09:51:21  alexandre_tb
1102
* Revision 1.54  2006/07/03 09:51:21  alexandre_tb
1082
* correction du bug recherche sur fiches validés et invalidés.
1103
* correction du bug recherche sur fiches validés et invalidés.
1083
*
1104
*
1084
* Revision 1.53  2006/06/29 10:29:51  florian
1105
* Revision 1.53  2006/06/29 10:29:51  florian
1085
* correction bug moteur de recherche
1106
* correction bug moteur de recherche
1086
*
1107
*
1087
* Revision 1.52  2006/06/02 09:29:07  florian
1108
* Revision 1.52  2006/06/02 09:29:07  florian
1088
* debut d'integration de wikini
1109
* debut d'integration de wikini
1089
*
1110
*
1090
* Revision 1.51  2006/05/23 15:41:27  alexandre_tb
1111
* Revision 1.51  2006/05/23 15:41:27  alexandre_tb
1091
* ajout de la numérotation des pages en haut et en bas ds résultats et ajout d'une div class=bazar_numero pour les entourer
1112
* ajout de la numérotation des pages en haut et en bas ds résultats et ajout d'une div class=bazar_numero pour les entourer
1092
*
1113
*
1093
* Revision 1.50  2006/05/22 09:55:12  alexandre_tb
1114
* Revision 1.50  2006/05/22 09:55:12  alexandre_tb
1094
* ajout de la variable recherche_avancee dans l'action du formulaire
1115
* ajout de la variable recherche_avancee dans l'action du formulaire
1095
*
1116
*
1096
* Revision 1.49  2006/05/19 13:54:11  florian
1117
* Revision 1.49  2006/05/19 13:54:11  florian
1097
* stabilisation du moteur de recherche, corrections bugs, lien recherche avancee
1118
* stabilisation du moteur de recherche, corrections bugs, lien recherche avancee
1098
*
1119
*
1099
* Revision 1.48  2006/05/17 09:50:13  alexandre_tb
1120
* Revision 1.48  2006/05/17 09:50:13  alexandre_tb
1100
* Ajout du moteur de recherche évolué et du découpage par page
1121
* Ajout du moteur de recherche évolué et du découpage par page
1101
*
1122
*
1102
* +-- Fin du code ----------------------------------------------------------------------------------------+
1123
* +-- Fin du code ----------------------------------------------------------------------------------------+
1103
*/
1124
*/
1104
?>
1125
?>