Subversion Repositories Applications.bazar

Rev

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

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