Subversion Repositories Applications.bazar

Rev

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

Rev 61 Rev 64
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.php,v 1.25 2005-12-20 14:49:35 ddelon Exp $
22
// CVS : $Id: bazar.fonct.php,v 1.26 2006-01-03 10:19:31 florian Exp $
23
/**
23
/**
24
*
24
*
25
* Fonctions du module bazar
25
* Fonctions du module bazar
26
* 
26
* 
27
*
27
*
Line 29... Line 29...
29
//Auteur original :
29
//Auteur original :
30
*@author        Alexandre Granier <alexandre@tela-botanica.org>
30
*@author        Alexandre Granier <alexandre@tela-botanica.org>
31
*@author        Florian Schmitt <florian@ecole-et-nature.org>
31
*@author        Florian Schmitt <florian@ecole-et-nature.org>
32
//Autres auteurs :
32
//Autres auteurs :
33
*@copyright     Tela-Botanica 2000-2004
33
*@copyright     Tela-Botanica 2000-2004
34
*@version       $Revision: 1.25 $ $Date: 2005-12-20 14:49:35 $
34
*@version       $Revision: 1.26 $ $Date: 2006-01-03 10:19:31 $
35
// +------------------------------------------------------------------------------------------------------+
35
// +------------------------------------------------------------------------------------------------------+
36
*/
36
*/
Line 37... Line 37...
37
 
37
 
38
// +------------------------------------------------------------------------------------------------------+
38
// +------------------------------------------------------------------------------------------------------+
Line 79... Line 79...
79
* @return   string  HTML
79
* @return   string  HTML
80
*/
80
*/
81
function fiches_a_valider() {
81
function fiches_a_valider() {
82
	// Pour les administrateurs d'une rubrique, on affiche les fiches a valider de cette rubrique
82
	// Pour les administrateurs d'une rubrique, on affiche les fiches a valider de cette rubrique
83
	// On effectue une requete sur le bazar pour voir les fiches a administrer
83
	// On effectue une requete sur le bazar pour voir les fiches a administrer
84
	$res= '<h2>'.BAZ_ANNONCES_A_ADMINISTRER.'</h2>';
84
	$res= '<h2>'.BAZ_ANNONCES_A_ADMINISTRER.'</h2><br />'."\n";
85
	$requete = 'SELECT * FROM bazar_fiche, bazar_nature WHERE bf_statut_fiche=0 AND bn_id_nature=bf_ce_nature AND bn_ce_id_menu='.$GLOBALS['_GEN_commun']['info_menu']->gm_id_menu.' or  bn_ce_id_menu=0 ORDER BY bf_date_maj_fiche DESC' ;
85
	$requete = 'SELECT * FROM bazar_fiche, bazar_nature WHERE bf_statut_fiche=0 AND bn_id_nature=bf_ce_nature AND bn_ce_id_menu='.$GLOBALS['_BAZAR_']['categorie_nature'].' ORDER BY bf_date_maj_fiche DESC' ;
86
	$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
86
	$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
87
	if (DB::isError($resultat)) {
87
	if (DB::isError($resultat)) {
88
		die ('Echec de la requete<br />'.$resultat->getMessage().'<br />'.$resultat->getDebugInfo()) ;
88
		die ('Echec de la requete<br />'.$resultat->getMessage().'<br />'.$resultat->getDebugInfo()) ;
89
	}
89
	}
90
	if ($resultat->numRows() != 0) {
90
	if ($resultat->numRows() != 0) {
Line 106... Line 106...
106
				$annonceur=$lignenomprenom[BAZ_CHAMPS_PRENOM]." ".$lignenomprenom[BAZ_CHAMPS_NOM];
106
				$annonceur=$lignenomprenom[BAZ_CHAMPS_PRENOM]." ".$lignenomprenom[BAZ_CHAMPS_NOM];
107
			}
107
			}
108
			$lien_voir=$GLOBALS['_BAZAR_']['url'];
108
			$lien_voir=$GLOBALS['_BAZAR_']['url'];
109
			$lien_voir->addQueryString('action', BAZ_VOIR_FICHE);
109
			$lien_voir->addQueryString('action', BAZ_VOIR_FICHE);
110
			$lien_voir->addQueryString('id_fiche', $ligne['bf_id_fiche']);
110
			$lien_voir->addQueryString('id_fiche', $ligne['bf_id_fiche']);
111
			$lien_voir->addQueryString('typeannonce', $ligne['bn_label_nature']);
111
			$lien_voir->addQueryString('typeannonce', $ligne['bn_id_nature']);
Line 112... Line 112...
112
			
112
			
113
			$lien_publie_oui=$GLOBALS['_BAZAR_']['url'];
113
			$lien_publie_oui=$GLOBALS['_BAZAR_']['url'];
114
			$lien_publie_oui->addQueryString('action', BAZ_ACTION_PUBLIER);
114
			$lien_publie_oui->addQueryString('action', BAZ_ACTION_PUBLIER);
115
			$lien_publie_oui->addQueryString('id_fiche', $ligne['bf_id_fiche']);
115
			$lien_publie_oui->addQueryString('id_fiche', $ligne['bf_id_fiche']);
Line 116... Line 116...
116
			$lien_publie_oui->addQueryString('typeannonce', $ligne['bn_label_nature']);
116
			$lien_publie_oui->addQueryString('typeannonce', $ligne['bn_id_nature']);
117
			
117
			
118
			$lien_publie_non=$GLOBALS['_BAZAR_']['url'];
118
			$lien_publie_non=$GLOBALS['_BAZAR_']['url'];
119
			$lien_publie_non->addQueryString('action', BAZ_ACTION_PAS_PUBLIER);
119
			$lien_publie_non->addQueryString('action', BAZ_ACTION_PAS_PUBLIER);
Line 120... Line 120...
120
			$lien_publie_non->addQueryString('id_fiche', $ligne['bf_id_fiche']);
120
			$lien_publie_non->addQueryString('id_fiche', $ligne['bf_id_fiche']);
121
			$lien_publie_non->addQueryString('typeannonce', $ligne['bn_label_nature']);
121
			$lien_publie_non->addQueryString('typeannonce', $ligne['bn_id_nature']);
122
			
122
			
123
			$lien_supprimer=$GLOBALS['_BAZAR_']['url'];
123
			$lien_supprimer=$GLOBALS['_BAZAR_']['url'];
Line 124... Line 124...
124
			$lien_supprimer->addQueryString('action', BAZ_ACTION_SUPPRESSION);
124
			$lien_supprimer->addQueryString('action', BAZ_ACTION_SUPPRESSION);
125
			$lien_supprimer->addQueryString('id_fiche', $ligne['bf_id_fiche']);
125
			$lien_supprimer->addQueryString('id_fiche', $ligne['bf_id_fiche']);
126
			$lien_supprimer->addQueryString('typeannonce', $ligne['bn_label_nature']);
126
			$lien_supprimer->addQueryString('typeannonce', $ligne['bn_id_nature']);
127
			
127
			
128
			$table->addRow (array(
128
			$table->addRow (array(
129
			                '<a href="'.$lien_voir->getURL().'">'.$ligne['bf_titre'].'</a>'."\n", // col 1 : le nom 
129
			                '<a href="'.$lien_voir->getURL().'">'.$ligne['bf_titre'].'</a>'."\n", // col 1 : le nom 
130
					$annonceur."\n", // col 2 : annonceur
130
					$annonceur."\n", // col 2 : annonceur
131
					$ligne['bn_label_nature']."\n", // col 3 : type annonce
131
					constant($ligne['bn_label_nature'])."\n", // col 3 : type annonce
Line 154... Line 154...
154
*
154
*
155
* @return   string  HTML
155
* @return   string  HTML
156
*/
156
*/
157
function mes_fiches() {
157
function mes_fiches() {
158
	if ($GLOBALS['AUTH']->getAuth()) {
158
	if ($GLOBALS['AUTH']->getAuth()) {
159
		$res= '<h2>'.BAZ_VOS_ANNONCES.'</h2>'."\n";
159
		$res= '<h2>'.BAZ_VOS_ANNONCES.'</h2><br />'."\n";
160
		// requête pour voir si l'utilisateur a des fiches à son nom, classées par date de MAJ et nature d'annonce
160
		// requete pour voir si l'utilisateur a des fiches à son nom, classées par date de MAJ et nature d'annonce
161
		$requete = 'SELECT * FROM bazar_fiche, bazar_nature WHERE bf_ce_utilisateur='. $GLOBALS['id_user'].
161
		$requete = 'SELECT * FROM bazar_fiche, bazar_nature WHERE bf_ce_utilisateur='. $GLOBALS['id_user'].
162
		           ' AND bn_id_nature=bf_ce_nature AND bn_ce_id_menu='.$GLOBALS['_GEN_commun']['info_menu']->gm_id_menu.' or  bn_ce_id_menu=0 ORDER BY bf_date_maj_fiche DESC,bf_ce_nature ASC';
162
		           ' AND bn_id_nature=bf_ce_nature AND bn_ce_id_menu='.$GLOBALS['_BAZAR_']['categorie_nature'].' ORDER BY bf_date_maj_fiche DESC,bf_ce_nature ASC';
163
		$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
163
		$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
164
		if (DB::isError($resultat)) {
164
		if (DB::isError($resultat)) {
165
			die ('Echec de la requete<br />'.$resultat->getMessage().'<br />'.$resultat->getDebugInfo()) ;
165
			die ('Echec de la requete<br />'.$resultat->getMessage().'<br />'.$resultat->getDebugInfo()) ;
166
		}
166
		}
167
		if ($resultat->numRows() != 0) {
167
		if ($resultat->numRows() != 0) {
Line 178... Line 178...
178
			else $publiee=BAZ_REJETEE;
178
			else $publiee=BAZ_REJETEE;
Line 179... Line 179...
179
			
179
			
180
			$lien_voir=$GLOBALS['_BAZAR_']['url'];
180
			$lien_voir=$GLOBALS['_BAZAR_']['url'];
181
			$lien_voir->addQueryString('action', BAZ_VOIR_FICHE);
181
			$lien_voir->addQueryString('action', BAZ_VOIR_FICHE);
182
			$lien_voir->addQueryString('id_fiche', $ligne['bf_id_fiche']);
182
			$lien_voir->addQueryString('id_fiche', $ligne['bf_id_fiche']);
183
			$lien_voir->addQueryString('typeannonce', $ligne['bn_label_nature']);
183
			$lien_voir->addQueryString('typeannonce', $ligne['bn_id_nature']);
Line 184... Line 184...
184
			$lien_voir_url=$lien_voir->getURL();
184
			$lien_voir_url=$lien_voir->getURL();
185
			
185
			
186
			$lien_modifier=$GLOBALS['_BAZAR_']['url'];
186
			$lien_modifier=$GLOBALS['_BAZAR_']['url'];
187
			$lien_modifier->addQueryString('action', BAZ_ACTION_MODIFIER);
187
			$lien_modifier->addQueryString('action', BAZ_ACTION_MODIFIER);
188
			$lien_modifier->addQueryString('id_fiche', $ligne['bf_id_fiche']);
188
			$lien_modifier->addQueryString('id_fiche', $ligne['bf_id_fiche']);
Line 189... Line 189...
189
			$lien_modifier->addQueryString('typeannonce', $ligne['bn_label_nature']);
189
			$lien_modifier->addQueryString('typeannonce', $ligne['bn_id_nature']);
190
			$lien_modifier_url=$lien_modifier->getURL();
190
			$lien_modifier_url=$lien_modifier->getURL();
191
			
191
			
192
			$lien_supprimer=$GLOBALS['_BAZAR_']['url'];
192
			$lien_supprimer=$GLOBALS['_BAZAR_']['url'];
193
			$lien_supprimer->addQueryString('action', BAZ_ACTION_SUPPRESSION);
193
			$lien_supprimer->addQueryString('action', BAZ_ACTION_SUPPRESSION);
Line 194... Line 194...
194
			$lien_supprimer->addQueryString('id_fiche', $ligne['bf_id_fiche']);
194
			$lien_supprimer->addQueryString('id_fiche', $ligne['bf_id_fiche']);
195
			$lien_supprimer->addQueryString('typeannonce', $ligne['bn_label_nature']);
195
			$lien_supprimer->addQueryString('typeannonce', $ligne['bn_id_nature']);
196
			$lien_supprimer_url=$lien_supprimer->getURL();
196
			$lien_supprimer_url=$lien_supprimer->getURL();
197
			
197
			
198
			$table->addRow (array(
198
			$table->addRow (array(
199
			                '<a href="'.$lien_voir_url.'">'.$ligne['bf_titre'].'</a>'."\n", // col 1 : le nom
199
			                '<a href="'.$lien_voir_url.'">'.$ligne['bf_titre'].'</a>'."\n", // col 1 : le nom
200
					$ligne['bn_label_nature']."\n", // col 2: type annonce
200
					constant($ligne['bn_label_nature'])."\n", // col 2: type annonce
201
					$publiee."\n", // col 3 : publiee ou non
201
					$publiee."\n", // col 3 : publiee ou non
Line 212... Line 212...
212
		}
212
		}
213
	    else {
213
	    else {
214
	    	$res .= BAZ_PAS_DE_FICHE ;
214
	    	$res .= BAZ_PAS_DE_FICHE ;
215
	    }
215
	    }
216
	}
216
	}
217
	else $res=BAZ_IDENTIFIEZ_VOUS_POUR_SAISIR;;
217
	else $res=BAZ_IDENTIFIEZ_VOUS_POUR_SAISIR;
218
	return $res;
218
	return $res;
219
}
219
}
Line 220... Line 220...
220
 
220
 
Line 309... Line 309...
309
		//------------------------------------------------------------------------------------------------
309
		//------------------------------------------------------------------------------------------------
310
		if ($mode == BAZ_DEPOSER_ANNONCE) {
310
		if ($mode == BAZ_DEPOSER_ANNONCE) {
311
			$res = '';
311
			$res = '';
Line 312... Line 312...
312
		
312
		
313
			//requete pour obtenir le nom et la description des types d'annonce
313
			//requete pour obtenir le nom et la description des types d'annonce
314
			$requete = "SELECT bn_id_nature, bn_label_nature, bn_description, bn_condition ".
314
			$requete = "SELECT bn_id_nature, bn_label_nature, bn_description, bn_condition, bn_image_titre ".
315
						"FROM bazar_nature WHERE bn_ce_id_menu=".$GLOBALS['_GEN_commun']['info_menu']->gm_id_menu.
315
						"FROM bazar_nature WHERE bn_ce_id_menu=".$GLOBALS['_GEN_commun']['info_menu']->gm_id_menu.
316
						" or  bn_ce_id_menu=0 ORDER BY bn_label_nature ASC";
316
						" or  bn_ce_id_menu=0 ORDER BY bn_label_nature ASC";
317
			$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
317
			$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
318
			if (DB::isError($resultat)) {
318
			if (DB::isError($resultat)) {
319
				die ($resultat->getMessage().$resultat->getDebugInfo()) ;
319
				die ($resultat->getMessage().$resultat->getDebugInfo()) ;
320
			}
320
			}
321
			$res.="<h2>".BAZ_DEPOSE_UNE_NOUVELLE_ANNONCE.'</h2>'."\n";
321
			$res.="<h2>".BAZ_DEPOSE_UNE_NOUVELLE_ANNONCE.'</h2>'."\n";
322
			$res.=BAZ_CHOIX_TYPEANNONCE.'<br />';
322
			$res.='<br />'.BAZ_CHOIX_TYPEANNONCE.'<br /><br />'."\n";
323
			while ($ligne = $resultat->fetchRow (DB_FETCHMODE_ASSOC)) {
323
			while ($ligne = $resultat->fetchRow (DB_FETCHMODE_ASSOC)) {
324
				$droitspers=niveau_droit($ligne["bn_id_nature"],$GLOBALS["id_user"]);
324
				$droitspers=niveau_droit($ligne["bn_id_nature"],$GLOBALS["id_user"]);
-
 
325
				if (($droitspers=='redacteur') or ($droitspers=='administrateur') or ($droitspers=='superadministrateur' or !BAZ_RESTREINDRE_DEPOT)) {
325
				if (($droitspers=='redacteur') or ($droitspers=='administrateur') or ($droitspers=='superadministrateur' or !BAZ_RESTREINDRE_DEPOT)) {
326
					if (isset($ligne['bn_image_titre'])) {$titre='&nbsp;<img src="client/bazar/images/'.$ligne['bn_image_titre'].'" alt="'.constant($ligne['bn_label_nature']).'" />'.'<br />'."\n";}
326
					$formtemplate->addElement('radio', 'typeannonce', '', '<strong>'.$ligne['bn_label_nature'].
327
					else {$titre='<strong>'.constant($ligne['bn_label_nature']).' : </strong><br />'."\n";}
327
				           ':</strong><br />'.$ligne['bn_description'], $ligne['bn_label_nature'], array("id" => 'select'.$ligne['bn_id_nature'], "style" => 'float:left;'));
328
					$formtemplate->addElement('radio', 'typeannonce', '', $titre.$ligne['bn_description'].'<br /><br />'."\n", $ligne['bn_id_nature'], array("id" => 'select'.$ligne['bn_id_nature'], "style" => 'float:left;'));
328
				}		
329
				}		
329
			}
330
			}
Line 330... Line 331...
330
			$squelette->setElementTemplate( '<div class="listechoix">'."\n".'{element}'."\n".'</div>'."\n");
331
			$squelette->setElementTemplate( '<div class="listechoix">'."\n".'{element}'."\n".'</div>'."\n");
331
		
332
		
Line 332... Line 333...
332
			//Mettre les annonces en choix par defaut
333
			//Mettre les annonces en choix par defaut
333
			$formtemplate->setdefaults(array('typeannonce'=>'Annonces'));
334
			$formtemplate->setdefaults(array('typeannonce'=>'1'));
Line 334... Line 335...
334
		
335
		
335
			//Bouton de validation du formulaire
336
			//Bouton de validation du formulaire
336
			$formtemplate->addElement('submit', 'valider', BAZ_VALIDER);
337
			$formtemplate->addElement('submit', 'valider', BAZ_VALIDER);
Line 337... Line 338...
337
		
338
		
338
			//Affichage a l'ecran
339
			//Affichage a l'ecran
339
			$res.= $formtemplate->toHTML() ;
340
			$res.= $formtemplate->toHTML()."\n".'<br />'."\n".mes_fiches(); ;
Line 426... Line 427...
426
						die ($resultat->getMessage().$resultat->getDebugInfo()) ;
427
						die ($resultat->getMessage().$resultat->getDebugInfo()) ;
427
					}
428
					}
428
				}
429
				}
429
			}
430
			}
Line 430... Line 431...
430
			
431
			
431
			//requete pour obtenir l'id, le nom et prénom des personnes inscrites à l'annuaire sauf soi même
432
			//requete pour obtenir l'id, le nom et prenom des personnes inscrites a l'annuaire sauf soi meme
432
			$requete = 'SELECT '.BAZ_CHAMPS_ID.', '.BAZ_CHAMPS_NOM.', '.BAZ_CHAMPS_PRENOM.' FROM '.BAZ_ANNUAIRE.
433
			$requete = 'SELECT '.BAZ_CHAMPS_ID.', '.BAZ_CHAMPS_NOM.', '.BAZ_CHAMPS_PRENOM.' FROM '.BAZ_ANNUAIRE.
433
				   ' WHERE '.BAZ_CHAMPS_ID."!=".$GLOBALS['id_user'].' ORDER BY '.BAZ_CHAMPS_NOM.' ASC';
434
				   ' WHERE '.BAZ_CHAMPS_ID."!=".$GLOBALS['id_user'].' ORDER BY '.BAZ_CHAMPS_NOM.' ASC';
434
			$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
435
			$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
435
			if (DB::isError($resultat)) {
436
			if (DB::isError($resultat)) {
436
				die ($resultat->getMessage().$resultat->getDebugInfo()) ;
437
				die ($resultat->getMessage().$resultat->getDebugInfo()) ;
437
			}
438
			}
438
			$res='<h2>'.BAZ_GESTION_DES_DROITS.'</h2>'."\n";
439
			$res='<h2>'.BAZ_GESTION_DES_DROITS.'</h2><br />'."\n";
439
			$res.=BAZ_DESCRIPTION_GESTION_DES_DROITS.'<br /><br />';
440
			$res.=BAZ_DESCRIPTION_GESTION_DES_DROITS.'<br /><br />'."\n";
440
			$personnes_select[0]=BAZ_SELECTION;
441
			$personnes_select[0]=BAZ_SELECTION;
441
			while ($ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
442
			while ($ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
442
				$personnes_select[$ligne[BAZ_CHAMPS_ID]] = $ligne[BAZ_CHAMPS_NOM]." ".$ligne[BAZ_CHAMPS_PRENOM] ;
443
				$personnes_select[$ligne[BAZ_CHAMPS_ID]] = $ligne[BAZ_CHAMPS_NOM]." ".$ligne[BAZ_CHAMPS_PRENOM] ;
443
			}
444
			}
444
			$java=array ('onchange'=>'this.form.submit();');
445
			$java=array ('style'=>'width:250px;','onchange'=>'this.form.submit();');
445
			$formtemplate->addElement ('select', 'personnes', BAZ_LABEL_CHOIX_PERSONNE, $personnes_select, $java) ;
446
			$formtemplate->addElement ('select', 'personnes', BAZ_LABEL_CHOIX_PERSONNE, $personnes_select, $java) ;
446
			$defauts=array ('personnes'=>$personne);
447
			$defauts=array ('personnes'=>$personne);
447
			$formtemplate->setDefaults($defauts);
448
			$formtemplate->setDefaults($defauts);
448
			$res.= $formtemplate->toHTML() ;
-
 
449
			
-
 
450
			
449
			$res.= $formtemplate->toHTML().'<br />'."\n" ;
451
			
450
				
452
			if ($personne!=0) {
451
			if ($personne!=0) {
453
				//cas du super utilisateur
452
				//cas du super utilisateur
454
				if (niveau_droit(0,$personne)=='superadministrateur') {
453
				if (niveau_droit(0,$personne)=='superadministrateur') {
455
					$res.= '<br />'.BAZ_EST_SUPERADMINISTRATEUR.'<br /><br />'."\n";
454
					$res.= '<br />'.BAZ_EST_SUPERADMINISTRATEUR.'<br /><br />'."\n";
Line 464... Line 463...
464
					$lien_passer_superadmin->addQueryString('action', BAZ_GERER_DROITS);
463
					$lien_passer_superadmin->addQueryString('action', BAZ_GERER_DROITS);
465
					$lien_passer_superadmin->addQueryString('pers', $personne);
464
					$lien_passer_superadmin->addQueryString('pers', $personne);
466
					$lien_passer_superadmin->addQueryString('droits', 'superadmin');
465
					$lien_passer_superadmin->addQueryString('droits', 'superadmin');
467
					$res.= '<a href='.$lien_passer_superadmin->getURL().'>'.BAZ_PASSER_SUPERADMINISTRATEUR.'</a><br />'."\n";
466
					$res.= '<a href='.$lien_passer_superadmin->getURL().'>'.BAZ_PASSER_SUPERADMINISTRATEUR.'</a><br />'."\n";
Line 468... Line 467...
468
					
467
					
469
					//on cherche les différentes rubriques d'annonces
468
					//on cherche les differentes rubriques d'annonces
470
					$requete = 'SELECT bn_id_nature, bn_label_nature FROM bazar_nature WHERE bn_ce_id_menu='.$GLOBALS['_GEN_commun']['info_menu']->gm_id_menu .' or  bn_ce_id_menu=0';
469
					$requete = 'SELECT bn_id_nature, bn_label_nature, bn_image_titre FROM bazar_nature WHERE bn_ce_id_menu='.$GLOBALS['_GEN_commun']['info_menu']->gm_id_menu .' or  bn_ce_id_menu=0';
471
					$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
470
					$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
472
					if (DB::isError($resultat)) {
471
					if (DB::isError($resultat)) {
473
						die ($resultat->getMessage().$resultat->getDebugInfo()) ;
472
						die ($resultat->getMessage().$resultat->getDebugInfo()) ;
474
					}
473
					}
Line 475... Line 474...
475
					$res.='<br /><b>'.BAZ_DROITS_PAR_TYPE.'</b><br /><br />';
474
					$res.='<br /><b>'.BAZ_DROITS_PAR_TYPE.'</b><br /><br />';
476
					
475
					
477
					$table = new HTML_Table(array ('width' => '100%', 'class' => 'table_bazar')) ;
476
					$table = new HTML_Table(array ('width' => '100%', 'class' => 'table_bazar')) ;
478
					$table->addRow(array ('<b>'.BAZ_TYPE_ANNONCES.'</b>',
477
					$table->addRow(array ('<strong>'.BAZ_TYPE_ANNONCES.'</strong>',
479
					                      '<b>'.BAZ_DROITS_ACTUELS.'</b>',
478
					                      '<strong>'.BAZ_DROITS_ACTUELS.'</strong>',
480
							      '<b>'.BAZ_PASSER_EN.'</b>',
479
							      '<strong>'.BAZ_PASSER_EN.'</strong>',
Line 481... Line 480...
481
							      '<b>'.BAZ_OU_PASSER_EN.'</b>')) ;
480
							      '<strong>'.BAZ_OU_PASSER_EN.'</strong>')) ;
482
					$table->setRowType (0, 'th') ;
481
					$table->setRowType (0, 'th') ;
Line 499... Line 498...
499
						$lien_passer_admin=$GLOBALS['_BAZAR_']['url'];
498
						$lien_passer_admin=$GLOBALS['_BAZAR_']['url'];
500
						$lien_passer_admin->addQueryString('action', BAZ_GERER_DROITS);
499
						$lien_passer_admin->addQueryString('action', BAZ_GERER_DROITS);
501
						$lien_passer_admin->addQueryString('pers', $personne);
500
						$lien_passer_admin->addQueryString('pers', $personne);
502
						$lien_passer_admin->addQueryString('droits', 'admin');
501
						$lien_passer_admin->addQueryString('droits', 'admin');
503
						$lien_passer_admin->addQueryString('idtypeannonce', $ligne["bn_id_nature"]);
502
						$lien_passer_admin->addQueryString('idtypeannonce', $ligne["bn_id_nature"]);
504
						
-
 
-
 
503
						if (isset($ligne['bn_image_titre'])) {$titre='&nbsp;<img src="client/bazar/images/'.$ligne['bn_image_titre'].'" alt="'.constant($ligne['bn_label_nature']).'" />'."\n";}
-
 
504
						else {$titre='<strong>&nbsp;'.constant($ligne['bn_label_nature']).'</strong>'."\n";}
505
						if ($droits=='aucun') {
505
						if ($droits=='aucun') {
506
							$table->addRow(array('<b>'.$ligne['bn_label_nature'].'</b>',
506
							$table->addRow(array($titre,
507
							                     BAZ_AUCUN_DROIT,
507
							                     BAZ_AUCUN_DROIT,
508
							                     '<a href='.$lien_passer_redacteur->getURL().'>'.BAZ_DROIT_REDACTEUR.'</a>',
508
							                     '<a href='.$lien_passer_redacteur->getURL().'>'.BAZ_DROIT_REDACTEUR.'</a>',
509
									     '<a href='.$lien_passer_admin->getURL().'>'.BAZ_DROIT_ADMIN.'</a>'));
509
									     '<a href='.$lien_passer_admin->getURL().'>'.BAZ_DROIT_ADMIN.'</a>'));
510
						}
510
						}
511
						elseif ($droits=='redacteur') {
511
						elseif ($droits=='redacteur') {
512
							$table->addRow(array('<b>'.$ligne['bn_label_nature'].'</b>',
512
							$table->addRow(array($titre,
513
							                     BAZ_DROIT_REDACTEUR,
513
							                     BAZ_DROIT_REDACTEUR,
514
							                     '<a href='.$lien_aucun_droit->getURL().'>'.BAZ_AUCUN_DROIT.'</a>',
514
							                     '<a href='.$lien_aucun_droit->getURL().'>'.BAZ_AUCUN_DROIT.'</a>',
515
									     '<a href='.$lien_passer_admin->getURL().'>'.BAZ_DROIT_ADMIN.'</a>'));
515
									     '<a href='.$lien_passer_admin->getURL().'>'.BAZ_DROIT_ADMIN.'</a>'));
516
						}
516
						}
517
						else {
517
						else {
518
							$table->addRow(array('<b>'.$ligne['bn_label_nature'].'</b>',
518
							$table->addRow(array($titre,
519
									     BAZ_DROIT_ADMIN,
519
									     BAZ_DROIT_ADMIN,
520
									     '<a href='.$lien_aucun_droit->getURL().'>'.BAZ_AUCUN_DROIT.'</a>',
520
									     '<a href='.$lien_aucun_droit->getURL().'>'.BAZ_AUCUN_DROIT.'</a>',
521
									     '<a href='.$lien_passer_redacteur->getURL().'>'.BAZ_DROIT_REDACTEUR.'</a>'));
521
									     '<a href='.$lien_passer_redacteur->getURL().'>'.BAZ_DROIT_REDACTEUR.'</a>'));
522
						}
522
						}
523
					}
523
					}
Line 557... Line 557...
557
		if ($_GET['image']==1) baz_insertion_image($GLOBALS['_BAZAR_']['id_fiche']);	
557
		if ($_GET['image']==1) baz_insertion_image($GLOBALS['_BAZAR_']['id_fiche']);	
558
		if ($_GET['image']==2) baz_suppression_image($GLOBALS['_BAZAR_']['id_fiche']);
558
		if ($_GET['image']==2) baz_suppression_image($GLOBALS['_BAZAR_']['id_fiche']);
559
	}
559
	}
Line 560... Line 560...
560
	
560
	
561
	//titre de la rubrique
561
	//titre de la rubrique
Line 562... Line 562...
562
	$res= '<h2>'.BAZ_TITRE_SAISIE_ANNONCE.$GLOBALS['_BAZAR_']['typeannonce'].'</h2>';
562
	$res= '<h2>'.BAZ_TITRE_SAISIE_ANNONCE.$GLOBALS['_BAZAR_']['typeannonce'].'</h2><br />'."\n";
563
		
563
		
564
	//ajout d'une page sur les conditions pour l'annonce si elles existent
564
	//ajout d'une page sur les conditions pour l'annonce si elles existent
565
	$requete = 'SELECT bn_condition FROM bazar_nature WHERE bn_label_nature="'.$GLOBALS['_BAZAR_']['typeannonce'].'"';
565
	$requete = 'SELECT bn_condition FROM bazar_nature WHERE bn_label_nature="'.$GLOBALS['_BAZAR_']['typeannonce'].'"';
Line 1081... Line 1081...
1081
*
1081
*
1082
*   @return  string    le code HTML
1082
*   @return  string    le code HTML
1083
*/
1083
*/
1084
function baz_s_inscrire() {
1084
function baz_s_inscrire() {
1085
	if (isset($_GET['inscrip'])) {
1085
	if (isset($_GET['inscrip'])) {
1086
		//cas d'une désinscription
1086
		//cas d'une desinscription
1087
		if ($_GET['inscrip']==0) {
1087
		if ($_GET['inscrip']==0) {
1088
			$requete='DELETE FROM bazar_abonnement WHERE ba_id_utilisateur='.$GLOBALS['id_user'].' AND ba_id_rubrique='.$_GET['idtypeannonce'];
1088
			$requete='DELETE FROM bazar_abonnement WHERE ba_id_utilisateur='.$GLOBALS['id_user'].' AND ba_id_rubrique='.$_GET['idtypeannonce'];
1089
		}
1089
		}
1090
		//cas d'une inscription
1090
		//cas d'une inscription
1091
		else {
1091
		else {
Line 1096... Line 1096...
1096
			die ($resultat->getMessage().$resultat->getDebugInfo()) ;
1096
			die ($resultat->getMessage().$resultat->getDebugInfo()) ;
1097
		}
1097
		}
1098
	}
1098
	}
Line 1099... Line 1099...
1099
	
1099
	
1100
	if ($GLOBALS['AUTH']->getAuth()) {
1100
	if ($GLOBALS['AUTH']->getAuth()) {
1101
	$res= '<h2>'.BAZ_S_ABONNER.'</h2>'."\n";
1101
	$res= '<h2>'.BAZ_S_INSCRIRE_AUX_ANNONCES.'</h2><br />'."\n";
1102
	$res= BAZ_LAIUS_S_ABONNER."\n";
1102
	$res .= BAZ_LAIUS_S_ABONNER.'<br /><br />'."\n";
1103
	//requete pour obtenir l'id et le label des types d'annonces
1103
	//requete pour obtenir l'id et le label des types d'annonces
1104
	$requete = 'SELECT bn_id_nature, bn_label_nature '.
1104
	$requete = 'SELECT bn_id_nature, bn_label_nature, bn_image_titre '.
1105
	           'FROM bazar_nature WHERE bn_ce_id_menu='.$GLOBALS['_GEN_commun']['info_menu']->gm_id_menu .' or  bn_ce_id_menu=0';
1105
	           'FROM bazar_nature WHERE bn_ce_id_menu='.$GLOBALS['_GEN_commun']['info_menu']->gm_id_menu .' or  bn_ce_id_menu=0';
1106
	$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
1106
	$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
1107
	if (DB::isError($resultat)) {
1107
	if (DB::isError($resultat)) {
1108
		die ($resultat->getMessage().$resultat->getDebugInfo()) ;
1108
		die ($resultat->getMessage().$resultat->getDebugInfo()) ;
Line 1127... Line 1127...
1127
		$lien_se_desabonner->addQueryString('inscrip', 0);
1127
		$lien_se_desabonner->addQueryString('inscrip', 0);
Line 1128... Line 1128...
1128
		
1128
		
1129
		$lien_RSS=$GLOBALS['_BAZAR_']['url'];
1129
		$lien_RSS=$GLOBALS['_BAZAR_']['url'];
Line 1130... Line 1130...
1130
		$lien_RSS->addQueryString('action', BAZ_VOIR_FLUX_RSS);
1130
		$lien_RSS->addQueryString('action', BAZ_VOIR_FLUX_RSS);
Line 1131... Line 1131...
1131
		
1131
		
1132
		'http://'.$_SERVER['HTTP_HOST'].'/client/bazar/bazarRSS.php?annonce='.$ligne['bn_label_nature'];
1132
		'http://'.$_SERVER['HTTP_HOST'].'/client/bazar/bazarRSS.php?annonce='.$ligne['bn_id_nature'];
1133
		
1133
		
1134
		//requete pour savoir si la personne est inscrite à ce type d'annonce
1134
		//requete pour savoir si la personne est inscrite à ce type d'annonce
1135
		$requete = 'SELECT ba_id_utilisateur '.
1135
		$requete = 'SELECT ba_id_utilisateur '.
1136
		           'FROM bazar_abonnement '.
1136
		           'FROM bazar_abonnement '.
1137
			   'WHERE ba_id_utilisateur='.$GLOBALS['id_user'].' AND ba_id_rubrique='.$ligne['bn_id_nature'];
1137
			       'WHERE ba_id_utilisateur='.$GLOBALS['id_user'].' AND ba_id_rubrique='.$ligne['bn_id_nature'];
1138
	        $resultat2 = $GLOBALS['_BAZAR_']['db']->query($requete) ;
1138
	        $resultat2 = $GLOBALS['_BAZAR_']['db']->query($requete) ;
-
 
1139
		if (DB::isError($resultat2)) {
-
 
1140
			die ($resultat2->getMessage().$resultat2->getDebugInfo()) ;
1139
		if (DB::isError($resultat2)) {
1141
		}
1140
			die ($resultat2->getMessage().$resultat2->getDebugInfo()) ;
1142
		if (isset($ligne['bn_image_titre'])) {$titre='&nbsp;<img src="client/bazar/images/'.$ligne['bn_image_titre'].'" alt="'.constant($ligne['bn_label_nature']).'" />'."\n";}
1141
		}
1143
		else {$titre='<strong>&nbsp;'.constant($ligne['bn_label_nature']).'</strong>'."\n";}
1142
		if ($resultat2->numRows()>0) {
1144
		if ($resultat2->numRows()>0) {
1143
			$lien_RSS->addQueryString('annonce', $ligne['bn_label_nature']);
1145
			$lien_RSS->addQueryString('annonce', $ligne['bn_id_nature']);
1144
			$table->addRow(array('<b>'.$ligne['bn_label_nature'].'</b>',
1146
			$table->addRow(array($titre,
1145
					     BAZ_ABONNE,
1147
					     BAZ_ABONNE,
1146
					     '<a href='.$lien_se_desabonner->getURL().'>'.BAZ_SE_DESABONNER.'</a>',
1148
					     '<a href='.$lien_se_desabonner->getURL().'>'.BAZ_SE_DESABONNER.'</a>',
1147
					     '<a href='.$lien_RSS->getURL().'><img src="client/bazar/images/BAZ_rss.png" alt="'.BAZ_RSS.'"></a>'));
1149
					     '<a href='.$lien_RSS->getURL().'><img src="client/bazar/images/BAZ_rss.png" alt="'.BAZ_RSS.'"></a>'));
1148
			$lien_RSS->removeQueryString('annonce');
1150
			$lien_RSS->removeQueryString('annonce');
1149
		}
1151
		}
1150
		else {
1152
		else {
1151
			$lien_RSS->addQueryString('annonce', $ligne['bn_label_nature']);
1153
			$lien_RSS->addQueryString('annonce', $ligne['bn_id_nature']);
1152
			$table->addRow(array('<b>'.$ligne['bn_label_nature'].'</b>',
1154
			$table->addRow(array($titre,
1153
			                     BAZ_PAS_ABONNE,
1155
			                     BAZ_PAS_ABONNE,
1154
			                     '<a href='.$lien_s_abonner->getURL().'>'.BAZ_S_ABONNER.'</a>',
1156
			                     '<a href='.$lien_s_abonner->getURL().'>'.BAZ_S_ABONNER.'</a>',
1155
					     '<a href='.$lien_RSS->getURL().'><img src="client/bazar/images/BAZ_rss.png" alt="'.BAZ_RSS.'" /></a>'));
1157
					     '<a href='.$lien_RSS->getURL().'><img src="client/bazar/images/BAZ_rss.png" alt="'.BAZ_RSS.'" /></a>'));
1156
			$lien_RSS->removeQueryString('annonce');
1158
			$lien_RSS->removeQueryString('annonce');
1157
		}
1159
		}
1158
	}
1160
	}
1159
	$table->altRowAttributes(1, array('class' => 'ligne_impaire'), array('class' => 'ligne_paire'));
1161
	$table->altRowAttributes(1, array('class' => 'ligne_impaire'), array('class' => 'ligne_paire'));
1160
	$table->updateColAttributes(0, array('style' => 'text-align:left;'));
1162
	$table->updateColAttributes(0, array('align' => 'center'));
1161
	$table->updateColAttributes(1, array('align' => 'center'));
1163
	$table->updateColAttributes(1, array('align' => 'center'));
1162
	$table->updateColAttributes(2, array('align' => 'center'));
1164
	$table->updateColAttributes(2, array('align' => 'center'));
Line 1344... Line 1346...
1344
}
1346
}
Line 1345... Line 1347...
1345
 
1347
 
1346
/* +--Fin du code ----------------------------------------------------------------------------------------+
1348
/* +--Fin du code ----------------------------------------------------------------------------------------+
1347
*
1349
*
-
 
1350
* $Log: not supported by cvs2svn $
-
 
1351
* Revision 1.25  2005/12/20 14:49:35  ddelon
-
 
1352
* Fusion Head vers Livraison
1348
* $Log: not supported by cvs2svn $
1353
*
1349
* Revision 1.24  2005/12/16 15:44:40  alexandre_tb
1354
* Revision 1.24  2005/12/16 15:44:40  alexandre_tb
1350
* ajout de l'option restreindre dépôt
1355
* ajout de l'option restreindre dépôt
1351
*
1356
*
1352
* Revision 1.23  2005/12/01 17:03:34  florian
1357
* Revision 1.23  2005/12/01 17:03:34  florian