Subversion Repositories Applications.bazar

Rev

Rev 339 | Rev 346 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 339 Rev 342
Line 17... Line 17...
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.100 2007-11-30 14:17:31 jp_milcent Exp $
22
// CVS : $Id: bazar.fonct.rss.php,v 1.101 2007-12-03 15:18:44 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.100 $
31
*@version       $Revision: 1.101 $
32
// +------------------------------------------------------------------------------------------------------+
32
// +------------------------------------------------------------------------------------------------------+
33
*/
33
*/
Line 34... Line 34...
34
 
34
 
35
// +------------------------------------------------------------------------------------------------------+
35
// +------------------------------------------------------------------------------------------------------+
Line 160... Line 160...
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 *,bn_label_nature FROM bazar_fiche,bazar_nature WHERE bf_ce_nature=bn_id_nature and bf_id_fiche='.$GLOBALS['_BAZAR_']['id_fiche'];
165
	$requete = 'SELECT * FROM bazar_fiche,bazar_nature WHERE bf_ce_nature=bn_id_nature and bf_id_fiche='.$GLOBALS['_BAZAR_']['id_fiche'];
-
 
166
 
166
	if (isset($GLOBALS['_BAZAR_']['langue'])) $requete .= ' and bn_ce_i18n like "'.$GLOBALS['_BAZAR_']['langue'].'"';
167
	if (isset($GLOBALS['_BAZAR_']['langue'])) $requete .= ' and bn_ce_i18n like "'.$GLOBALS['_BAZAR_']['langue'].'"';
167
	$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
168
	$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
168
	(DB::isError($resultat)) ? die (BOG_afficherErreurSql(__FILE__, __LINE__, $resultat->getMessage(), $requete))
169
	(DB::isError($resultat)) ? die (BOG_afficherErreurSql(__FILE__, __LINE__, $resultat->getMessage(), $requete))
169
	    : '';
170
	    : '';
Line 176... Line 177...
176
	
177
	
177
	// Si on vient de l applette calendrier, $GLOBALS['_BAZAR_']['id_typeannonce'] est vide ...
178
	// Si on vient de l applette calendrier, $GLOBALS['_BAZAR_']['id_typeannonce'] est vide ...
178
	// mais on dispose de la constante BAZ_NUM_ANNONCE_CALENDRIER
179
	// mais on dispose de la constante BAZ_NUM_ANNONCE_CALENDRIER
Line 179... Line -...
179
	if (!isset($GLOBALS['_BAZAR_']['id_typeannonce']) && defined('BAZ_NUM_ANNONCE_CALENDRIER'))  $GLOBALS['_BAZAR_']['id_typeannonce'] = BAZ_NUM_ANNONCE_CALENDRIER;
-
 
180
	
-
 
181
	$requete='SELECT bn_id_nature, bn_template, bn_commentaire, bn_label_class,bn_label_nature FROM bazar_nature where 1';
-
 
182
	if ($GLOBALS['_BAZAR_']['id_typeannonce'] != 'toutes') $requete .= ' and bn_id_nature in ('.$GLOBALS['_BAZAR_']['id_typeannonce'].')';
-
 
183
	if (isset($GLOBALS['_BAZAR_']['langue'])) $requete .= ' and bn_ce_i18n like "'.$GLOBALS['_BAZAR_']['langue'].'"';
-
 
184
	$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
-
 
185
	if (DB::isError($resultat)) {
-
 
186
		return ($resultat->getMessage().$resultat->getDebugInfo()) ;
-
 
187
	}
-
 
188
	$result = $resultat->fetchRow(DB_FETCHMODE_ASSOC);
180
	if (!isset($GLOBALS['_BAZAR_']['id_typeannonce']) && defined('BAZ_NUM_ANNONCE_CALENDRIER'))  $GLOBALS['_BAZAR_']['id_typeannonce'] = BAZ_NUM_ANNONCE_CALENDRIER;
189
	$id_nature = $result['bn_id_nature'];
181
	
190
	if (!isset($GLOBALS['_BAZAR_']['template'])) $GLOBALS['_BAZAR_']['template'] = $result['bn_template'];
182
	if (!isset($GLOBALS['_BAZAR_']['template'])) $GLOBALS['_BAZAR_']['template'] = $ligne['bn_template'];
Line 191... Line 183...
191
	if (!isset($GLOBALS['_BAZAR_']['commentaire'])) $GLOBALS['_BAZAR_']['commentaire'] = $result['bn_commentaire'];
183
	if (!isset($GLOBALS['_BAZAR_']['commentaire'])) $GLOBALS['_BAZAR_']['commentaire'] = $ligne['bn_commentaire'];
192
	if (!isset($GLOBALS['_BAZAR_']['class'])) $GLOBALS['_BAZAR_']['class'] = $result['bn_label_class'];
184
	if (!isset($GLOBALS['_BAZAR_']['class'])) $GLOBALS['_BAZAR_']['class'] = $ligne['bn_label_class'];
193
	
185
	
194
	$utilisateur = new Administrateur_bazar ($GLOBALS['AUTH']);
186
	$utilisateur = new Administrateur_bazar ($GLOBALS['AUTH']);
Line 195... Line 187...
195
	if ($utilisateur->isAdmin($result['bn_id_nature']) || $utilisateur->isSuperAdmin()) {
187
	if ($utilisateur->isAdmin($ligne['bn_id_nature']) || $utilisateur->isSuperAdmin()) {
196
		 $est_admin=1;
188
		 $est_admin=1;
197
	}
189
	}
198
	
190
	
199
	//debut de la fiche
191
	//debut de la fiche
200
	$res .= '<div class="BAZ_cadre_fiche BAZ_cadre_fiche_'.$GLOBALS['_BAZAR_']['class'].'">'."\n";
192
	$res .= '<div class="BAZ_cadre_fiche BAZ_cadre_fiche_'.$GLOBALS['_BAZAR_']['class'].'">'."\n";
201
	//affiche le titre sous forme d'image
193
	//affiche le titre sous forme d'image
202
	if (isset ($GLOBALS['_BAZAR_']['image_titre']) && $GLOBALS['_BAZAR_']['image_titre']!='') {
194
	if (isset ($GLOBALS['_BAZAR_']['image_titre']) && $GLOBALS['_BAZAR_']['image_titre']!='') {
203
		$res .= '<img class="BAZ_img_titre" src="client/bazar/images/'.$GLOBALS['_BAZAR_']['image_titre'].'" alt="'.$result['bn_label_nature'].'" />'.'<br />'."\n";
195
		$res .= '<img class="BAZ_img_titre" src="client/bazar/images/'.$GLOBALS['_BAZAR_']['image_titre'].'" alt="'.$ligne['bn_label_nature'].'" />'.'<br />'."\n";
204
	}
196
	}
205
	//affiche le texte sinon
197
	//affiche le texte sinon
206
	else {
198
	else {
207
		$res .= '<h2 class="BAZ_titre BAZ_titre_'.$GLOBALS['_BAZAR_']['class'].'">'.$result['bn_label_nature'].'</h2>'."\n";
199
		$res .= '<h2 class="BAZ_titre BAZ_titre_'.$GLOBALS['_BAZAR_']['class'].'">'.$ligne['bn_label_nature'].'</h2>'."\n";
208
	}
200
	}
Line 402... Line 394...
402
		}
394
		}
403
		$res .= '</div>'."\n";
395
		$res .= '</div>'."\n";
404
		$res .= '</div>'."\n";
396
		$res .= '</div>'."\n";
405
	}
397
	}
Line 406... Line 398...
406
 
398
 
-
 
399
	// Nous vérifions comment est appelé la fonction
407
	// ATTENTION : vérifier que le div ci-dessous est bien inutile dans tous les cas! Il n'y a pas dans cette fonction de div ouvrant correspondant.
400
	if ($danslappli == 0) {
-
 
401
	 $res .= '</div>'."\n";
Line 408... Line 402...
408
	// $res .= '</div>'."\n";
402
	} else if ($danslappli == 1 ) {
409
	
403
 
410
	//on ajoute les appropriations, s'il le faut
404
		// Ajout des appropriations, s'il le faut
411
	if (($danslappli==1)and($GLOBALS['_BAZAR_']['appropriation']==1)) {
405
		if ($GLOBALS['_BAZAR_']['appropriation'] == 1) {
412
		$res .= '<br />'."\n".'<div class="BAZ_cadre_fiche BAZ_cadre_fiche_'.$GLOBALS['_BAZAR_']['class'].'">'."\n";
406
			$res .= '<br />'."\n".'<div class="BAZ_cadre_fiche BAZ_cadre_fiche_'.$GLOBALS['_BAZAR_']['class'].'">'."\n";
413
		$res .= '<h2 class="BAZ_titre BAZ_titre_'.$GLOBALS['_BAZAR_']['class'].'">'.BAZ_LES_STRUCTURES_POSSEDANT_UNE_RESSOURCE.'</h2>'."\n";		
407
			$res .= '<h2 class="BAZ_titre BAZ_titre_'.$GLOBALS['_BAZAR_']['class'].'">'.BAZ_LES_STRUCTURES_POSSEDANT_UNE_RESSOURCE.'</h2>'."\n";		
414
		$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';
408
			$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';
415
		$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
409
			$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
416
		if (DB::isError ($resultat)) {
410
			if (DB::isError ($resultat)) {
417
			die ($resultat->getMessage().'<br />'.$resultat->getDebugInfo()) ;
411
				return $resultat->getMessage().'<br />'.$resultat->getDebugInfo();
418
		}
412
			}
419
		$possede_ressource=0;
413
			$possede_ressource=0;
420
		if ($resultat->numRows()>0) {
414
			if ($resultat->numRows()>0) {
Line 451... Line 445...
451
		}
445
			}
452
		$res .='</p>'."\n";
446
			$res .='</p>'."\n";
453
		$res .= '</div>'."\n";
447
			$res .= '</div>'."\n";
454
	}
448
		}
Line 455... Line 449...
455
	
449
		
456
	//on ajoute les commentaires, s'il le faut
450
		// Ajout des commentaires, s'il le faut
457
	if (($danslappli==1)and($GLOBALS['_BAZAR_']['commentaire']==1)) {
451
		if ($GLOBALS['_BAZAR_']['commentaire'] == 1) {
458
		$res .= '<br />'."\n".'<div class="BAZ_cadre_fiche BAZ_cadre_fiche_'.$GLOBALS['_BAZAR_']['class'].'">'."\n";
452
			$res .= '<br />'."\n".'<div class="BAZ_cadre_fiche BAZ_cadre_fiche_'.$GLOBALS['_BAZAR_']['class'].'">'."\n";
459
		$res .= '<h2 class="BAZ_titre BAZ_titre_'.$GLOBALS['_BAZAR_']['class'].'">'.BAZ_LES_COMMENTAIRES.'</h2>'."\n";
453
			$res .= '<h2 class="BAZ_titre BAZ_titre_'.$GLOBALS['_BAZAR_']['class'].'">'.BAZ_LES_COMMENTAIRES.'</h2>'."\n";
460
		$requete = 'SELECT * FROM bazar_commentaires WHERE bc_ce_id_fiche='.$GLOBALS['_BAZAR_']['id_fiche'].' ORDER BY bc_date ASC';
454
			$requete = 'SELECT * FROM bazar_commentaires WHERE bc_ce_id_fiche='.$GLOBALS['_BAZAR_']['id_fiche'].' ORDER BY bc_date ASC';
461
		$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
455
			$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
462
		if (DB::isError ($resultat)) {
456
			if (DB::isError ($resultat)) {
463
			die ($resultat->getMessage().'<br />'.$resultat->getDebugInfo()) ;
457
				return $resultat->getMessage().'<br />'.$resultat->getDebugInfo();
464
		}
458
			}
465
		if ($resultat->numRows()>0) {
459
			if ($resultat->numRows()>0) {
466
			$res .= BAZ_IL_Y_A.$resultat->numRows().' ';
460
				$res .= BAZ_IL_Y_A.$resultat->numRows().' ';
467
			if ($resultat->numRows()==1) $res .= BAZ_COMMENTAIRE.'<br />'."\n";
461
				if ($resultat->numRows()==1) $res .= BAZ_COMMENTAIRE.'<br />'."\n";
Line 505... Line 499...
505
		$form_commentaire->addRule('Commentaire', BAZ_COMMENTAIRE_REQUIS, 'required', '', 'client') ;
499
			$form_commentaire->addRule('Commentaire', BAZ_COMMENTAIRE_REQUIS, 'required', '', 'client') ;
506
		$form_commentaire->setRequiredNote(BAZ_CHAMPS_REQUIS) ;
500
			$form_commentaire->setRequiredNote(BAZ_CHAMPS_REQUIS) ;
507
		$res .= $form_commentaire->toHTML();
501
			$res .= $form_commentaire->toHTML();
508
		$res .= '</div>'."\n";
502
			$res .= '</div>'."\n";
509
	}
503
		}
-
 
504
	}
Line 510... Line 505...
510
	
505
	
511
	// Nettoyage de l'url
506
	// Nettoyage de l'url
512
	$GLOBALS['_BAZAR_']['url']->removeQueryString('action');
507
	$GLOBALS['_BAZAR_']['url']->removeQueryString('action');
513
	$GLOBALS['_BAZAR_']['url']->removeQueryString('id_fiche');
508
	$GLOBALS['_BAZAR_']['url']->removeQueryString('id_fiche');
Line 1247... Line 1242...
1247
}
1242
}
Line 1248... Line 1243...
1248
 
1243
 
1249
/* +--Fin du code ----------------------------------------------------------------------------------------+
1244
/* +--Fin du code ----------------------------------------------------------------------------------------+
1250
*
1245
*
-
 
1246
* $Log: not supported by cvs2svn $
-
 
1247
* Revision 1.99.2.3  2007-12-03 15:16:21  jp_milcent
-
 
1248
* Correction problème de la div mystère!
-
 
1249
*
-
 
1250
* Revision 1.99.2.2  2007-11-30 15:02:50  alexandre_tb
-
 
1251
* simplification du code et correction du bug (les fiches de la carto n affichent pas la bonne nature
-
 
1252
*
-
 
1253
* Revision 1.100  2007-11-30 14:17:31  jp_milcent
-
 
1254
* Fusion avec la livraison AHA : 30 novembre 2007
1251
* $Log: not supported by cvs2svn $
1255
*
1252
* Revision 1.99.2.1  2007-11-30 14:14:36  jp_milcent
1256
* Revision 1.99.2.1  2007-11-30 14:14:36  jp_milcent
1253
* Ajout d'un décodage des apostrophes de type RIGHT SINGLE QUOTATION MARK.
1257
* Ajout d'un décodage des apostrophes de type RIGHT SINGLE QUOTATION MARK.
1254
*
1258
*
1255
* Revision 1.99  2007-11-05 10:17:19  alexandre_tb
1259
* Revision 1.99  2007-11-05 10:17:19  alexandre_tb