Subversion Repositories Applications.bazar

Rev

Rev 116 | Rev 122 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 116 Rev 118
Line 67... Line 67...
67
	}
67
	}
68
	return $res;
68
	return $res;
69
}
69
}
Line 70... Line 70...
70
 
70
 
71
 
71
 
72
/**  baz_voir_fiche() - Permet de visualiser en détail une fiche  au format XHTML
72
/**  baz_voir_fiche() - Permet de visualiser en detail une fiche  au format XHTML
73
*
73
*
74
* @global boolean Rajoute des informations internes à l'application (date de modification, lien vers la page de départ de l'appli) si à 1
74
* @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
75
* @global integer Identifiant de la fiche à afficher
75
* @global integer Identifiant de la fiche a afficher
76
*
76
*
77
* @return   string  HTML
77
* @return   string  HTML
78
*/
78
*/
79
function baz_voir_fiche($danslappli, $idfiche='') {
79
function baz_voir_fiche($danslappli, $idfiche='') {
80
	$res='';
80
	$res='';
81
	if (isset($_GET['id_fiche'])) $GLOBALS['_BAZAR_']['id_fiche']=$_GET['id_fiche'];
-
 
82
	if ($idfiche!='') $GLOBALS['_BAZAR_']['id_fiche']=$idfiche;
81
	if (isset($_GET['id_fiche'])) $GLOBALS['_BAZAR_']['id_fiche']=$_GET['id_fiche'];
83
	
82
	if ($idfiche!='') $GLOBALS['_BAZAR_']['id_fiche']=$idfiche;	
84
	$url= $GLOBALS['_BAZAR_']['url'];
83
	$url= $GLOBALS['_BAZAR_']['url'];
85
	$url->addQueryString('action', BAZ_VOIR_FICHE);
84
	$url->addQueryString('action', BAZ_VOIR_FICHE);
Line -... Line 85...
-
 
85
	$url->addQueryString('id_fiche', $GLOBALS['_BAZAR_']['id_fiche']);
-
 
86
	$url = preg_replace ('/&/', '&', $url->getURL()) ;
-
 
87
	
-
 
88
	//cas ou la fiche a été validee
-
 
89
	if (isset($_GET['publiee'])) {
-
 
90
		publier_fiche($_GET['publiee']);			
-
 
91
	}
-
 
92
	
-
 
93
	//cas on une structure s'approprie une ressource
-
 
94
	if (isset($_GET['appropriation'])) {
-
 
95
		if ($_GET['appropriation']==1) {
-
 
96
			$requete = 'INSERT INTO bazar_appropriation VALUES ('.$GLOBALS['_BAZAR_']['id_fiche'].', '.$GLOBALS['AUTH']->getAuthData(BAZ_CHAMPS_ID).')';
-
 
97
			$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
-
 
98
		}
-
 
99
		elseif ($_GET['appropriation']==0) {
-
 
100
			$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);
-
 
101
			$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
86
	$url->addQueryString('id_fiche', $GLOBALS['_BAZAR_']['id_fiche']);
102
		}
87
	$url = preg_replace ('/&/', '&', $url->getURL()) ;
103
	}
88
	
104
		
89
	//cas ou un commentaire a été entré
105
	//cas ou un commentaire a été entre
90
	if (isset($_POST['Nom'])) {
106
	if (isset($_POST['Nom'])) {
91
		$requete = 'INSERT INTO bazar_commentaires VALUES ('.
107
		$requete = 'INSERT INTO bazar_commentaires VALUES ('.
Line 129... Line 145...
129
	if (isset ($GLOBALS['_BAZAR_']['image_titre']) && $GLOBALS['_BAZAR_']['image_titre']!='') {
145
	if (isset ($GLOBALS['_BAZAR_']['image_titre']) && $GLOBALS['_BAZAR_']['image_titre']!='') {
130
		$res .= '<img id="BAZ_img_titre" src="client/bazar/images/'.$GLOBALS['_BAZAR_']['image_titre'].'" alt="'.$GLOBALS['_BAZAR_']['typeannonce'].'" />'.'<br />'."\n";
146
		$res .= '<img id="BAZ_img_titre" src="client/bazar/images/'.$GLOBALS['_BAZAR_']['image_titre'].'" alt="'.$GLOBALS['_BAZAR_']['typeannonce'].'" />'.'<br />'."\n";
131
	}
147
	}
132
	//affiche le texte sinon
148
	//affiche le texte sinon
133
	else {
149
	else {
134
		$res .= '<h1 class="BAZ_titre">'.$GLOBALS['_BAZAR_']['typeannonce'].'</h1>'."\n";
150
		$res .= '<h2 class="BAZ_titre">'.$GLOBALS['_BAZAR_']['typeannonce'].'</h2>'."\n";
135
	}
151
	}
136
	$res .= '<div class="BAZ_cadre_fiche">'."\n";
152
	$res .= '<div class="BAZ_cadre_fiche">'."\n";
137
	$res .= '<div class="BAZ_cadre_fiche_haut">'."\n";
-
 
138
	$res .= '&nbsp;</div>'."\n";
-
 
139
	$res .= '<div class="BAZ_cadre_fiche_corps">'."\n";
-
 
140
	$requete = 'SELECT * FROM bazar_fiche WHERE bf_id_fiche='.$GLOBALS['_BAZAR_']['id_fiche'];
153
	$requete = 'SELECT * FROM bazar_fiche WHERE bf_id_fiche='.$GLOBALS['_BAZAR_']['id_fiche'];
141
	$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
154
	$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
142
	if (DB::isError ($resultat)) {
155
	if (DB::isError ($resultat)) {
143
		die ($resultat->getMessage().'<br />'.$resultat->getDebugInfo()) ;
156
		die ($resultat->getMessage().'<br />'.$resultat->getDebugInfo()) ;
144
	}
157
	}
Line 152... Line 165...
152
	//on affiche ligne par ligne sinon
165
	//on affiche ligne par ligne sinon
153
	else {
166
	else {
154
		//cas d'une image personalisée
167
		//cas d'une image personalisée
155
		if (isset($ligne['bf_url_image'])) {
168
		if (isset($ligne['bf_url_image'])) {
156
			$res .= '<div id="fiche_image">'."\n";
169
			$res .= '<div id="fiche_image">'."\n";
157
			$res .= '<img src="client/bazar/images/'.$ligne['bf_url_image'].'" border=0 alt="'.BAZ_TEXTE_IMG_ALTERNATIF.'" width="130" height="130"  />'."\n";
170
			$res .= '<img src="client/bazar/upload/'.$ligne['bf_url_image'].'" border=0 alt="'.BAZ_TEXTE_IMG_ALTERNATIF.'" width="130" height="130"  />'."\n";
158
			$res .= '</div>'."\n";
171
			$res .= '</div>'."\n";
159
		}
172
		}
160
		//cas d'une image par défaut
173
		//cas d'une image par défaut
161
		elseif (isset ($GLOBALS['_BAZAR_']['image_logo']) && $GLOBALS['_BAZAR_']['image_logo']!='') {
174
		elseif (isset ($GLOBALS['_BAZAR_']['image_logo']) && $GLOBALS['_BAZAR_']['image_logo']!='') {
162
			$res .= '<div id="fiche_image">'."\n";
175
			$res .= '<div id="fiche_image">'."\n";
Line 165... Line 178...
165
		}
178
		}
166
		$res .= '<h1 id="fiche_titre">'.$ligne['bf_titre'].'</h1>'."\n";
179
		$res .= '<h1 id="fiche_titre">'.$ligne['bf_titre'].'</h1>'."\n";
167
		$res .= '<div id="BAZ_description">'.$ligne['bf_description'].'</div>'."\n";
180
		$res .= '<div id="BAZ_description">'.$ligne['bf_description'].'</div>'."\n";
168
		$tableau=baz_valeurs_template($GLOBALS['_BAZAR_']['template']);
181
		$tableau=baz_valeurs_template($GLOBALS['_BAZAR_']['template']);
169
		for ($i=0; $i<count($tableau); $i++) {
182
		for ($i=0; $i<count($tableau); $i++) {
170
			if (isset($ligne[$tableau[$i]['nom_bdd']])) {
183
			if (isset($ligne[$tableau[$i]['nom_bdd']]) && ( $tableau[$i]['type']=='texte' || $tableau[$i]['type']=='textelong' ) ) {
171
				$val=$tableau[$i]['nom_bdd'];
184
				$val=$tableau[$i]['nom_bdd'];
172
				if (!in_array($val, array ('bf_titre', 'bf_description', 'bf_date_debut_validite_fiche',
185
				if (!in_array($val, array ('bf_titre', 'bf_description', 'bf_date_debut_validite_fiche',
173
								'bf_date_fin_validite_fiche'))) {
186
								'bf_date_fin_validite_fiche'))) {
174
					if ($val != '' and $val != BAZ_CHOISIR and $val != BAZ_NON_PRECISE) {
187
					if ($val != '' and $val != BAZ_CHOISIR and $val != BAZ_NON_PRECISE) {
175
						$res .= '<span class="rubrique">'.$tableau[$i]['label'].':</span>'."\n";
188
						$res .= '<span class="rubrique">'.$tableau[$i]['label'].':</span>'."\n";
176
						$res .= '<span class="description"> '.$ligne[$val].'</span>'."\n".'<br />'."\n";
189
						$res .= '<span class="description"> '.$ligne[$val].'</span>'."\n".'<br />'."\n";
177
					}
190
					}
178
				}
191
				}
179
			}
192
			}
180
			elseif (($tableau[$i]['type']=='liste')or($tableau[$i]['type']=='checkbox')) {
193
			elseif ( $tableau[$i]['type']=='liste' || $tableau[$i]['type']=='checkbox' ) {
181
				//pour les champs renseignes par une liste, on va chercher le label de la liste, plutot que l'id				
194
				//pour les champs renseignes par une liste, on va chercher le label de la liste, plutot que l'id				
182
				$requete = 'SELECT blv_label FROM bazar_fiche_valeur_liste, bazar_liste_valeurs WHERE bfvl_ce_fiche='.$GLOBALS['_BAZAR_']['id_fiche'].
195
				$requete = 'SELECT blv_label FROM bazar_fiche_valeur_liste, bazar_liste_valeurs WHERE bfvl_ce_fiche='.$GLOBALS['_BAZAR_']['id_fiche'].
183
				' 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'].'"';
196
				' 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'].'"';
184
				$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
197
				$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
185
				if (DB::isError ($resultat)) {
198
				if (DB::isError ($resultat)) {
Line 220... Line 233...
220
	if ($resultat->numRows()>0) {
233
	if ($resultat->numRows()>0) {
221
		$res .= '<span class="rubrique">'.BAZ_LISTE_FICHIERS_JOINTS.':</span>'."\n";
234
		$res .= '<span class="rubrique">'.BAZ_LISTE_FICHIERS_JOINTS.':</span>'."\n";
222
		$res .= '<span class="description">'."\n";
235
		$res .= '<span class="description">'."\n";
223
		$res .= '<ul>'."\n";
236
		$res .= '<ul>'."\n";
224
		while ($ligne2 = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
237
		while ($ligne2 = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
225
			$res .= '<li><a href="http://'.$_SERVER['HTTP_HOST'].'/client/bazar/upload/'.$ligne2['bfj_fichier'].'">'.$ligne2['bfj_description'].'</a></li>'."\n";
238
			$res .= '<li><a href="client/bazar/upload/'.$ligne2['bfj_fichier'].'">'.$ligne2['bfj_description'].'</a></li>'."\n";
226
		}
239
		}
227
		$res .= '</ul></span>'."\n";
240
		$res .= '</ul></span>'."\n";
228
	}
241
	}
229
	$res .= '<div class="bulle_haut">&nbsp;</div>'."\n";
242
	$res .= '<div class="bulle_haut">&nbsp;</div>'."\n";
230
	$res .= '<div class="bulle_corps">'."\n";
243
	$res .= '<div class="bulle_corps">'."\n";
Line 244... Line 257...
244
	$res .= '<div class="bulle_bas">&nbsp;</div>'."\n";
257
	$res .= '<div class="bulle_bas">&nbsp;</div>'."\n";
245
	$res .= '<div id="BAZ_bas_page">';
258
	$res .= '<div id="BAZ_bas_page">';
246
	}
259
	}
Line 247... Line 260...
247
	
260
	
248
	//informations complementaires (id fiche, etat publication,... )
261
	//informations complementaires (id fiche, etat publication,... )
249
	if ($danslappli==1) {
-
 
250
		$res .= '<span class="rubrique">'.BAZ_NUM_FICHE.':</span> '.$GLOBALS['_BAZAR_']['id_fiche'].'<br />'."\n";
262
	if ($danslappli==1) {		
251
		if ($ligne['bf_statut_fiche']==1) {
263
		if ($ligne['bf_statut_fiche']==1 && $GLOBALS['_BAZAR_']['appropriation']!=1 ) {
252
			$res .= '<span class="rubrique">'.BAZ_PUBLIEE.':</span> '.BAZ_DU.' '.strftime('%d.%m.%Y',strtotime($ligne['bf_date_debut_validite_fiche'])).' '.BAZ_AU.' '.strftime('%d.%m.%Y',strtotime($ligne['bf_date_fin_validite_fiche'])).'<br />'."\n";
264
			$res .= '<span class="rubrique">'.BAZ_PUBLIEE.':</span> '.BAZ_DU.' '.strftime('%d.%m.%Y',strtotime($ligne['bf_date_debut_validite_fiche'])).' '.BAZ_AU.' '.strftime('%d.%m.%Y',strtotime($ligne['bf_date_fin_validite_fiche'])).'<br />'."\n";
-
 
265
		}
-
 
266
		elseif ($GLOBALS['_BAZAR_']['appropriation']!=1 || $ligne['bf_statut_fiche']!=1) {
253
		}
267
			$res .= '<span class="rubrique">'.BAZ_PUBLIEE.':</span> '.BAZ_NON;							
-
 
268
			if ( $est_admin ) {
-
 
269
				$res .= '&nbsp;&nbsp;&nbsp;<strong>'.BAZ_VALIDER_PUBLICATION.'&nbsp;:&nbsp;</strong>'."\n";
-
 
270
				$lien_publie = &$GLOBALS['_BAZAR_']['url'];
-
 
271
				$lien_publie->addQueryString('action', BAZ_VOIR_FICHE);
-
 
272
				$lien_publie->addQueryString('id_fiche', $GLOBALS['_BAZAR_']['id_fiche']);
-
 
273
				$lien_publie->addQueryString('typeannonce', $ligne['bf_ce_nature']);
-
 
274
				$lien_publie->addQueryString('publiee', 1);
-
 
275
				$res .= '<a href="'.$lien_publie->getURL().'">'.BAZ_OUI.'</a>&nbsp;/&nbsp;';
-
 
276
				$lien_publie->removeQueryString('publiee');
254
		else {
277
				$lien_publie->addQueryString('publiee', 0);
-
 
278
				$res .='<a href="'.$lien_publie->getURL().'">'.BAZ_NON.'</a>'."\n";
-
 
279
				$lien_publie->removeQueryString('publiee');
-
 
280
			}
255
			$res .= '<span class="rubrique">'.BAZ_PUBLIEE.':</span> '.BAZ_NON.'<br />'."\n";
281
			$res .= '<br />'."\n";
-
 
282
		}
-
 
283
		//affichage des infos pouvant interesser les admins
256
		}
284
		if ( $est_admin ) {
257
		$res .= '<span class="rubrique">'.BAZ_DATE_CREATION.' :</span> '.strftime('%d.%m.%Y &agrave; %H:%M',strtotime($ligne['bf_date_creation_fiche'])).'<br />'."\n";
285
			$res .= '<span class="rubrique">'.BAZ_NUM_FICHE.':</span> '.$GLOBALS['_BAZAR_']['id_fiche'].'<br />'."\n";
258
		$res .= '<span class="rubrique">'.BAZ_DATE_MAJ.' :</span> '.strftime('%d.%m.%Y &agrave; %H:%M',strtotime($ligne['bf_date_maj_fiche'])).'<br />'."\n";
286
			$res .= '<span class="rubrique">'.BAZ_DATE_CREATION.' :</span> '.strftime('%d.%m.%Y &agrave; %H:%M',strtotime($ligne['bf_date_creation_fiche'])).'<br />'."\n";			
259
		
287
		}		
260
		if ($est_admin or 
288
		//affichage des infos et du lien pour la mise a jour de la fiche
-
 
289
		if ( $est_admin || $GLOBALS['_BAZAR_']['annonceur']==$GLOBALS['AUTH']->getAuthData(BAZ_CHAMPS_ID) ) {			
261
					$GLOBALS['_BAZAR_']['annonceur']==$GLOBALS['AUTH']->getAuthData(BAZ_CHAMPS_ID)) {
290
			$res .= '<span class="rubrique">'.BAZ_DATE_MAJ.' :</span> '.strftime('%d.%m.%Y &agrave; %H:%M',strtotime($ligne['bf_date_maj_fiche']))."\n";
262
			$lien_modifier=$GLOBALS['_BAZAR_']['url'];
291
			$lien_modifier=$GLOBALS['_BAZAR_']['url'];
263
			$lien_modifier->addQueryString('action', BAZ_ACTION_MODIFIER);
292
			$lien_modifier->addQueryString('action', BAZ_ACTION_MODIFIER);
264
			$lien_modifier->addQueryString('id_fiche', $GLOBALS['_BAZAR_']['id_fiche']);
293
			$lien_modifier->addQueryString('id_fiche', $GLOBALS['_BAZAR_']['id_fiche']);
265
			$lien_modifier->addQueryString('typeannonce', $ligne['bf_ce_nature']);
294
			$lien_modifier->addQueryString('typeannonce', $ligne['bf_ce_nature']);
266
			$res .= '&nbsp;<a href="'.$lien_modifier->getURL().'">'.BAZ_MODIFIER_LA_FICHE.'</a>'."\n";
295
			$res .= '&nbsp;&nbsp;&nbsp;<a href="'.$lien_modifier->getURL().'">'.BAZ_MODIFIER_LA_FICHE.'</a>'."\n";
267
		}
296
		}
268
	}
297
	}
269
	$res .= '</div>'."\n";
298
	$res .= '</div>'."\n";
270
	$res .= '</div>'."\n";
-
 
271
	$res .= '<div class="BAZ_cadre_fiche_bas">&nbsp;</div>'."\n";
-
 
Line 272... Line 299...
272
	$res .= '</div>'."\n";
299
	$res .= '</div>'."\n";
273
	
300
	
274
	//on ajoute les appropriations, s'il le faut
301
	//on ajoute les appropriations, s'il le faut
275
	if (($danslappli==1)and($GLOBALS['_BAZAR_']['appropriation']==1)) {
-
 
276
		$res .= '<br />'."\n".'<div class="BAZ_cadre_fiche">'."\n";
-
 
277
		$res .= '<div class="BAZ_cadre_fiche_haut">&nbsp;</div>'."\n";
302
	if (($danslappli==1)and($GLOBALS['_BAZAR_']['appropriation']==1)) {
278
		$res .= '<div class="BAZ_cadre_fiche_corps">'."\n";
-
 
279
		$res .= '<h3>'.BAZ_LES_STRUCTURES_POSSEDANT_UNE_RESSOURCE.'</h3>'."\n";
303
		$res .= '<br />'."\n".'<div class="BAZ_cadre_fiche">'."\n";
280
		
304
		$res .= '<h3>'.BAZ_LES_STRUCTURES_POSSEDANT_UNE_RESSOURCE.'</h3>'."\n";		
281
		$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';
305
		$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';
282
		$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
306
		$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
283
		if (DB::isError ($resultat)) {
307
		if (DB::isError ($resultat)) {
-
 
308
			die ($resultat->getMessage().'<br />'.$resultat->getDebugInfo()) ;
284
			die ($resultat->getMessage().'<br />'.$resultat->getDebugInfo()) ;
309
		}
285
		}
310
		$possede_ressource=0;
286
		if ($resultat->numRows()>0) {
311
		if ($resultat->numRows()>0) {
287
			$res .= BAZ_IL_Y_A.$resultat->numRows().' ';
312
			$res .= BAZ_IL_Y_A.$resultat->numRows().' ';
-
 
313
			if ($resultat->numRows()==1) $res .= BAZ_STRUCTURE_POSSEDANT.'<br />'."\n";
288
			if ($resultat->numRows()==1) $res .= BAZ_COMMENTAIRE.'<br />'."\n";
314
			else $res .= BAZ_STRUCTURES_POSSEDANT.'<br />'."\n";
289
			else $res .= BAZ_COMMENTAIRES.'<br />'."\n";
-
 
290
			while ($ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
-
 
291
				$res .= '<div class="bulle_haut">&nbsp;</div>'."\n";
-
 
292
				$res .= '<div class="bulle_corps">'."\n";
-
 
293
				//affichage du commentaire
-
 
294
				$res .= $ligne['bc_commentaire'].'<br />'."\n";
-
 
295
				$res .= '</div>'."\n";
315
			$res .= '<ul>'."\n";
296
				$res .= '<div class="bulle_bas">'."\n";
-
 
297
				$res .= '<div style="font-size:9px;margin-left:10px;">'.BAZ_PAR.' : <strong>'.$ligne['bc_nom'].'</strong>'.BAZ_ECRIT_LE.$ligne['bc_date'].'</div>'."\n";
-
 
298
				//pour les identifiés seulement, administrateurs de la rubrique ou superadmins
-
 
299
				if ($est_admin==1) {
-
 
300
					$url_comment= $GLOBALS['_BAZAR_']['url'];
-
 
301
					$url_comment->addQueryString('action', BAZ_VOIR_FICHE);
-
 
302
					$url_comment->addQueryString('id_fiche', $GLOBALS['_BAZAR_']['id_fiche']);
316
			while ($ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
303
					$url_comment->addQueryString('id_commentaire', $ligne['bc_id_commentaire']);
-
 
304
					$res .= '<a href="'.$url_comment->getURL().'" style="font-size:9px;float:right;">'.BAZ_SUPPRIMER.'</a>'."\n";
-
 
305
				}
317
				$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";
-
 
318
				if ($GLOBALS['AUTH']->getAuth() && $GLOBALS['AUTH']->getAuthData(BAZ_CHAMPS_ID)==$ligne[BAZ_CHAMPS_ID]) $possede_ressource=1;
306
				$res .= '</div>'."\n";
319
			}
307
			}
320
			$res .= '</ul><br />'."\n";
-
 
321
		}
-
 
322
		else $res .= BAZ_PAS_D_APPROPRIATION.'<br /><br />'."\n";
-
 
323
		$res .='<p class="bulle_corps">'."\n";
-
 
324
		$lien_appropriation = $GLOBALS['_BAZAR_']['url'];
-
 
325
		$lien_appropriation->addQueryString('action', BAZ_VOIR_FICHE);
-
 
326
		$lien_appropriation->addQueryString('id_fiche', $GLOBALS['_BAZAR_']['id_fiche']);			
-
 
327
		if ($possede_ressource) {
-
 
328
			$lien_appropriation->addQueryString('appropriation', 0);
308
		}
329
			$res .= BAZ_POSSEDE_DEJA_RESSOURCE.'<br />'."\n".'<a href="'.$lien_appropriation->getURL().'">'.BAZ_CLIQUER_POUR_VOUS_ENLEVER.'</a>'."\n";
-
 
330
			$lien_appropriation->removeQueryString('appropriation');
-
 
331
		}
-
 
332
		elseif ($GLOBALS['AUTH']->getAuth() && $GLOBALS['AUTH']->getAuthData(BAZ_CHAMPS_EST_STRUCTURE)) {
-
 
333
			$lien_appropriation->addQueryString('appropriation', 1);
-
 
334
			$res .= BAZ_SI_POSSEDE_RESSOURCE.'<br />'."\n".'<a href="'.$lien_appropriation->getURL().'">'.BAZ_CLIQUER_POUR_APPARAITRE.'</a>'."\n";
-
 
335
			$lien_appropriation->removeQueryString('appropriation');
309
		else $res .= BAZ_PAS_D_APPROPRIATION.'<br /><br />'."\n";
336
		}
-
 
337
		elseif ($GLOBALS['AUTH']->getAuth() && !$GLOBALS['AUTH']->getAuthData(BAZ_CHAMPS_EST_STRUCTURE)) {
-
 
338
			$res .= BAZ_IL_FAUT_ETRE_STRUCTURE."\n";
310
		
339
		}
-
 
340
		elseif (!$GLOBALS['AUTH']->getAuth()) {
-
 
341
			$res .= BAZ_IL_FAUT_ETRE_IDENTIFIE_STRUCTURE."\n";
311
		$res .= '</div>'."\n";
342
		}
312
		$res .= '<div class="BAZ_cadre_fiche_bas">&nbsp;</div>'."\n";
343
		$res .='</p>'."\n";
Line 313... Line 344...
313
		$res .= '</div>'."\n";
344
		$res .= '</div>'."\n";
314
	}
345
	}
315
	
346
	
316
	//on ajoute les commentaires, s'il le faut
-
 
317
	if (($danslappli==1)and($GLOBALS['_BAZAR_']['commentaire']==1)) {
-
 
318
		$res .= '<br />'."\n".'<div class="BAZ_cadre_fiche">'."\n";
347
	//on ajoute les commentaires, s'il le faut
319
		$res .= '<div class="BAZ_cadre_fiche_haut">&nbsp;</div>'."\n";
348
	if (($danslappli==1)and($GLOBALS['_BAZAR_']['commentaire']==1)) {
320
		$res .= '<div class="BAZ_cadre_fiche_corps">'."\n";
349
		$res .= '<br />'."\n".'<div class="BAZ_cadre_fiche">'."\n";
321
		$res .= '<h3>'.BAZ_LES_COMMENTAIRES.'</h3>'."\n";
350
		$res .= '<h3>'.BAZ_LES_COMMENTAIRES.'</h3>'."\n";
322
		$requete = 'SELECT * FROM bazar_commentaires WHERE bc_ce_id_fiche='.$GLOBALS['_BAZAR_']['id_fiche'].' ORDER BY bc_date ASC';
351
		$requete = 'SELECT * FROM bazar_commentaires WHERE bc_ce_id_fiche='.$GLOBALS['_BAZAR_']['id_fiche'].' ORDER BY bc_date ASC';
Line 334... Line 363...
334
				//affichage du commentaire
363
				//affichage du commentaire
335
				$res .= $ligne['bc_commentaire'].'<br />'."\n";
364
				$res .= $ligne['bc_commentaire'].'<br />'."\n";
336
				$res .= '</div>'."\n";
365
				$res .= '</div>'."\n";
337
				$res .= '<div class="bulle_bas">'."\n";
366
				$res .= '<div class="bulle_bas">'."\n";
338
				$res .= '<div style="font-size:9px;margin-left:10px;">'.BAZ_PAR.' : <strong>'.$ligne['bc_nom'].'</strong>'.BAZ_ECRIT_LE.$ligne['bc_date'].'</div>'."\n";
367
				$res .= '<div style="font-size:9px;margin-left:10px;">'.BAZ_PAR.' : <strong>'.$ligne['bc_nom'].'</strong>'.BAZ_ECRIT_LE.$ligne['bc_date'].'</div>'."\n";
339
				//pour les identifiés seulement, administrateurs de la rubrique ou superadmins
368
				//pour les identifies seulement, administrateurs de la rubrique ou superadmins
340
				if ($est_admin==1) {
369
				if ($est_admin==1) {
341
					$url_comment= $GLOBALS['_BAZAR_']['url'];
370
					$url_comment= $GLOBALS['_BAZAR_']['url'];
342
					$url_comment->addQueryString('action', BAZ_VOIR_FICHE);
371
					$url_comment->addQueryString('action', BAZ_VOIR_FICHE);
343
					$url_comment->addQueryString('id_fiche', $GLOBALS['_BAZAR_']['id_fiche']);
372
					$url_comment->addQueryString('id_fiche', $GLOBALS['_BAZAR_']['id_fiche']);
344
					$url_comment->addQueryString('id_commentaire', $ligne['bc_id_commentaire']);
373
					$url_comment->addQueryString('id_commentaire', $ligne['bc_id_commentaire']);
Line 348... Line 377...
348
			}
377
			}
349
		}
378
		}
350
		else $res .= BAZ_PAS_DE_COMMENTAIRES.'<br /><br />'."\n";
379
		else $res .= BAZ_PAS_DE_COMMENTAIRES.'<br /><br />'."\n";
Line 351... Line 380...
351
		
380
		
352
		//formulaire des commentaires
381
		//formulaire des commentaires
353
		$form_commentaire = new HTML_QuickForm('commentaire', 'post', $url);
382
		$form_commentaire = new HTML_QuickForm('bazar_commentaire', 'post', $url);
354
		$squelette =& $form_commentaire->defaultRenderer();
383
		$squelette =& $form_commentaire->defaultRenderer();
355
		$squelette->setFormTemplate("\n".'<form {attributes}>'."\n".'{content}'."\n".'</form>'."\n");
384
		$squelette->setFormTemplate("\n".'<form {attributes}>'."\n".'{content}'."\n".'</form>'."\n");
-
 
385
		$squelette->setElementTemplate( '<label style="width:200px;">{label}'.
-
 
386
										'<!-- BEGIN required --><span class="symbole_obligatoire">&nbsp;*</span><!-- END required -->'."\n".
356
		$squelette->setElementTemplate( '<label style="width:200px;">{label}&nbsp;</label><br />'."\n".'{element}<br />'."\n");
387
									    '</label><br />'."\n".'{element}<br />'."\n");
357
		$squelette->setRequiredNoteTemplate("\n".'{requiredNote} '."\n");
388
		$squelette->setRequiredNoteTemplate("\n".'<span class="symbole_obligatoire"> *{requiredNote}</span>'."\n");
358
		$option=array('style'=>'width:300px;', 'maxlength'=>100);
389
		$option=array('style'=>'width:300px;border:1px solid #000;', 'maxlength'=>100);
359
		$form_commentaire->addElement('text', 'Nom', BAZ_ENTREZ_VOTRE_NOM, $option);
390
		$form_commentaire->addElement('text', 'Nom', BAZ_ENTREZ_VOTRE_NOM, $option);
360
		$option=array('style'=>'width:100%;height:100px;white-space: pre;padding:3px;');
391
		$option=array('style'=>'width:95%;height:100px;white-space: pre;padding:3px;border:1px solid #000;');
361
		require_once PAP_CHEMIN_API_PEAR.'HTML/QuickForm/textarea.php';
392
		require_once PAP_CHEMIN_API_PEAR.'HTML/QuickForm/textarea.php';
362
		$formtexte= new HTML_QuickForm_textarea('Commentaire', BAZ_ENTREZ_VOTRE_COMMENTAIRE, $option);
393
		$formtexte= new HTML_QuickForm_textarea('Commentaire', BAZ_ENTREZ_VOTRE_COMMENTAIRE, $option);
-
 
394
		$form_commentaire->addElement($formtexte) ;
363
		$form_commentaire->addElement($formtexte) ;
395
		$option=array('style'=>'border:1px solid #000;');
364
		$form_commentaire->addElement('submit', 'Envoyer', BAZ_ENVOYER);
396
		$form_commentaire->addElement('submit', 'Envoyer', BAZ_ENVOYER, $option);
365
		$form_commentaire->addRule('Nom', BAZ_NOM_REQUIS, 'required', '', 'client') ;
397
		$form_commentaire->addRule('Nom', BAZ_NOM_REQUIS, 'required', '', 'client') ;
366
		$form_commentaire->addRule('Commentaire', BAZ_COMMENTAIRE_REQUIS, 'required', '', 'client') ;
398
		$form_commentaire->addRule('Commentaire', BAZ_COMMENTAIRE_REQUIS, 'required', '', 'client') ;
367
		$form_commentaire->setRequiredNote(BAZ_CHAMPS_REQUIS) ;
399
		$form_commentaire->setRequiredNote(BAZ_CHAMPS_REQUIS) ;
368
		$res .= $form_commentaire->toHTML();
-
 
369
		
-
 
370
		$res .= '</div>'."\n";
-
 
371
		$res .= '<div class="BAZ_cadre_fiche_bas">&nbsp;</div>'."\n";
400
		$res .= $form_commentaire->toHTML();
372
		$res .= '</div>'."\n";
401
		$res .= '</div>'."\n";
Line 373... Line 402...
373
	}
402
	}
374
	
403
	
Line 495... Line 524...
495
		//requete pour afficher le nom de la structure
524
		//requete pour afficher le nom de la structure
496
		$requetenom = 'SELECT '.BAZ_CHAMPS_NOM.', '.BAZ_CHAMPS_PRENOM.' FROM '.
525
		$requetenom = 'SELECT '.BAZ_CHAMPS_NOM.', '.BAZ_CHAMPS_PRENOM.' FROM '.
497
						BAZ_ANNUAIRE.' WHERE '.BAZ_CHAMPS_ID.'='.$emetteur;
526
						BAZ_ANNUAIRE.' WHERE '.BAZ_CHAMPS_ID.'='.$emetteur;
498
		$resultat = $GLOBALS['_BAZAR_']['db']->query($requetenom) ;
527
		$resultat = $GLOBALS['_BAZAR_']['db']->query($requetenom) ;
499
		if (DB::isError($resultat)) {
528
		if (DB::isError($resultat)) {
500
			echo ($resultat->getMessage().$resultat->getDebugInfo()) ;
529
			die ($resultat->getMessage().$resultat->getDebugInfo()) ;
501
		}
530
		}
502
		$ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC);
531
		$ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC);
503
		$nomflux .= ' ('.$ligne[BAZ_CHAMPS_NOM].' '.$ligne[BAZ_CHAMPS_PRENOM].')';
532
		$nomflux .= ' ('.$ligne[BAZ_CHAMPS_NOM].' '.$ligne[BAZ_CHAMPS_PRENOM].')';
504
	}
533
	}
505
	if ($requeteSQL!='') {
534
	if ($requeteSQL!='') {
Line 652... Line 681...
652
	$defauts=array('recherche_mots_cles'=>BAZ_MOT_CLE);
681
	$defauts=array('recherche_mots_cles'=>BAZ_MOT_CLE);
653
	$formtemplate->setDefaults($defauts);
682
	$formtemplate->setDefaults($defauts);
Line 654... Line 683...
654
	
683
	
655
	//option cachee pour savoir si le formulaire a ete appele deja 
684
	//option cachee pour savoir si le formulaire a ete appele deja 
656
	$formtemplate->addElement('hidden', 'recherche_effectuee', 1) ;
685
	$formtemplate->addElement('hidden', 'recherche_effectuee', 1) ;
657
	
686
//	
658
	// Ajout des options si un type de fiche a ete choisie
687
//	// Ajout des options si un type de fiche a ete choisie
659
	if (isset($_POST['nature']) || isset($GLOBALS['_BAZAR_']['categorie_nature'])) {
688
//	if (isset($_POST['nature']) || isset($GLOBALS['_BAZAR_']['categorie_nature'])) {
660
		if ($GLOBALS['_BAZAR_']['categorie_nature'] != '') {
689
//		if ($GLOBALS['_BAZAR_']['categorie_nature'] != '') {
661
			$champs_requete = 'bn_ce_id_menu' ;
690
//			$champs_requete = 'bn_ce_id_menu' ;
662
			$_POST['nature'] = $GLOBALS['_BAZAR_']['categorie_nature'];
691
//			$_POST['nature'] = $GLOBALS['_BAZAR_']['categorie_nature'];
663
		} else {
692
//		} else {
664
			$champs_requete = 'bn_id_nature' ;	
693
//			$champs_requete = 'bn_id_nature' ;	
665
		}
694
//		}
666
		// Récupération du template
695
//		// Récupération du template
667
		$requete = 'select bn_template from bazar_nature where '.$champs_requete.'='.$_POST['nature'];
696
//		$requete = 'select bn_template from bazar_nature where '.$champs_requete.'='.$_POST['nature'];
668
		$resultat = $GLOBALS['_BAZAR_']['db']->getOne($requete) ;
697
//		$resultat = $GLOBALS['_BAZAR_']['db']->getOne($requete) ;
669
		if (DB::isError($resultat)) {
698
//		if (DB::isError($resultat)) {
670
			die ($resultat->getMessage().$resultat->getDebugInfo()) ;
699
//			die ($resultat->getMessage().$resultat->getDebugInfo()) ;
671
		}
700
//		}
672
		
701
//		
673
		$tableau = baz_valeurs_template($resultat) ;
702
//		$tableau = baz_valeurs_template($resultat) ;
674
		
703
//		
675
		for ($i=0; $i<count($tableau); $i++) {
704
//		for ($i=0; $i<count($tableau); $i++) {
676
			if (($tableau[$i]['type'] == 'liste' || $tableau[$i]['type'] == 'checkbox') && $tableau[$i]['recherche'] == 1) {
705
//			if (($tableau[$i]['type'] == 'liste' || $tableau[$i]['type'] == 'checkbox') && $tableau[$i]['recherche'] == 1) {
677
				if ($tableau[$i]['type'] == 'checkbox') {
706
//				if ($tableau[$i]['type'] == 'checkbox') {
678
					$formtemplate->addElement ('html', '<br />'.$tableau[$i]['label'].'<br />') ;	
707
//					$formtemplate->addElement ('html', '<br />'.$tableau[$i]['label'].'<br />') ;	
679
				}
708
//				}
680
				$tableau[$i]['type']($formtemplate, $tableau[$i]['nom_bdd'], $tableau[$i]['label'], $tableau[$i]['limite1'],
709
//				$tableau[$i]['type']($formtemplate, $tableau[$i]['nom_bdd'], $tableau[$i]['label'], $tableau[$i]['limite1'],
681
		                         $tableau[$i]['limite2'], $tableau[$i]['defaut'], $tableau[$i]['table_source'], $tableau[$i]['obligatoire']) ;
710
//		                         $tableau[$i]['limite2'], $tableau[$i]['defaut'], $tableau[$i]['table_source'], $tableau[$i]['obligatoire']) ;
682
			}
711
//			}
683
		 }	
712
//		 }	
684
	}
713
//	}
685
	//Bouton de validation du formulaire
714
	//Bouton de validation du formulaire
686
	$option=array('style'=>'border:1px solid #000;width:80px;font:12px Myriad, Arial, sans-serif;');
715
	$option=array('style'=>'border:1px solid #000;width:80px;font:12px Myriad, Arial, sans-serif;');
687
	$bouton[] = &HTML_QuickForm::createElement('submit', 'rechercher', BAZ_RECHERCHER, $option);
716
	$bouton[] = &HTML_QuickForm::createElement('submit', 'rechercher', BAZ_RECHERCHER, $option);
Line 694... Line 723...
694
	$case_coche = false ;
723
	$case_coche = false ;
695
	$requeteFrom = '' ;
724
	$requeteFrom = '' ;
696
	$requeteWhere = '' ;
725
	$requeteWhere = '' ;
697
	$requeteWhereListe = '' ;
726
	$requeteWhereListe = '' ;
Line 698... Line 727...
698
	
727
	
699
 	for ($i = 0; $i < count ($tableau); $i++) {
728
// 	for ($i = 0; $i < count ($tableau); $i++) {
700
		if ($tableau[$i]['type'] == 'checkbox' || $tableau[$i]['type'] == 'liste') {
729
//		if ($tableau[$i]['type'] == 'checkbox' || $tableau[$i]['type'] == 'liste') {
701
			$nom_liste = $tableau[$i]['type'].$tableau[$i]['nom_bdd'] ;
730
//			$nom_liste = $tableau[$i]['type'].$tableau[$i]['nom_bdd'] ;
702
			
731
//			
703
			if (is_array($_POST[$nom_liste])) {
732
//			if (is_array($_POST[$nom_liste])) {
704
				foreach ($_POST[$nom_liste] as $cle =>$valeur) {
-
 
705
					echo  $valeur ;
733
//				foreach ($_POST[$nom_liste] as $cle =>$valeur) {
706
					if ($valeur == 1) {
734
//					if ($valeur == 1) {
707
						$case_coche = true ;
735
//						$case_coche = true ;
708
						$requeteWhereListe .= ' AND bfvl_ce_liste='.$tableau[$i]['nom_bdd'] ; // Numéro de la liste
736
//						$requeteWhereListe .= ' AND bfvl_ce_liste='.$tableau[$i]['nom_bdd'] ; // Numéro de la liste
709
						
737
//						
710
					}
738
//					}
711
				}	
739
//				}	
712
			}
740
//			}
713
		}
741
//		}
714
	}
742
//	}
715
	if ($case_coche) {
743
//	if ($case_coche) {
716
		$requeteFrom = ', bazar_fiche_valeur_liste ' ;
744
//		$requeteFrom = ', bazar_fiche_valeur_liste ' ;
717
		$requeteWhereListe .= ' AND bfvl_valeur IN ()' ;
745
//		$requeteWhereListe .= ' AND bfvl_valeur IN ()' ;
718
		$requeteWhere = ' bfvl_ce_fiche=bf_id_fiche'.$requeteWhereListe;
746
//		$requeteWhere = ' bfvl_ce_fiche=bf_id_fiche'.$requeteWhereListe;
719
	}
747
//	}
720
	
748
//	
721
	//affichage des resultats de la recherche si le formulaire a ete envoye
749
	//affichage des resultats de la recherche si le formulaire a ete envoye
722
	$requeteSQL='';
750
	$requeteSQL='';
723
	if (isset($_REQUEST['recherche_effectuee'])) {
751
	if (isset($_REQUEST['recherche_effectuee'])) {
724
		//preparation de la requete pour trouver les mots cles
752
		//preparation de la requete pour trouver les mots cles