Subversion Repositories Applications.bazar

Rev

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

Rev 195 Rev 205
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.69 2007-03-06 09:39:00 alexandre_tb Exp $
22
// CVS : $Id: bazar.fonct.rss.php,v 1.70 2007-03-08 15:12:13 jp_milcent 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.69 $
31
*@version       $Revision: 1.70 $
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 personalisé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
	
-
 
464
	// Nettoyage de l'url
-
 
465
	$GLOBALS['_BAZAR_']['url']->removeQueryString('action');
-
 
466
	$GLOBALS['_BAZAR_']['url']->removeQueryString('id_fiche');
-
 
467
	$GLOBALS['_BAZAR_']['url']->removeQueryString('id_commentaire');
463
	
468
	$GLOBALS['_BAZAR_']['url']->removeQueryString('typeannonce');
464
	return $res ;
469
	return $res ;
465
}
470
}
466
 
471
 
467
 
472
 
468
/** RSSversHTML () transforme un flux RSS (en XML) en page HTML
473
/** RSSversHTML () transforme un flux RSS (en XML) en page HTML
469
*
474
*
470
*   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,
471
*   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 
472
*
477
*
473
*   @param  string   le contenu du flux RSS
478
*   @param  string   le contenu du flux RSS
474
*   @param  boolean  afficher ou non la description
479
*   @param  boolean  afficher ou non la description
475
*   @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
476
*
481
*
477
*   @return  string    le code HTML
482
*   @return  string    le code HTML
478
*/
483
*/
479
function RSSversHTML($rss, $voirdesc, $formatdate, $affichenb) {
484
function RSSversHTML($rss, $voirdesc, $formatdate, $affichenb) {
480
	if ($rss!='') {
485
	if ($rss!='') {
481
		$rawitems='';$title='';$url='';$cat='';$date='';
486
		$rawitems='';$title='';$url='';$cat='';$date='';
482
		$res='';
487
		$res='';
483
		if( eregi('<item>(.*)</item>', $rss, $rawitems ) ) {
488
		if( eregi('<item>(.*)</item>', $rss, $rawitems ) ) {
484
			$items = explode('<item>', $rawitems[0]);
489
			$items = explode('<item>', $rawitems[0]);
485
			$res.='<ul id="BAZ_liste_fiche">'."\n";
490
			$res.='<ul id="BAZ_liste_fiche">'."\n";
486
			for( $i = 0; $i < count($items)-1; $i++ ) {
491
			for( $i = 0; $i < count($items)-1; $i++ ) {
487
				eregi('<title>(.*)</title>',$items[$i+1], $title );
492
				eregi('<title>(.*)</title>',$items[$i+1], $title );
488
				eregi('<link>(.*)</link>',$items[$i+1], $url );
493
				eregi('<link>(.*)</link>',$items[$i+1], $url );
489
				eregi('<description>(.*)</description>',$items[$i+1], $cat);
494
				eregi('<description>(.*)</description>',$items[$i+1], $cat);
490
				eregi('<pubDate>(.*)</pubDate>',$items[$i+1], $date);
495
				eregi('<pubDate>(.*)</pubDate>',$items[$i+1], $date);
491
				$res.='<li>';
496
				$res.='<li>';
492
				if ($formatdate=='jm') {$res.=strftime('%d.%m',strtotime($date[1])).': ';}
497
				if ($formatdate=='jm') {$res.=strftime('%d.%m',strtotime($date[1])).': ';}
493
				if ($formatdate=='jma') {$res.=strftime('%d.%m.%Y',strtotime($date[1])).': ';}
498
				if ($formatdate=='jma') {$res.=strftime('%d.%m.%Y',strtotime($date[1])).': ';}
494
				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])).': ';}
495
				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])).': ';}
496
				$res.='<a href="'.preg_replace ('/&amp;/', '&', $url[1]).'">'.$title[1].'</a>';
501
				$res.='<a href="'.preg_replace ('/&amp;/', '&', $url[1]).'">'.$title[1].'</a>';
497
				if ($voirdesc) {$res.=$cat[1];}
502
				if ($voirdesc) {$res.=$cat[1];}
498
				// Ajout du bouton supprimer pour les superadministrateur
503
				// Ajout du bouton supprimer pour les superadministrateur
499
				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]!='#')) {
500
					$mon_url = preg_replace ('/&amp;/', '&', $url[1]) ; 
505
					$mon_url = preg_replace ('/&amp;/', '&', $url[1]) ; 
501
					$url_suppr = new Net_URL(preg_replace ('/&amp;/', '&', $mon_url)) ;
506
					$url_suppr = new Net_URL(preg_replace ('/&amp;/', '&', $mon_url)) ;
502
					$url_suppr->addQueryString('action', BAZ_ACTION_SUPPRESSION) ;
507
					$url_suppr->addQueryString('action', BAZ_ACTION_SUPPRESSION) ;
503
		        	$res .= ' ( <a href="'.$url_suppr->getURL().
508
		        	$res .= ' ( <a href="'.$url_suppr->getURL().
504
							'" onclick="javascript:return confirm(\''.BAZ_SUPPRIMER.' ?\');">'.
509
							'" onclick="javascript:return confirm(\''.BAZ_SUPPRIMER.' ?\');">'.
505
							BAZ_SUPPRIMER.'</a> )'."\n" ;
510
							BAZ_SUPPRIMER.'</a> )'."\n" ;
506
					}
511
					}
507
				$res.='</li>'."\n";
512
				$res.='</li>'."\n";
508
			}
513
			}
509
			$res.='</ul>'."\n";
514
			$res.='</ul>'."\n";
510
			if ($affichenb==1) {
515
			if ($affichenb==1) {
511
				//une annonce trouvee, on accorde au singulier
516
				//une annonce trouvee, on accorde au singulier
512
				if (((count($items)-1)==1)and($title!=BAZ_PAS_D_ANNONCES)) {
517
				if (((count($items)-1)==1)and($title!=BAZ_PAS_D_ANNONCES)) {
513
					$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;
514
				}
519
				}
515
				//plusieures annonces trouvees, on accorde au pluriel
520
				//plusieures annonces trouvees, on accorde au pluriel
516
				else {
521
				else {
517
					$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;
518
				}
523
				}
519
			}
524
			}
520
			//cas des fiches pas trouvées
525
			//cas des fiches pas trouvées
521
			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)) {
522
				$res = '<br /><h4>'.BAZ_PAS_D_ANNONCES.'</h4><br />'."\n";
527
				$res = '<br /><h4>'.BAZ_PAS_D_ANNONCES.'</h4><br />'."\n";
523
			}  
528
			}  
524
		}
529
		}
525
	}
530
	}
526
	else $res = BAZ_PAS_D_ANNONCES;
531
	else $res = BAZ_PAS_D_ANNONCES;
-
 
532
	
-
 
533
	// Nettoyage de l'url
-
 
534
	$GLOBALS['_BAZAR_']['url']->removeQueryString('action');
527
	
535
	
528
	return $res;
536
	return $res;
529
}
537
}
530
 
538
 
531
/** 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 
532
*
540
*
533
* @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)
534
* @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)
535
* @param   integer L'identifiant de l'emetteur (laisser vide pour tous)
543
* @param   integer L'identifiant de l'emetteur (laisser vide pour tous)
536
* @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)
537
* @param   string La requete SQL personnalisee
545
* @param   string La requete SQL personnalisee
538
* @param   integer La categorie des fiches bazar
546
* @param   integer La categorie des fiches bazar
539
*
547
*
540
* @return  string Le code du flux RSS
548
* @return  string Le code du flux RSS
541
*/
549
*/
542
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='') {
543
	// generation de la requete MySQL personnalisee
551
	// generation de la requete MySQL personnalisee
544
	$req_where=0;
552
	$req_where=0;
545
	$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 '.
546
				'FROM bazar_fiche, bazar_nature '.$requeteSQLFrom.' WHERE '.$requeteWhereListe;
554
				'FROM bazar_fiche, bazar_nature '.$requeteSQLFrom.' WHERE '.$requeteWhereListe;
547
	if ($valide!=2) {
555
	if ($valide!=2) {
548
		$requete .= 'bf_statut_fiche='.$valide;
556
		$requete .= 'bf_statut_fiche='.$valide;
549
		$req_where=1;
557
		$req_where=1;
550
	}
558
	}
551
	$nomflux=BAZ_DERNIERE_ACTU;
559
	$nomflux=BAZ_DERNIERE_ACTU;
552
	if (!is_array ($typeannonce) && $typeannonce!='' and $typeannonce!='toutes') {
560
	if (!is_array ($typeannonce) && $typeannonce!='' and $typeannonce!='toutes') {
553
		if ($req_where==1) {$requete .= ' AND ';}
561
		if ($req_where==1) {$requete .= ' AND ';}
554
		$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 ';;
555
		$req_where=1;
563
		$req_where=1;
556
		//le nom du flux devient le type d'annonce
564
		//le nom du flux devient le type d'annonce
557
		$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;
558
		$nomflux = $GLOBALS['_BAZAR_']['db']->getOne($requete_nom_flux) ;
566
		$nomflux = $GLOBALS['_BAZAR_']['db']->getOne($requete_nom_flux) ;
559
	}
567
	}
560
	// Cas où il y plusieurs type d annonce demande
568
	// Cas où il y plusieurs type d annonce demande
561
	if (is_array ($typeannonce)) {
569
	if (is_array ($typeannonce)) {
562
		if ($req_where==1) {$requete .= ' AND ';}
570
		if ($req_where==1) {$requete .= ' AND ';}
563
		$requete .= 'bf_ce_nature IN (' ;
571
		$requete .= 'bf_ce_nature IN (' ;
564
		$chaine = '';
572
		$chaine = '';
565
		foreach ($typeannonce as $valeur) $chaine .= '"'.$valeur.'",' ;
573
		foreach ($typeannonce as $valeur) $chaine .= '"'.$valeur.'",' ;
566
		$requete .= substr ($chaine, 0, strlen ($chaine)-1) ; 
574
		$requete .= substr ($chaine, 0, strlen ($chaine)-1) ; 
567
		$requete .= ') and bf_ce_nature=bn_id_nature ';
575
		$requete .= ') and bf_ce_nature=bn_id_nature ';
568
	}
576
	}
569
	$utilisateur = new Administrateur_bazar ($GLOBALS['AUTH']) ;
577
	$utilisateur = new Administrateur_bazar ($GLOBALS['AUTH']) ;
570
	if ($valide!=0) {
578
	if ($valide!=0) {
571
		
579
		
572
		if ($utilisateur->isSuperAdmin()) {
580
		if ($utilisateur->isSuperAdmin()) {
573
			$req_where=1;
581
			$req_where=1;
574
		} else {
582
		} else {
575
			if ($req_where==1) {
583
			if ($req_where==1) {
576
				$requete .= ' AND ';
584
				$requete .= ' AND ';
577
			}
585
			}
578
			$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")'.
579
						' 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';
580
		}
588
		}
581
	}
589
	}
582
	else $nomflux .= BAZ_A_MODERER;
590
	else $nomflux .= BAZ_A_MODERER;
583
	if ($emetteur!='' && $emetteur!='tous') {
591
	if ($emetteur!='' && $emetteur!='tous') {
584
		if ($req_where==1) {$requete .= ' AND ';}
592
		if ($req_where==1) {$requete .= ' AND ';}
585
		$requete .= 'bf_ce_utilisateur='.$emetteur;
593
		$requete .= 'bf_ce_utilisateur='.$emetteur;
586
		$req_where=1;
594
		$req_where=1;
587
		//requete pour afficher le nom de la structure
595
		//requete pour afficher le nom de la structure
588
		$requetenom = 'SELECT '.BAZ_CHAMPS_NOM.', '.BAZ_CHAMPS_PRENOM.' FROM '.
596
		$requetenom = 'SELECT '.BAZ_CHAMPS_NOM.', '.BAZ_CHAMPS_PRENOM.' FROM '.
589
						BAZ_ANNUAIRE.' WHERE '.BAZ_CHAMPS_ID.'='.$emetteur;
597
						BAZ_ANNUAIRE.' WHERE '.BAZ_CHAMPS_ID.'='.$emetteur;
590
		$resultat = $GLOBALS['_BAZAR_']['db']->query($requetenom) ;
598
		$resultat = $GLOBALS['_BAZAR_']['db']->query($requetenom) ;
591
		if (DB::isError($resultat)) {
599
		if (DB::isError($resultat)) {
592
			die ($resultat->getMessage().$resultat->getDebugInfo()) ;
600
			die ($resultat->getMessage().$resultat->getDebugInfo()) ;
593
		}
601
		}
594
		$ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC);
602
		$ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC);
595
		$nomflux .= ' ('.$ligne[BAZ_CHAMPS_NOM].' '.$ligne[BAZ_CHAMPS_PRENOM].')';
603
		$nomflux .= ' ('.$ligne[BAZ_CHAMPS_NOM].' '.$ligne[BAZ_CHAMPS_PRENOM].')';
596
	}
604
	}
597
	if ($requeteSQL!='') {
605
	if ($requeteSQL!='') {
598
		if ($req_where==1) {$requete .= ' AND ';}
606
		if ($req_where==1) {$requete .= ' AND ';}
599
		$requete .= '('.$requeteSQL.')';
607
		$requete .= '('.$requeteSQL.')';
600
		$req_where=1;
608
		$req_where=1;
601
	}
609
	}
602
	if ($categorie_nature!='') {
610
	if ($categorie_nature!='') {
603
		if ($req_where==1) {$requete .= ' AND ';}
611
		if ($req_where==1) {$requete .= ' AND ';}
604
		$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 ';
605
		$req_where=1;
613
		$req_where=1;
606
	}
614
	}
607
	
615
	
608
	$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';
609
	if ($nbitem!='') {$requete .= ' LIMIT 0,'.$nbitem;}
617
	if ($nbitem!='') {$requete .= ' LIMIT 0,'.$nbitem;}
610
	$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
618
	$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
611
	if (DB::isError($resultat)) {
619
	if (DB::isError($resultat)) {
612
		die ($resultat->getMessage().$resultat->getDebugInfo()) ;
620
		die ($resultat->getMessage().$resultat->getDebugInfo()) ;
613
	}
621
	}
614
	
622
	
615
	function xmlEntities($s){
623
	function xmlEntities($s){
616
		//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
617
		$table1 = get_html_translation_table(HTML_ENTITIES, ENT_QUOTES);
625
		$table1 = get_html_translation_table(HTML_ENTITIES, ENT_QUOTES);
618
		
626
		
619
		//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)
620
		foreach ($table1 as $k=>$v){
628
		foreach ($table1 as $k=>$v){
621
		  $table1[$k] = "/$v/";
629
		  $table1[$k] = "/$v/";
622
		  $c = htmlentities($k,ENT_QUOTES,"UTF-8");
630
		  $c = htmlentities($k,ENT_QUOTES,"UTF-8");
623
		  $table2[$c] = "&#".ord($k).";";
631
		  $table2[$c] = "&#".ord($k).";";
624
		}
632
		}
625
		
633
		
626
		//now perform a replacement using preg_replace
634
		//now perform a replacement using preg_replace
627
		//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
628
		$s = preg_replace($table1,$table2,$s);
636
		$s = preg_replace($table1,$table2,$s);
629
		return $s;
637
		return $s;
630
	}
638
	}
631
	
639
	
632
	include_once 'XML/Util.php' ;
640
	include_once 'XML/Util.php' ;
633
 
641
 
634
	$xml = XML_Util::getXMLDeclaration('1.0', 'ISO-8859-1', 'no') ; 
642
	$xml = XML_Util::getXMLDeclaration('1.0', 'ISO-8859-1', 'no') ; 
635
	$xml .= XML_Util::createStartElement ('rss', array('version' => '2.0')) ;
643
	$xml .= XML_Util::createStartElement ('rss', array('version' => '2.0')) ;
636
	$xml .= XML_Util::createStartElement ('channel');
644
	$xml .= XML_Util::createStartElement ('channel');
637
	$xml .= XML_Util::createTag ('title', null, $nomflux, null, false);
645
	$xml .= XML_Util::createTag ('title', null, $nomflux, null, false);
638
	$xml .= XML_Util::createTag ('link', null, BAZ_RSS_ADRESSESITE);
646
	$xml .= XML_Util::createTag ('link', null, BAZ_RSS_ADRESSESITE);
639
	$xml .= XML_Util::createTag ('description', null, BAZ_RSS_DESCRIPTIONSITE);
647
	$xml .= XML_Util::createTag ('description', null, BAZ_RSS_DESCRIPTIONSITE);
640
	$xml .= XML_Util::createTag ('language', null, 'fr-FR');
648
	$xml .= XML_Util::createTag ('language', null, 'fr-FR');
641
	$xml .= XML_Util::createTag ('copyright', null, 'Copyright 2005 '.BAZ_RSS_NOMSITE);
649
	$xml .= XML_Util::createTag ('copyright', null, 'Copyright 2005 '.BAZ_RSS_NOMSITE);
642
	$xml .= XML_Util::createTag ('lastBuildDate', null, strftime('%d %b %Y %H:%M:%S GMT'));
650
	$xml .= XML_Util::createTag ('lastBuildDate', null, strftime('%d %b %Y %H:%M:%S GMT'));
643
	$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/');
644
	$xml .= XML_Util::createTag ('category', null, BAZ_RSS_CATEGORIE);
652
	$xml .= XML_Util::createTag ('category', null, BAZ_RSS_CATEGORIE);
645
	$xml .= XML_Util::createTag ('managingEditor', null, BAZ_RSS_MANAGINGEDITOR);
653
	$xml .= XML_Util::createTag ('managingEditor', null, BAZ_RSS_MANAGINGEDITOR);
646
	$xml .= XML_Util::createTag ('webMaster', null, BAZ_RSS_WEBMASTER);
654
	$xml .= XML_Util::createTag ('webMaster', null, BAZ_RSS_WEBMASTER);
647
	$xml .= XML_Util::createTag ('ttl', null, '60');
655
	$xml .= XML_Util::createTag ('ttl', null, '60');
648
	$xml .= XML_Util::createStartElement ('image');
656
	$xml .= XML_Util::createStartElement ('image');
649
		$xml .= XML_Util::createTag ('title', null, BAZ_RSS_NOMSITE);
657
		$xml .= XML_Util::createTag ('title', null, BAZ_RSS_NOMSITE);
650
		$xml .= XML_Util::createTag ('url', null, BAZ_RSS_LOGOSITE);
658
		$xml .= XML_Util::createTag ('url', null, BAZ_RSS_LOGOSITE);
651
		$xml .= XML_Util::createTag ('link', null, BAZ_RSS_ADRESSESITE);
659
		$xml .= XML_Util::createTag ('link', null, BAZ_RSS_ADRESSESITE);
652
	$xml .= XML_Util::createEndElement ('image');
660
	$xml .= XML_Util::createEndElement ('image');
653
	if ($resultat->numRows()>0) {
661
	if ($resultat->numRows()>0) {
654
		// Creation des items : titre + lien + description + date de publication
662
		// Creation des items : titre + lien + description + date de publication
655
		while ($ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
663
		while ($ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
656
			$xml .= XML_Util::createStartElement ('item');
664
			$xml .= XML_Util::createStartElement ('item');
657
			$caractere = array('/\x92/', '/\x85/', '/\x80/', '/\x97/', '/\x96/');
665
			$caractere = array('/\x92/', '/\x85/', '/\x80/', '/\x97/', '/\x96/');
658
			$caractere_remplacement = array ('&#8217;', '&#8230;', '&#8364;', '&#8212;', '&#8211;');
666
			$caractere_remplacement = array ('&#8217;', '&#8230;', '&#8364;', '&#8212;', '&#8211;');
659
			$xml .= XML_Util::createTag ('title', null, preg_replace ($caractere, $caractere_remplacement,
667
			$xml .= XML_Util::createTag ('title', null, preg_replace ($caractere, $caractere_remplacement,
660
													XML_Util::replaceEntities($ligne['bf_titre'])));
668
													XML_Util::replaceEntities($ligne['bf_titre'])));
661
			$lien=$GLOBALS['_BAZAR_']['url'];
669
			$lien=$GLOBALS['_BAZAR_']['url'];
662
			$lien->addQueryString('action', BAZ_VOIR_FICHE);
670
			$lien->addQueryString('action', BAZ_VOIR_FICHE);
663
			$lien->addQueryString('id_fiche', $ligne['bf_id_fiche']);
671
			$lien->addQueryString('id_fiche', $ligne['bf_id_fiche']);
664
			$xml .= XML_Util::createTag ('link', null, $lien->getURL());
672
			$xml .= XML_Util::createTag ('link', null, $lien->getURL());
665
			$xml .= XML_Util::createTag ('guid', null, $lien->getURL());
673
			$xml .= XML_Util::createTag ('guid', null, $lien->getURL());
666
			$xml .= XML_Util::createStartElement ('description');
674
			$xml .= XML_Util::createStartElement ('description');
667
			if ($_GET['action'] != BAZ_VOIR_TOUTES_ANNONCES) {
675
			if ($_GET['action'] != BAZ_VOIR_TOUTES_ANNONCES) {
668
				$xml .= XML_Util::createCDataSection (preg_replace ($caractere, $caractere_remplacement, $ligne['bf_description']));
676
				$xml .= XML_Util::createCDataSection (preg_replace ($caractere, $caractere_remplacement, $ligne['bf_description']));
669
			}
677
			}
670
			$xml .= XML_Util::createEndElement ('description');
678
			$xml .= XML_Util::createEndElement ('description');
671
			if ($ligne['bf_date_debut_validite_fiche'] == '0000-00-00') $date_pub = $ligne[' bf_date_creation_fiche'] ; else 
679
			if ($ligne['bf_date_debut_validite_fiche'] == '0000-00-00') $date_pub = $ligne[' bf_date_creation_fiche'] ; else 
672
					$date_pub =  $ligne['bf_date_debut_validite_fiche'];
680
					$date_pub =  $ligne['bf_date_debut_validite_fiche'];
673
			$xml .= XML_Util::createTag ('pubDate', null, strftime('%d %b %Y %H:%M:%S GMT',strtotime($date_pub)));
681
			$xml .= XML_Util::createTag ('pubDate', null, strftime('%d %b %Y %H:%M:%S GMT',strtotime($date_pub)));
674
			$xml .= XML_Util::createEndElement ('item');
682
			$xml .= XML_Util::createEndElement ('item');
675
		}
683
		}
676
	}
684
	}
677
	else {//pas d'annonces
685
	else {//pas d'annonces
678
		$xml .= XML_Util::createStartElement ('item');
686
		$xml .= XML_Util::createStartElement ('item');
679
		$xml .= XML_Util::createTag ('title', null, BAZ_PAS_D_ANNONCES);
687
		$xml .= XML_Util::createTag ('title', null, BAZ_PAS_D_ANNONCES);
680
		$xml .= XML_Util::createTag ('link', null, '#');
688
		$xml .= XML_Util::createTag ('link', null, '#');
681
		$xml .= XML_Util::createTag ('description', null, BAZ_PAS_D_ANNONCES);
689
		$xml .= XML_Util::createTag ('description', null, BAZ_PAS_D_ANNONCES);
682
		$xml .= XML_Util::createTag ('pubDate', null, strftime('%d %b %Y %H:%M:%S GMT',strtotime('12/12/2004')));
690
		$xml .= XML_Util::createTag ('pubDate', null, strftime('%d %b %Y %H:%M:%S GMT',strtotime('12/12/2004')));
683
		$xml .= XML_Util::createEndElement ('item');
691
		$xml .= XML_Util::createEndElement ('item');
684
 
692
 
685
	}
693
	}
686
	$xml .= XML_Util::createEndElement ('channel');
694
	$xml .= XML_Util::createEndElement ('channel');
687
	$xml .= XML_Util::createEndElement('rss') ;
695
	$xml .= XML_Util::createEndElement('rss') ;
-
 
696
	$xml .= XML_Util::createEndElement ('channel');
-
 
697
	$xml .= XML_Util::createEndElement('rss') ;
-
 
698
 
-
 
699
	// Nettoyage de l'url
-
 
700
	$GLOBALS['_BAZAR_']['url']->removeQueryString('action');
-
 
701
	$GLOBALS['_BAZAR_']['url']->removeQueryString('id_fiche');
-
 
702
	
688
	return $xml;
703
	return $xml;
689
}
704
}
690
 
705
 
691
 
706
 
692
/** baz_liste() Formate la liste de toutes les annonces actuelles
707
/** baz_liste() Formate la liste de toutes les annonces actuelles
693
*
708
*
694
*   @return  string    le code HTML a afficher
709
*   @return  string    le code HTML a afficher
695
*/
710
*/
696
function baz_liste($typeannonce='toutes') {
711
function baz_liste($typeannonce='toutes') {
697
	//creation du lien pour le formulaire de recherche
712
	//creation du lien pour le formulaire de recherche
698
	$GLOBALS['_BAZAR_']['url']->addQueryString('action', BAZ_VOIR_TOUTES_ANNONCES);
713
	$GLOBALS['_BAZAR_']['url']->addQueryString('action', BAZ_VOIR_TOUTES_ANNONCES);
699
	if (isset($_REQUEST['recherche_avancee'])) $GLOBALS['_BAZAR_']['url']->addQueryString ('recherche_avancee', $_REQUEST['recherche_avancee']);
714
	if (isset($_REQUEST['recherche_avancee'])) $GLOBALS['_BAZAR_']['url']->addQueryString ('recherche_avancee', $_REQUEST['recherche_avancee']);
700
	$lien_formulaire = preg_replace ('/&amp;/', '&', $GLOBALS['_BAZAR_']['url']->getURL()) ;
715
	$lien_formulaire = preg_replace ('/&amp;/', '&', $GLOBALS['_BAZAR_']['url']->getURL()) ;
701
	$formtemplate = new HTML_QuickForm('formulaire', 'post', $lien_formulaire) ;
716
	$formtemplate = new HTML_QuickForm('formulaire', 'post', $lien_formulaire) ;
702
	$squelette =& $formtemplate->defaultRenderer();
717
	$squelette =& $formtemplate->defaultRenderer();
703
   	$squelette->setFormTemplate("\n".'<form {attributes}>'."\n".'<table style="border:0;width:100%;">'."\n".'{content}'."\n".'</table>'."\n".'</form>'."\n");
718
   	$squelette->setFormTemplate("\n".'<form {attributes}>'."\n".'<table style="border:0;width:100%;">'."\n".'{content}'."\n".'</table>'."\n".'</form>'."\n");
704
    $squelette->setElementTemplate( '<tr>'."\n".'<td style="font-size:12px;width:120px;text-align:right;">'."\n".'{label}'.
719
    $squelette->setElementTemplate( '<tr>'."\n".'<td style="font-size:12px;width:120px;text-align:right;">'."\n".'{label}'.
705
    		                        '<!-- BEGIN required --><span class="symbole_obligatoire">&nbsp;*</span><!-- END required -->'."\n".
720
    		                        '<!-- BEGIN required --><span class="symbole_obligatoire">&nbsp;*</span><!-- END required -->'."\n".
706
    								' :</td>'."\n".'<td style="text-align:left;padding:5px;"> '."\n".'{element}'."\n".
721
    								' :</td>'."\n".'<td style="text-align:left;padding:5px;"> '."\n".'{element}'."\n".
707
                                    '<!-- BEGIN error --><span class="erreur">{error}</span><!-- END error -->'."\n".
722
                                    '<!-- BEGIN error --><span class="erreur">{error}</span><!-- END error -->'."\n".
708
                                    '</td>'."\n".'</tr>'."\n");
723
                                    '</td>'."\n".'</tr>'."\n");
709
 	$squelette->setElementTemplate( '<tr>'."\n".'<td colspan="2" class="liste_a_cocher"><strong>{label}&nbsp;{element}</strong>'."\n".
724
 	$squelette->setElementTemplate( '<tr>'."\n".'<td colspan="2" class="liste_a_cocher"><strong>{label}&nbsp;{element}</strong>'."\n".
710
                                    '<!-- BEGIN required --><span class="symbole_obligatoire">&nbsp;*</span><!-- END required -->'."\n".'</td>'."\n".'</tr>'."\n", 'accept_condition');
725
                                    '<!-- BEGIN required --><span class="symbole_obligatoire">&nbsp;*</span><!-- END required -->'."\n".'</td>'."\n".'</tr>'."\n", 'accept_condition');
711
  	$squelette->setElementTemplate( '<tr><td colspan="2">{label}{element}</td></tr>'."\n", 'rechercher');
726
  	$squelette->setElementTemplate( '<tr><td colspan="2">{label}{element}</td></tr>'."\n", 'rechercher');
712
  	  	
727
  	  	
713
 	$squelette->setRequiredNoteTemplate("\n".'<tr>'."\n".'<td colspan="2" class="symbole_obligatoire">* {requiredNote}</td></tr>'."\n");
728
 	$squelette->setRequiredNoteTemplate("\n".'<tr>'."\n".'<td colspan="2" class="symbole_obligatoire">* {requiredNote}</td></tr>'."\n");
714
	//Traduction de champs requis
729
	//Traduction de champs requis
715
	$formtemplate->setRequiredNote(BAZ_CHAMPS_REQUIS) ;
730
	$formtemplate->setRequiredNote(BAZ_CHAMPS_REQUIS) ;
716
	$formtemplate->setJsWarnings(BAZ_ERREUR_SAISIE,BAZ_VEUILLEZ_CORRIGER);	
731
	$formtemplate->setJsWarnings(BAZ_ERREUR_SAISIE,BAZ_VEUILLEZ_CORRIGER);	
717
	
732
	
718
		
733
		
719
	//cas du formulaire de recherche proposant de chercher parmis tous les types d'annonces 
734
	//cas du formulaire de recherche proposant de chercher parmis tous les types d'annonces 
720
	//requete pour obtenir l'id et le label des types d'annonces
735
	//requete pour obtenir l'id et le label des types d'annonces
721
	$requete = 'SELECT bn_id_nature, bn_label_nature '.
736
	$requete = 'SELECT bn_id_nature, bn_label_nature '.
722
	           'FROM bazar_nature WHERE bn_ce_id_menu IN ('.$GLOBALS['_BAZAR_']['categorie_nature'].') '.
737
	           'FROM bazar_nature WHERE bn_ce_id_menu IN ('.$GLOBALS['_BAZAR_']['categorie_nature'].') '.
723
			   'ORDER BY bn_label_nature ASC';
738
			   'ORDER BY bn_label_nature ASC';
724
	$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
739
	$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
725
	if (DB::isError($resultat)) {
740
	if (DB::isError($resultat)) {
726
		die ($resultat->getMessage().$resultat->getDebugInfo()) ;
741
		die ($resultat->getMessage().$resultat->getDebugInfo()) ;
727
	}
742
	}
728
	//on récupère le nb de types de fiches, pour plus tard
743
	//on récupère le nb de types de fiches, pour plus tard
729
	$nb_type_de_fiches=$resultat->numRows();
744
	$nb_type_de_fiches=$resultat->numRows();
730
	$type_annonce_select['toutes']=BAZ_TOUS_TYPES_FICHES;
745
	$type_annonce_select['toutes']=BAZ_TOUS_TYPES_FICHES;
731
	while ($ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
746
	while ($ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
732
		$type_annonce_select[$ligne['bn_id_nature']] = $ligne['bn_label_nature'];
747
		$type_annonce_select[$ligne['bn_id_nature']] = $ligne['bn_label_nature'];
733
		$tableau_typeannonces[] = $ligne['bn_id_nature'] ;
748
		$tableau_typeannonces[] = $ligne['bn_id_nature'] ;
734
	}
749
	}
735
	if ($nb_type_de_fiches>1 && $GLOBALS['_BAZAR_']['typeannonce']=='toutes') {
750
	if ($nb_type_de_fiches>1 && $GLOBALS['_BAZAR_']['typeannonce']=='toutes') {
736
		$res= '<h2>'.BAZ_TOUTES_LES_ANNONCES.'</h2><br />'."\n";
751
		$res= '<h2>'.BAZ_TOUTES_LES_ANNONCES.'</h2><br />'."\n";
737
		$option=array('style'=>'border:1px solid #000;width: 200px;font:12px Myriad, Arial, sans-serif;',
752
		$option=array('style'=>'border:1px solid #000;width: 200px;font:12px Myriad, Arial, sans-serif;',
738
						'onchange' => 'javascript:this.form.submit();');
753
						'onchange' => 'javascript:this.form.submit();');
739
		$formtemplate->addElement ('select', 'nature', BAZ_TYPEANNONCE, $type_annonce_select, $option) ;
754
		$formtemplate->addElement ('select', 'nature', BAZ_TYPEANNONCE, $type_annonce_select, $option) ;
740
		if (isset($_REQUEST['nature'])) {
755
		if (isset($_REQUEST['nature'])) {
741
			$defauts=array('nature'=>$_REQUEST['nature']);
756
			$defauts=array('nature'=>$_REQUEST['nature']);
742
			$formtemplate->setDefaults($defauts);
757
			$formtemplate->setDefaults($defauts);
743
		}		
758
		}		
744
	}
759
	}
745
	//cas du type d'annonces prédéfini 
760
	//cas du type d'annonces prédéfini 
746
	else {
761
	else {
747
		if ($nb_type_de_fiches==1) {
762
		if ($nb_type_de_fiches==1) {
748
			$GLOBALS['_BAZAR_']['typeannonce']=end($type_annonce_select);
763
			$GLOBALS['_BAZAR_']['typeannonce']=end($type_annonce_select);
749
			$GLOBALS['_BAZAR_']['id_typeannonce']=key($type_annonce_select);
764
			$GLOBALS['_BAZAR_']['id_typeannonce']=key($type_annonce_select);
750
		}
765
		}
751
		$res = '<h2>'.BAZ_TOUTES_LES_ANNONCES_DE_TYPE.' '.$GLOBALS['_BAZAR_']['typeannonce'].'</h2>'."\n";
766
		$res = '<h2>'.BAZ_TOUTES_LES_ANNONCES_DE_TYPE.' '.$GLOBALS['_BAZAR_']['typeannonce'].'</h2>'."\n";
752
	}
767
	}
753
 
768
 
754
	//requete pour obtenir l'id, le nom et prenom de toutes les personnes ayant depose une fiche
769
	//requete pour obtenir l'id, le nom et prenom de toutes les personnes ayant depose une fiche
755
	// dans le but de construire l'élément de formulaire select avec les noms des émetteurs de fiche	
770
	// dans le but de construire l'élément de formulaire select avec les noms des émetteurs de fiche	
756
	if (BAZ_RECHERCHE_PAR_EMETTEUR) {
771
	if (BAZ_RECHERCHE_PAR_EMETTEUR) {
757
		$requete = 'SELECT '.BAZ_CHAMPS_ID.', '.BAZ_CHAMPS_NOM.', '.BAZ_CHAMPS_PRENOM.' '.
772
		$requete = 'SELECT '.BAZ_CHAMPS_ID.', '.BAZ_CHAMPS_NOM.', '.BAZ_CHAMPS_PRENOM.' '.
758
		           'FROM bazar_fiche,'.BAZ_ANNUAIRE.' WHERE ' ;
773
		           'FROM bazar_fiche,'.BAZ_ANNUAIRE.' WHERE ' ;
759
	
774
	
760
		$requete .= ' bf_date_debut_validite_fiche<=NOW() AND bf_date_fin_validite_fiche>=NOW() and';	
775
		$requete .= ' bf_date_debut_validite_fiche<=NOW() AND bf_date_fin_validite_fiche>=NOW() and';	
761
	
776
	
762
		$requete .= ' bf_ce_utilisateur='.BAZ_CHAMPS_ID.' ';
777
		$requete .= ' bf_ce_utilisateur='.BAZ_CHAMPS_ID.' ';
763
	    if (!isset($_REQUEST['nature'])) {
778
	    if (!isset($_REQUEST['nature'])) {
764
	    		if (isset($GLOBALS['_BAZAR_']['id_typeannonce'])) {
779
	    		if (isset($GLOBALS['_BAZAR_']['id_typeannonce'])) {
765
	    			$requete .= 'AND bf_ce_nature="'.$GLOBALS['_BAZAR_']['id_typeannonce'].'" ';
780
	    			$requete .= 'AND bf_ce_nature="'.$GLOBALS['_BAZAR_']['id_typeannonce'].'" ';
766
	    		} 
781
	    		} 
767
		}
782
		}
768
		else {
783
		else {
769
	    		if ($_REQUEST['nature']!='toutes') {
784
	    		if ($_REQUEST['nature']!='toutes') {
770
	    			$requete .= 'AND bf_ce_nature='.$_REQUEST['nature'].' ';
785
	    			$requete .= 'AND bf_ce_nature='.$_REQUEST['nature'].' ';
771
	    		}
786
	    		}
772
	    }
787
	    }
773
	    
788
	    
774
	    $requete .= 'ORDER BY '.BAZ_CHAMPS_NOM.' ASC';
789
	    $requete .= 'ORDER BY '.BAZ_CHAMPS_NOM.' ASC';
775
		$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
790
		$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
776
		if (DB::isError($resultat)) {
791
		if (DB::isError($resultat)) {
777
			die ($resultat->getMessage().$resultat->getDebugInfo()) ;
792
			die ($resultat->getMessage().$resultat->getDebugInfo()) ;
778
		}
793
		}
779
		$personnes_select['tous']=BAZ_TOUS_LES_EMETTEURS;
794
		$personnes_select['tous']=BAZ_TOUS_LES_EMETTEURS;
780
		while ($ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
795
		while ($ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
781
			$personnes_select[$ligne[BAZ_CHAMPS_ID]] = $ligne[BAZ_CHAMPS_NOM]." ".$ligne[BAZ_CHAMPS_PRENOM] ;
796
			$personnes_select[$ligne[BAZ_CHAMPS_ID]] = $ligne[BAZ_CHAMPS_NOM]." ".$ligne[BAZ_CHAMPS_PRENOM] ;
782
		}
797
		}
783
		$option=array('style'=>'border:1px solid #000;width: 200px;font:12px Myriad, Arial, sans-serif;');
798
		$option=array('style'=>'border:1px solid #000;width: 200px;font:12px Myriad, Arial, sans-serif;');
784
		$formtemplate->addElement ('select', 'personnes', BAZ_EMETTEUR, $personnes_select, $option) ;
799
		$formtemplate->addElement ('select', 'personnes', BAZ_EMETTEUR, $personnes_select, $option) ;
785
	} else {
800
	} else {
786
		$formtemplate->addElement ('hidden', 'personnes', 'tous') ;
801
		$formtemplate->addElement ('hidden', 'personnes', 'tous') ;
787
	}
802
	}
788
	
803
	
789
		//pour les super-administrateurs, on peut voir les annonces non validées
804
		//pour les super-administrateurs, on peut voir les annonces non validées
790
	//on verifie si l'utilisateur est administrateur
805
	//on verifie si l'utilisateur est administrateur
791
	$utilisateur = new Administrateur_bazar($GLOBALS['AUTH']) ;
806
	$utilisateur = new Administrateur_bazar($GLOBALS['AUTH']) ;
792
 
807
 
793
	if ($utilisateur->isSuperAdmin()) {
808
	if ($utilisateur->isSuperAdmin()) {
794
		$option=array('style'=>'border:1px solid #000;width: 200px;font:12px Myriad, Arial, sans-serif;');
809
		$option=array('style'=>'border:1px solid #000;width: 200px;font:12px Myriad, Arial, sans-serif;');
795
		$valide_select[0] = BAZ_FICHES_PAS_VALIDEES;
810
		$valide_select[0] = BAZ_FICHES_PAS_VALIDEES;
796
		$valide_select[1] = BAZ_FICHES_VALIDEES;
811
		$valide_select[1] = BAZ_FICHES_VALIDEES;
797
		$valide_select[2] = BAZ_LES_DEUX;
812
		$valide_select[2] = BAZ_LES_DEUX;
798
		$formtemplate->addElement ('select', 'valides', BAZ_VALIDE, $valide_select, $option) ; 
813
		$formtemplate->addElement ('select', 'valides', BAZ_VALIDE, $valide_select, $option) ; 
799
		$defauts=array('valides'=>1);
814
		$defauts=array('valides'=>1);
800
		$formtemplate->setDefaults($defauts);
815
		$formtemplate->setDefaults($defauts);
801
	}
816
	}
802
	
817
	
803
	//champs texte pour entrer les mots cles
818
	//champs texte pour entrer les mots cles
804
	$option=array('maxlength'=>60,'style'=>'border:1px solid #000;width:200px;font:12px Myriad, Arial, sans-serif;');
819
	$option=array('maxlength'=>60,'style'=>'border:1px solid #000;width:200px;font:12px Myriad, Arial, sans-serif;');
805
	$formtemplate->addElement('text', 'recherche_mots_cles', BAZ_MOT_CLE, $option) ;
820
	$formtemplate->addElement('text', 'recherche_mots_cles', BAZ_MOT_CLE, $option) ;
806
	
821
	
807
	//option cachee pour savoir si le formulaire a ete appele deja 
822
	//option cachee pour savoir si le formulaire a ete appele deja 
808
	$formtemplate->addElement('hidden', 'recherche_effectuee', 1) ;
823
	$formtemplate->addElement('hidden', 'recherche_effectuee', 1) ;
809
	
824
	
810
	// Ajout des options si un type de fiche a ete choisie
825
	// Ajout des options si un type de fiche a ete choisie
811
	if ( (isset($_REQUEST['nature']) && $_REQUEST['nature'] != 'toutes') || (isset($GLOBALS['_BAZAR_']['categorie_nature']) && $nb_type_de_fiches==1)) {
826
	if ( (isset($_REQUEST['nature']) && $_REQUEST['nature'] != 'toutes') || (isset($GLOBALS['_BAZAR_']['categorie_nature']) && $nb_type_de_fiches==1)) {
812
		if ( BAZ_MOTEUR_RECHERCHE_AVANCEE || ( isset($_REQUEST['recherche_avancee'])&&$_REQUEST['recherche_avancee']==1) ) { 
827
		if ( BAZ_MOTEUR_RECHERCHE_AVANCEE || ( isset($_REQUEST['recherche_avancee'])&&$_REQUEST['recherche_avancee']==1) ) { 
813
			if ($GLOBALS['_BAZAR_']['categorie_nature'] != '') {
828
			if ($GLOBALS['_BAZAR_']['categorie_nature'] != '') {
814
				$champs_requete = '' ;
829
				$champs_requete = '' ;
815
				if (!isset($_REQUEST['nature']) || $_REQUEST['nature'] == '') {
830
				if (!isset($_REQUEST['nature']) || $_REQUEST['nature'] == '') {
816
					$_REQUEST['nature'] = $tableau_typeannonces[0];
831
					$_REQUEST['nature'] = $tableau_typeannonces[0];
817
				}
832
				}
818
			}
833
			}
819
			// Récupération du template
834
			// Récupération du template
820
			$requete = 'SELECT bn_template FROM bazar_nature WHERE bn_id_nature = '.$_REQUEST['nature'];
835
			$requete = 'SELECT bn_template FROM bazar_nature WHERE bn_id_nature = '.$_REQUEST['nature'];
821
			$resultat = $GLOBALS['_BAZAR_']['db']->getOne($requete) ;
836
			$resultat = $GLOBALS['_BAZAR_']['db']->getOne($requete) ;
822
			if (DB::isError($resultat)) {
837
			if (DB::isError($resultat)) {
823
				die ($resultat->getMessage().$resultat->getDebugInfo()) ;
838
				die ($resultat->getMessage().$resultat->getDebugInfo()) ;
824
			}
839
			}
825
			
840
			
826
			if (isset($_REQUEST['recherche_avancee']) && $_REQUEST['recherche_avancee']==1) {
841
			if (isset($_REQUEST['recherche_avancee']) && $_REQUEST['recherche_avancee']==1) {
827
				foreach(array_merge($_POST, $_GET) as $cle => $valeur) $GLOBALS['_BAZAR_']['url']->addQueryString($cle, $valeur); 
842
				foreach(array_merge($_POST, $_GET) as $cle => $valeur) $GLOBALS['_BAZAR_']['url']->addQueryString($cle, $valeur); 
828
				$GLOBALS['_BAZAR_']['url']->addQueryString('recherche_avancee', '0');
843
				$GLOBALS['_BAZAR_']['url']->addQueryString('recherche_avancee', '0');
829
				$lien_recherche_de_base = '<a href="'.$GLOBALS['_BAZAR_']['url']->getURL().'">'.BAZ_RECHERCHE_DE_BASE.'</a><br />';
844
				$lien_recherche_de_base = '<a href="'.$GLOBALS['_BAZAR_']['url']->getURL().'">'.BAZ_RECHERCHE_DE_BASE.'</a><br />';
830
				//lien recherche de base
845
				//lien recherche de base
831
				labelhtml($formtemplate,'',$lien_recherche_de_base,'','','','','');		
846
				labelhtml($formtemplate,'',$lien_recherche_de_base,'','','','','');		
832
			}
847
			}
833
			
848
			
834
			$tableau = baz_valeurs_template($resultat) ;
849
			$tableau = baz_valeurs_template($resultat) ;
835
			for ($i=0; $i<count($tableau); $i++) {
850
			for ($i=0; $i<count($tableau); $i++) {
836
				if (($tableau[$i]['type'] == 'liste' || $tableau[$i]['type'] == 'checkbox') && $tableau[$i]['recherche'] == 1) {
851
				if (($tableau[$i]['type'] == 'liste' || $tableau[$i]['type'] == 'checkbox') && $tableau[$i]['recherche'] == 1) {
837
					$tableau[$i]['type']($formtemplate, $tableau[$i]['nom_bdd'], $tableau[$i]['label'], $tableau[$i]['limite1'],
852
					$tableau[$i]['type']($formtemplate, $tableau[$i]['nom_bdd'], $tableau[$i]['label'], $tableau[$i]['limite1'],
838
			                         $tableau[$i]['limite2'], $tableau[$i]['defaut'], $tableau[$i]['table_source'], $tableau[$i]['obligatoire'], 1) ;
853
			                         $tableau[$i]['limite2'], $tableau[$i]['defaut'], $tableau[$i]['table_source'], $tableau[$i]['obligatoire'], 1) ;
839
				}
854
				}
840
			}
855
			}
841
			
856
			
842
		}
857
		}
843
		else {
858
		else {
844
			foreach(array_merge($_POST, $_GET) as $cle => $valeur) $GLOBALS['_BAZAR_']['url']->addQueryString($cle, $valeur); 
859
			foreach(array_merge($_POST, $_GET) as $cle => $valeur) $GLOBALS['_BAZAR_']['url']->addQueryString($cle, $valeur); 
845
			$GLOBALS['_BAZAR_']['url']->addQueryString('recherche_avancee', '1');
860
			$GLOBALS['_BAZAR_']['url']->addQueryString('recherche_avancee', '1');
846
			$lien_recherche_avancee = '<a href="'.$GLOBALS['_BAZAR_']['url']->getURL().'">'.BAZ_RECHERCHE_AVANCEE.'</a><br />';			
861
			$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);
847
		}		 	
863
		}		 	
848
	}
864
	}
849
	
865
	
850
	//lien recherche avancee
866
	//lien recherche avancee
851
	if (isset($lien_recherche_avancee)) {
867
	if (isset($lien_recherche_avancee)) {
852
		labelhtml($formtemplate,'',$lien_recherche_avancee,'','','','','');
868
		labelhtml($formtemplate,'',$lien_recherche_avancee,'','','','','');
853
	}
869
	}
854
	
870
	
855
	//Bouton de validation du formulaire
871
	//Bouton de validation du formulaire
856
	$option=array('style'=>'border:1px solid #000;width:100px;font:12px Myriad, Arial, sans-serif;');	
872
	$option=array('style'=>'border:1px solid #000;width:100px;font:12px Myriad, Arial, sans-serif;');	
857
	$formtemplate->addElement('submit', 'rechercher', BAZ_RECHERCHER, $option);
873
	$formtemplate->addElement('submit', 'rechercher', BAZ_RECHERCHER, $option);
858
	
874
	
859
	//affichage du formulaire
875
	//affichage du formulaire
860
	//$res.=$formtemplate->toHTML()."\n";
876
	//$res.=$formtemplate->toHTML()."\n";
861
	
877
	
862
 
878
 
863
	// Ajout de la table bazar_fiche_liste_valeur dans le from de la requete
879
	// Ajout de la table bazar_fiche_liste_valeur dans le from de la requete
864
	$case_coche = false ;
880
	$case_coche = false ;
865
	$nb_jointures=0;
881
	$nb_jointures=0;
866
	$requeteFrom = '' ;
882
	$requeteFrom = '' ;
867
	$requeteWhere = ' bn_ce_id_menu IN ('.$GLOBALS['_BAZAR_']['categorie_nature'].') AND bn_id_nature=bf_ce_nature AND ' ;
883
	$requeteWhere = ' bn_ce_id_menu IN ('.$GLOBALS['_BAZAR_']['categorie_nature'].') AND bn_id_nature=bf_ce_nature AND ' ;
868
	$requeteWhereListe = '' ;
884
	$requeteWhereListe = '' ;
869
	
885
	
870
 	if ( isset($tableau) ) {
886
 	if ( isset($tableau) ) {
871
	 	for ($i = 0; $i < count ($tableau); $i++) {
887
	 	for ($i = 0; $i < count ($tableau); $i++) {
872
			if ($tableau[$i]['type'] == 'checkbox' || $tableau[$i]['type'] == 'liste') {
888
			if ($tableau[$i]['type'] == 'checkbox' || $tableau[$i]['type'] == 'liste') {
873
				$nb_jointures++;
889
				$nb_jointures++;
874
				$nom_liste = $tableau[$i]['type'].$tableau[$i]['nom_bdd'] ;			
890
				$nom_liste = $tableau[$i]['type'].$tableau[$i]['nom_bdd'] ;			
875
				if (isset($_REQUEST[$nom_liste]) && is_array($_REQUEST[$nom_liste])) {
891
				if (isset($_REQUEST[$nom_liste]) && is_array($_REQUEST[$nom_liste])) {
876
					$case_coche = true;
892
					$case_coche = true;
877
					$requeteWhereListe .= ' bfvl'.$nb_jointures.'.bfvl_ce_liste='.$tableau[$i]['nom_bdd'].' AND ' ; // Numéro de la liste
893
					$requeteWhereListe .= ' bfvl'.$nb_jointures.'.bfvl_ce_liste='.$tableau[$i]['nom_bdd'].' AND ' ; // Numéro de la liste
878
					$requeteWhereListe .= ' bfvl'.$nb_jointures.'.bfvl_valeur IN (' ;
894
					$requeteWhereListe .= ' bfvl'.$nb_jointures.'.bfvl_valeur IN (' ;
879
					$chaine = '';
895
					$chaine = '';
880
					//var_dump($_REQUEST[$nom_liste]);
896
					//var_dump($_REQUEST[$nom_liste]);
881
					foreach ($_REQUEST[$nom_liste] as $cle =>$valeur) {
897
					foreach ($_REQUEST[$nom_liste] as $cle =>$valeur) {
882
						if ($valeur == 1) {						
898
						if ($valeur == 1) {						
883
							$chaine .= '"'.$cle.'",' ;
899
							$chaine .= '"'.$cle.'",' ;
884
						}
900
						}
885
					}	
901
					}	
886
					$requeteWhereListe .= substr ($chaine, 0, strlen ($chaine)-1) ;
902
					$requeteWhereListe .= substr ($chaine, 0, strlen ($chaine)-1) ;
887
					$requeteWhereListe .= ') AND ';									
903
					$requeteWhereListe .= ') AND ';									
888
				} else {
904
				} else {
889
					if (isset ($_REQUEST[$nom_liste]) && $_REQUEST[$nom_liste]!=0) {
905
					if (isset ($_REQUEST[$nom_liste]) && $_REQUEST[$nom_liste]!=0) {
890
						$requeteWhereListe .= ' bfvl'.$nb_jointures.'.bfvl_ce_liste='.$tableau[$i]['nom_bdd'].' AND ' ; // Numéro de la liste
906
						$requeteWhereListe .= ' bfvl'.$nb_jointures.'.bfvl_ce_liste='.$tableau[$i]['nom_bdd'].' AND ' ; // Numéro de la liste
891
						$requeteWhereListe .= ' bfvl'.$nb_jointures.'.bfvl_valeur='.$_REQUEST[$nom_liste].' AND ';
907
						$requeteWhereListe .= ' bfvl'.$nb_jointures.'.bfvl_valeur='.$_REQUEST[$nom_liste].' AND ';
892
						$case_coche = true;
908
						$case_coche = true;
893
					}
909
					}
894
				}
910
				}
895
			}
911
			}
896
		}
912
		}
897
 	}
913
 	}
898
	if ($case_coche) {
914
	if ($case_coche) {
899
		for ($i = 0; $i < $nb_jointures ; $i++) {			
915
		for ($i = 0; $i < $nb_jointures ; $i++) {			
900
			$requeteFrom .= ', bazar_fiche_valeur_liste  as bfvl'.($i+1) ;
916
			$requeteFrom .= ', bazar_fiche_valeur_liste  as bfvl'.($i+1) ;
901
			$requeteWhere .= ' bfvl'.($i+1).'.bfvl_ce_fiche=bf_id_fiche AND ';
917
			$requeteWhere .= ' bfvl'.($i+1).'.bfvl_ce_fiche=bf_id_fiche AND ';
902
		}
918
		}
903
		 $requeteWhere .= $requeteWhereListe;
919
		 $requeteWhere .= $requeteWhereListe;
904
	}
920
	}
905
	if (isset($_REQUEST['nature']) && $_REQUEST['nature']!='' && $_REQUEST['nature']!='toutes') {
921
	if (isset($_REQUEST['nature']) && $_REQUEST['nature']!='' && $_REQUEST['nature']!='toutes') {
906
		$requeteWhere = 'bf_ce_nature="'.$_REQUEST['nature'].'" AND '.$requeteWhere;
922
		$requeteWhere = 'bf_ce_nature="'.$_REQUEST['nature'].'" AND '.$requeteWhere;
907
	}
923
	}
908
	
924
	
909
		// Appel du template n 1
925
		// Appel du template n 1
910
	include_once BAZ_CHEMIN_APPLI.'bibliotheque/bazarTemplate.class.php' ;
926
	include_once BAZ_CHEMIN_APPLI.'bibliotheque/bazarTemplate.class.php' ;
911
	
927
	
912
	$template = new bazarTemplate ($GLOBALS['_BAZAR_']['db']) ;
928
	$template = new bazarTemplate ($GLOBALS['_BAZAR_']['db']) ;
913
	$chaine = $template->getTemplate(1, $GLOBALS['_BAZAR_']['langue'], $GLOBALS['_BAZAR_']['categorie_nature']);
929
	$chaine = $template->getTemplate(1, $GLOBALS['_BAZAR_']['langue'], $GLOBALS['_BAZAR_']['categorie_nature']);
914
	if (bazarTemplate::isError ($chaine)) return $chaine->getMessage() ;
930
	if (bazarTemplate::isError ($chaine)) return $chaine->getMessage() ;
915
	ob_start();
931
	ob_start();
916
	eval ($chaine) ;
932
	eval ($chaine) ;
917
	$res .= ob_get_contents();
933
	$res .= ob_get_contents();
918
	ob_end_clean() ;
934
	ob_end_clean() ;
919
	
935
	
920
 
936
 
921
	
937
	
922
	//affichage des resultats de la recherche si le formulaire a ete envoye
938
	//affichage des resultats de la recherche si le formulaire a ete envoye
923
	$requeteSQL='';
939
	$requeteSQL='';
924
	if (isset($_REQUEST['recherche_effectuee'])) {
940
	if (isset($_REQUEST['recherche_effectuee'])) {
925
		//preparation de la requete pour trouver les mots cles
941
		//preparation de la requete pour trouver les mots cles
926
		if (($_REQUEST['recherche_mots_cles']!='')and($_REQUEST['recherche_mots_cles']!=BAZ_MOT_CLE)) {
942
		if (($_REQUEST['recherche_mots_cles']!='')and($_REQUEST['recherche_mots_cles']!=BAZ_MOT_CLE)) {
927
			//decoupage des mots cles
943
			//decoupage des mots cles
928
			$recherche = split(' ', $_REQUEST['recherche_mots_cles']) ;
944
			$recherche = split(' ', $_REQUEST['recherche_mots_cles']) ;
929
			$nbmots=count($recherche);
945
			$nbmots=count($recherche);
930
			$requeteSQL=''; 
946
			$requeteSQL=''; 
931
			for ($i=0; $i<$nbmots; $i++) {
947
			for ($i=0; $i<$nbmots; $i++) {
932
				if ($i>0) $requeteSQL.=' OR ';
948
				if ($i>0) $requeteSQL.=' OR ';
933
				$requeteSQL.='bf_titre LIKE "%'.$recherche[$i].'%" OR bf_description LIKE "%'.$recherche[$i].'%" ';
949
				$requeteSQL.='bf_titre LIKE "%'.$recherche[$i].'%" OR bf_description LIKE "%'.$recherche[$i].'%" ';
934
			}
950
			}
935
		}
951
		}
936
		if (!isset($_REQUEST['nature'])) {
952
		if (!isset($_REQUEST['nature'])) {
937
			if (!isset ($GLOBALS['_BAZAR_']['id_nature'])) $typedefiches = $tableau_typeannonces;
953
			if (!isset ($GLOBALS['_BAZAR_']['id_nature'])) $typedefiches = $tableau_typeannonces;
938
			else $typedefiches = $GLOBALS['_BAZAR_']['id_nature'] ; 
954
			else $typedefiches = $GLOBALS['_BAZAR_']['id_nature'] ; 
939
		} else {
955
		} else {
940
			$typedefiches = $_REQUEST['nature'] ;
956
			$typedefiches = $_REQUEST['nature'] ;
941
			if ($typedefiches == 'toutes') $typedefiches = $tableau_typeannonces ;
957
			if ($typedefiches == 'toutes') $typedefiches = $tableau_typeannonces ;
942
		}
958
		}
943
		if ($typeannonce!='toutes') $typedefiches=$typeannonce;
959
		if ($typeannonce!='toutes') $typedefiches=$typeannonce;
944
		if (isset($_REQUEST['valides'])) {$valides=$_REQUEST['valides'];}
960
		if (isset($_REQUEST['valides'])) {$valides=$_REQUEST['valides'];}
945
		else {$valides=1;}
961
		else {$valides=1;}
946
		//generation de la liste de flux a afficher
962
		//generation de la liste de flux a afficher
947
		if (!isset($_REQUEST['personne'])) $_REQUEST['personne']='tous';
963
		if (!isset($_REQUEST['personne'])) $_REQUEST['personne']='tous';
948
		$res .= baz_liste_pagine_HTML($typedefiches, '', $_REQUEST['personne'], $valides, $requeteSQL, $requeteFrom, $requeteWhere);		
964
		$res .= baz_liste_pagine_HTML($typedefiches, '', $_REQUEST['personne'], $valides, $requeteSQL, $requeteFrom, $requeteWhere);		
949
	}
965
	}
950
 
966
	
951
	return $res;	
967
	// Nettoyage de l'url
-
 
968
	$GLOBALS['_BAZAR_']['url']->removeQueryString('action');
-
 
969
	$GLOBALS['_BAZAR_']['url']->removeQueryString('annonce');
-
 
970
	$GLOBALS['_BAZAR_']['url']->removeQueryString('categorie_nature');
-
 
971
	$GLOBALS['_BAZAR_']['url']->removeQueryString('recherche_avancee');
952
 
972
	
-
 
973
	return $res;
953
}
974
}
954
 
975
 
955
/**
976
/**
956
 * Cette fonction renvoie du HTML
977
 * Cette fonction renvoie du HTML
957
 */
978
 */
958
function baz_liste_pagine_HTML($typeannonce, $nbitem, $emetteur, $valide, $requeteSQL = '', $requeteFrom = '', $requeteWhere = '') {	
979
function baz_liste_pagine_HTML($typeannonce, $nbitem, $emetteur, $valide, $requeteSQL = '', $requeteFrom = '', $requeteWhere = '') {	
959
	// generation de la requete MySQL personnalisee
980
	// generation de la requete MySQL personnalisee
960
	$req_where=0;
981
	$req_where=0;
961
	$requete = 'SELECT * '.
982
	$requete = 'SELECT * '.
962
				'FROM bazar_fiche, bazar_nature '.$requeteFrom.' WHERE '.$requeteWhere;
983
				'FROM bazar_fiche, bazar_nature '.$requeteFrom.' WHERE '.$requeteWhere;
963
	if ($valide!=2) {
984
	if ($valide!=2) {
964
		if ($req_where==1) {$requete .= ' AND ';}
985
		if ($req_where==1) {$requete .= ' AND ';}
965
		$req_where=1;
986
		$req_where=1;
966
		$requete .= 'bf_statut_fiche='.$valide;		
987
		$requete .= 'bf_statut_fiche='.$valide;		
967
	} else {
988
	} else {
968
		$requete .= '1 ' ;
989
		$requete .= '1 ' ;
969
	}
990
	}
970
	
991
	
971
	$utilisateur = new Administrateur_bazar ($GLOBALS['AUTH']) ;
992
	$utilisateur = new Administrateur_bazar ($GLOBALS['AUTH']) ;
972
	if ($valide!=0) {
993
	if ($valide!=0) {
973
		if ($utilisateur->isSuperAdmin()) {
994
		if ($utilisateur->isSuperAdmin()) {
974
			$req_where=1;
995
			$req_where=1;
975
		} else {
996
		} else {
976
			if ($req_where==1) {$requete .= ' AND ';}
997
			if ($req_where==1) {$requete .= ' AND ';}
977
			$requete .= '(bf_date_debut_validite_fiche<=NOW() or bf_date_debut_validite_fiche="0000-00-00")'.
998
			$requete .= '(bf_date_debut_validite_fiche<=NOW() or bf_date_debut_validite_fiche="0000-00-00")'.
978
						' AND (bf_date_fin_validite_fiche>=NOW() or bf_date_fin_validite_fiche="0000-00-00") AND bn_id_nature=bf_ce_nature';
999
						' AND (bf_date_fin_validite_fiche>=NOW() or bf_date_fin_validite_fiche="0000-00-00") AND bn_id_nature=bf_ce_nature';
979
			$req_where=1;
1000
			$req_where=1;
980
		}
1001
		}
981
	}
1002
	}
982
	if ($emetteur!='' && $emetteur!='tous') {
1003
	if ($emetteur!='' && $emetteur!='tous') {
983
		if ($req_where==1) {$requete .= ' AND ';}
1004
		if ($req_where==1) {$requete .= ' AND ';}
984
		$requete .= 'bf_ce_utilisateur='.$emetteur;
1005
		$requete .= 'bf_ce_utilisateur='.$emetteur;
985
		$req_where=1;
1006
		$req_where=1;
986
		//requete pour afficher le nom de la structure
1007
		//requete pour afficher le nom de la structure
987
		$requetenom = 'SELECT '.BAZ_CHAMPS_NOM.', '.BAZ_CHAMPS_PRENOM.' FROM '.
1008
		$requetenom = 'SELECT '.BAZ_CHAMPS_NOM.', '.BAZ_CHAMPS_PRENOM.' FROM '.
988
						BAZ_ANNUAIRE.' WHERE '.BAZ_CHAMPS_ID.'='.$emetteur;
1009
						BAZ_ANNUAIRE.' WHERE '.BAZ_CHAMPS_ID.'='.$emetteur;
989
		$resultat = $GLOBALS['_BAZAR_']['db']->query($requetenom) ;
1010
		$resultat = $GLOBALS['_BAZAR_']['db']->query($requetenom) ;
990
		if (DB::isError($resultat)) {
1011
		if (DB::isError($resultat)) {
991
			die ($resultat->getMessage().$resultat->getDebugInfo()) ;
1012
			die ($resultat->getMessage().$resultat->getDebugInfo()) ;
992
		}
1013
		}
993
		$ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC);
1014
		$ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC);
994
		$nomflux .= ' ('.$ligne[BAZ_CHAMPS_NOM].' '.$ligne[BAZ_CHAMPS_PRENOM].')';
1015
		$nomflux .= ' ('.$ligne[BAZ_CHAMPS_NOM].' '.$ligne[BAZ_CHAMPS_PRENOM].')';
995
	}
1016
	}
996
	if ($requeteSQL!='') {
1017
	if ($requeteSQL!='') {
997
		if ($req_where==1) {$requete .= ' AND ';}
1018
		if ($req_where==1) {$requete .= ' AND ';}
998
		$requete .= '('.$requeteSQL.')';
1019
		$requete .= '('.$requeteSQL.')';
999
		$req_where=1;
1020
		$req_where=1;
1000
	}
1021
	}
1001
	$requete .= ' ORDER BY  bf_date_debut_validite_fiche DESC, bf_date_fin_validite_fiche DESC, bf_date_maj_fiche DESC';
1022
	$requete .= ' ORDER BY  bf_date_debut_validite_fiche DESC, bf_date_fin_validite_fiche DESC, bf_date_maj_fiche DESC';
1002
	if ($nbitem!='') {$requete .= ' LIMIT 0,'.$nbitem;}
1023
	if ($nbitem!='') {$requete .= ' LIMIT 0,'.$nbitem;}
1003
	
1024
	
1004
	$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
1025
	$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
1005
	if (DB::isError($resultat)) {
1026
	if (DB::isError($resultat)) {
1006
		die ($resultat->getMessage().$resultat->getDebugInfo()) ;
1027
		die ($resultat->getMessage().$resultat->getDebugInfo()) ;
1007
	}
1028
	}
1008
	$res = '<br /><h4>'.BAZ_IL_Y_A.($resultat->numRows()).' '.BAZ_FICHES_CORRESPONDANTES.'</h4><br />'."\n";
1029
	$res = '<br /><h4>'.BAZ_IL_Y_A.($resultat->numRows()).' '.BAZ_FICHES_CORRESPONDANTES.'</h4><br />'."\n";
1009
	$res .= '<ul>' ;
1030
	$res .= '<ul>' ;
1010
	$GLOBALS['_BAZAR_']['url']->addQueryString('action', BAZ_VOIR_FICHE);
1031
	$GLOBALS['_BAZAR_']['url']->addQueryString('action', BAZ_VOIR_FICHE);
1011
	
1032
	
1012
	$donnees = array();
1033
	$donnees = array();
1013
	while ($ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
1034
	while ($ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
1014
		$GLOBALS['_BAZAR_']['url']->addQueryString('id_fiche', $ligne->bf_id_fiche) ;
1035
		$GLOBALS['_BAZAR_']['url']->addQueryString('id_fiche', $ligne->bf_id_fiche) ;
1015
		array_push ($donnees, $ligne);		
1036
		array_push ($donnees, $ligne);		
1016
	}
1037
	}
1017
	// Mise en place du Pager
1038
	// Mise en place du Pager
1018
	include_once PAP_CHEMIN_API_PEAR.'Pager/Pager.php';
1039
	include_once PAP_CHEMIN_API_PEAR.'Pager/Pager.php';
1019
	$params = array(
1040
	$params = array(
1020
    'mode'       => BAZ_MODE_DIVISION,
1041
    'mode'       => BAZ_MODE_DIVISION,
1021
    'perPage'    => BAZ_NOMBRE_RES_PAR_PAGE,
1042
    'perPage'    => BAZ_NOMBRE_RES_PAR_PAGE,
1022
    'delta'      => BAZ_DELTA,
1043
    'delta'      => BAZ_DELTA,
1023
    'httpMethod' => 'GET',
1044
    'httpMethod' => 'GET',
1024
    'extraVars' => array_merge($_POST, $_GET),
1045
    'extraVars' => array_merge($_POST, $_GET),
1025
    'altNext' => BAZ_SUIVANT,
1046
    'altNext' => BAZ_SUIVANT,
1026
    'altPrev' => BAZ_PRECEDENT,
1047
    'altPrev' => BAZ_PRECEDENT,
1027
    'nextImg' => BAZ_SUIVANT,
1048
    'nextImg' => BAZ_SUIVANT,
1028
    'prevImg' => BAZ_PRECEDENT,
1049
    'prevImg' => BAZ_PRECEDENT,
1029
    'itemData'   => $donnees
1050
    'itemData'   => $donnees
1030
	);
1051
	);
1031
	$pager = & Pager::factory($params);
1052
	$pager = & Pager::factory($params);
1032
	$data  = $pager->getPageData();
1053
	$data  = $pager->getPageData();
1033
	$links = $pager->getLinks();
1054
	$links = $pager->getLinks();
1034
   
1055
   
1035
	// Appel du template n 2
1056
	// Appel du template n 2
1036
	include_once BAZ_CHEMIN_APPLI.'bibliotheque/bazarTemplate.class.php' ;
1057
	include_once BAZ_CHEMIN_APPLI.'bibliotheque/bazarTemplate.class.php' ;
1037
	$template = new bazarTemplate ($GLOBALS['_BAZAR_']['db']) ;
1058
	$template = new bazarTemplate ($GLOBALS['_BAZAR_']['db']) ;
1038
	$chaine = $template->getTemplate(2, $GLOBALS['_BAZAR_']['langue'], $GLOBALS['_BAZAR_']['categorie_nature']);
1059
	$chaine = $template->getTemplate(2, $GLOBALS['_BAZAR_']['langue'], $GLOBALS['_BAZAR_']['categorie_nature']);
1039
	if (bazarTemplate::isError ($chaine)) return $chaine->getMessage() ;
1060
	if (bazarTemplate::isError ($chaine)) return $chaine->getMessage() ;
1040
	ob_start();
1061
	ob_start();
1041
	eval ($chaine) ;
1062
	eval ($chaine) ;
1042
	$res .= ob_get_contents();
1063
	$res .= ob_get_contents();
1043
	ob_end_clean() ;
1064
	ob_end_clean() ;
1044
	
1065
	
-
 
1066
 
-
 
1067
	// Nettoyage de l'url
-
 
1068
	$GLOBALS['_BAZAR_']['url']->removeQueryString('action');
-
 
1069
	$GLOBALS['_BAZAR_']['url']->removeQueryString('id_fiche');
-
 
1070
	$GLOBALS['_BAZAR_']['url']->removeQueryString('typeannonce');
-
 
1071
	$GLOBALS['_BAZAR_']['url']->removeQueryString('recherche_avancee');
1045
 
1072
 
1046
	return $res ;
1073
	return $res ;
1047
}
1074
}
1048
 
1075
 
1049
/* +--Fin du code ----------------------------------------------------------------------------------------+
1076
/* +--Fin du code ----------------------------------------------------------------------------------------+
1050
*
1077
*
1051
* $Log: not supported by cvs2svn $
1078
* $Log: not supported by cvs2svn $
-
 
1079
* Revision 1.60.2.11  2007/03/07 17:20:19  jp_milcent
-
 
1080
* Ajout du nettoyage systématique des URLs.
-
 
1081
*
-
 
1082
* Revision 1.60.2.10  2007/03/06 09:41:15  alexandre_tb
-
 
1083
* backport de corrections de bugs de la branche principale
-
 
1084
*
-
 
1085
* Revision 1.69  2007/03/06 09:39:00  alexandre_tb
-
 
1086
* correction de bug sur les jointures et sur les flux rss
-
 
1087
*
1052
* Revision 1.68  2007/03/05 10:27:06  alexandre_tb
1088
* Revision 1.68  2007/03/05 10:27:06  alexandre_tb
1053
* ajout d identifiant dans les span qui affiche le detail d une fiche.
1089
* ajout d identifiant dans les span qui affiche le detail d une fiche.
1054
* ajout d un modele pour les fiches -> du code a ete deplace dans
1090
* ajout d un modele pour les fiches -> du code a ete deplace dans
1055
* bazar_template
1091
* bazar_template
1056
*
1092
*
1057
* Revision 1.67  2007/02/28 10:18:56  alexandre_tb
1093
* Revision 1.67  2007/02/28 10:18:56  alexandre_tb
1058
* backport de bug depuis la 1.60 de menes
1094
* backport de bug depuis la 1.60 de menes
-
 
1095
*
-
 
1096
* Revision 1.60.2.9  2007/02/27 15:32:40  alexandre_tb
-
 
1097
* utilisation de la fonction xmlEntities pour transformer les &amp; en &#...;
-
 
1098
* fixe les plantages des flux rss lorsque des guillemets ou des esperluettes étaient présents
-
 
1099
*
-
 
1100
* Revision 1.60.2.8  2007/02/27 15:11:00  alexandre_tb
-
 
1101
* correction d une jointure dans la requete pour les flux rss
-
 
1102
* utilisation de la librairie XML_Util de pear pour generer le flux RSS -> plus clair
-
 
1103
*
-
 
1104
* Revision 1.60.2.7  2007/02/15 17:39:00  jp_milcent
-
 
1105
* Remise dans le code d'un bogue...
-
 
1106
* A corriger!
-
 
1107
*
-
 
1108
* Revision 1.60.2.6  2007/02/15 13:42:16  jp_milcent
-
 
1109
* Utilisation de IN à la place du = dans les requêtes traitant les catégories de fiches.
-
 
1110
* Permet d'utiliser la syntaxe 1,2,3 dans la configuration de categorie_nature.
1059
*
1111
*
1060
* Revision 1.64  2007/02/02 14:00:41  alexandre_tb
1112
* Revision 1.64  2007/02/02 14:00:41  alexandre_tb
1061
* mise en place d'un template pour l'affichage du moteur de recherche
1113
* mise en place d'un template pour l'affichage du moteur de recherche
-
 
1114
*
-
 
1115
* Revision 1.60.2.5  2007/02/02 13:46:54  alexandre_tb
-
 
1116
* correction bug sur une date
-
 
1117
*
-
 
1118
* Revision 1.60.2.4  2007/01/30 15:45:01  alexandre_tb
-
 
1119
* affichage de la date de création e la fiche lorsque la date de début de validité n'est plus bonne
-
 
1120
*
-
 
1121
* Revision 1.60.2.3  2007/01/29 10:53:46  alexandre_tb
-
 
1122
* Mise en place de la constante BAZ_DERNIERES_FICHES pour remplacer le label en francais dans baz_liste
1062
*
1123
*
1063
* Revision 1.63  2007/01/18 14:37:34  alexandre_tb
1124
* Revision 1.63  2007/01/18 14:37:34  alexandre_tb
1064
* backport
1125
* backport
1065
* les dates ne s'affichent pas si elles sont vides.
1126
* les dates ne s'affichent pas si elles sont vides.
1066
* les champs dates propose 4 années avant l'année actuelle
1127
* les champs dates propose 4 années avant l'année actuelle
1067
*
1128
*
1068
* Revision 1.60.2.2  2007/01/17 16:01:27  alexandre_tb
1129
* Revision 1.60.2.2  2007/01/17 16:01:27  alexandre_tb
1069
* les dates ne s'affichent pas si elles sont vides.
1130
* les dates ne s'affichent pas si elles sont vides.
1070
* les champs dates propose 4 années avant l'année actuelle
1131
* les champs dates propose 4 années avant l'année actuelle
1071
*
1132
*
1072
* Revision 1.60.2.1  2007/01/05 14:41:49  alexandre_tb
1133
* Revision 1.60.2.1  2007/01/05 14:41:49  alexandre_tb
1073
* backport ordre d affichage des dernieres news et suppression de la taille des images uploadees
1134
* backport ordre d affichage des dernieres news et suppression de la taille des images uploadees
1074
*
1135
*
1075
* Revision 1.60  2006/10/05 08:53:50  florian
1136
* Revision 1.60  2006/10/05 08:53:50  florian
1076
* amelioration moteur de recherche, correction de bugs
1137
* amelioration moteur de recherche, correction de bugs
1077
*
1138
*
1078
* Revision 1.59  2006/09/21 14:19:39  florian
1139
* Revision 1.59  2006/09/21 14:19:39  florian
1079
* amélioration des fonctions liés au wikini
1140
* amélioration des fonctions liés au wikini
1080
*
1141
*
1081
* Revision 1.58  2006/09/15 12:31:40  alexandre_tb
1142
* Revision 1.58  2006/09/15 12:31:40  alexandre_tb
1082
* correction du nom du flux RSS.
1143
* correction du nom du flux RSS.
1083
*
1144
*
1084
* Revision 1.57  2006/07/25 13:22:27  alexandre_tb
1145
* Revision 1.57  2006/07/25 13:22:27  alexandre_tb
1085
* réorganisation du code, sans grand changement
1146
* réorganisation du code, sans grand changement
1086
*
1147
*
1087
* Revision 1.56  2006/07/18 14:13:35  alexandre_tb
1148
* Revision 1.56  2006/07/18 14:13:35  alexandre_tb
1088
* Ajout d identifiant HTML
1149
* Ajout d identifiant HTML
1089
*
1150
*
1090
* Revision 1.55  2006/07/04 14:29:18  alexandre_tb
1151
* Revision 1.55  2006/07/04 14:29:18  alexandre_tb
1091
* Ajout du bouton supprimer pour les administrateurs
1152
* Ajout du bouton supprimer pour les administrateurs
1092
*
1153
*
1093
* Revision 1.54  2006/07/03 09:51:21  alexandre_tb
1154
* Revision 1.54  2006/07/03 09:51:21  alexandre_tb
1094
* correction du bug recherche sur fiches validés et invalidés.
1155
* correction du bug recherche sur fiches validés et invalidés.
1095
*
1156
*
1096
* Revision 1.53  2006/06/29 10:29:51  florian
1157
* Revision 1.53  2006/06/29 10:29:51  florian
1097
* correction bug moteur de recherche
1158
* correction bug moteur de recherche
1098
*
1159
*
1099
* Revision 1.52  2006/06/02 09:29:07  florian
1160
* Revision 1.52  2006/06/02 09:29:07  florian
1100
* debut d'integration de wikini
1161
* debut d'integration de wikini
1101
*
1162
*
1102
* Revision 1.51  2006/05/23 15:41:27  alexandre_tb
1163
* Revision 1.51  2006/05/23 15:41:27  alexandre_tb
1103
* 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
1164
* 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
1104
*
1165
*
1105
* Revision 1.50  2006/05/22 09:55:12  alexandre_tb
1166
* Revision 1.50  2006/05/22 09:55:12  alexandre_tb
1106
* ajout de la variable recherche_avancee dans l'action du formulaire
1167
* ajout de la variable recherche_avancee dans l'action du formulaire
1107
*
1168
*
1108
* Revision 1.49  2006/05/19 13:54:11  florian
1169
* Revision 1.49  2006/05/19 13:54:11  florian
1109
* stabilisation du moteur de recherche, corrections bugs, lien recherche avancee
1170
* stabilisation du moteur de recherche, corrections bugs, lien recherche avancee
1110
*
1171
*
1111
* Revision 1.48  2006/05/17 09:50:13  alexandre_tb
1172
* Revision 1.48  2006/05/17 09:50:13  alexandre_tb
1112
* Ajout du moteur de recherche évolué et du découpage par page
1173
* Ajout du moteur de recherche évolué et du découpage par page
1113
*
1174
*
1114
* +-- Fin du code ----------------------------------------------------------------------------------------+
1175
* +-- Fin du code ----------------------------------------------------------------------------------------+
1115
*/
1176
*/
1116
?>
1177
?>