Subversion Repositories Applications.bazar

Rev

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

Rev 330 Rev 346
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.74 2007-10-25 09:41:31 alexandre_tb Exp $
22
// CVS : $Id: bazar.fonct.php,v 1.75 2007-12-04 09:07:21 alexandre_tb 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.74 $ $Date: 2007-10-25 09:41:31 $
34
*@version       $Revision: 1.75 $ $Date: 2007-12-04 09:07:21 $
35
// +------------------------------------------------------------------------------------------------------+
35
// +------------------------------------------------------------------------------------------------------+
36
*/
36
*/
Line 37... Line 37...
37
 
37
 
38
// +------------------------------------------------------------------------------------------------------+
38
// +------------------------------------------------------------------------------------------------------+
Line 1220... Line 1220...
1220
			die ($resultat->getMessage().$resultat->getDebugInfo()) ;
1220
			die ($resultat->getMessage().$resultat->getDebugInfo()) ;
1221
		}
1221
		}
1222
	}
1222
	}
Line 1223... Line 1223...
1223
	
1223
	
1224
	if ($GLOBALS['AUTH']->getAuth()) {
1224
	if ($GLOBALS['AUTH']->getAuth()) {
1225
	$res .= '<p id="laius_abonnement">'.BAZ_LAIUS_S_ABONNER.'</p>'."\n";
1225
		$res .= '<p id="laius_abonnement">'.BAZ_LAIUS_S_ABONNER.'</p>'."\n";
1226
	//requete pour obtenir l'id et le label des types d'annonces
1226
		//requete pour obtenir l'id et le label des types d'annonces
1227
	$requete = 'SELECT bn_id_nature, bn_label_nature, bn_image_titre '.
1227
		$requete = 'SELECT bn_id_nature, bn_label_nature, bn_image_titre '.
1228
	           'FROM bazar_nature WHERE 1'; /*bn_ce_id_menu='.$GLOBALS['_BAZAR_']['categorie_nature'];*/
1228
		           'FROM bazar_nature WHERE 1'; /*bn_ce_id_menu='.$GLOBALS['_BAZAR_']['categorie_nature'];*/
1229
	$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
1229
		$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
1230
	if (DB::isError($resultat)) {
1230
		if (DB::isError($resultat)) {
1231
		die ($resultat->getMessage().$resultat->getDebugInfo()) ;
-
 
1232
	}
-
 
1233
	
-
 
1234
	$table = new HTML_Table(array ('width' => '100%', 'class' => 'table_bazar'));
-
 
1235
	$table->addRow(array(BAZ_TYPE_ANNONCES, BAZ_STATUT, BAZ_PASSER_EN, BAZ_RSS));
-
 
1236
	$table->setRowType(0, 'th');
-
 
1237
	
-
 
1238
	while ($ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {		
-
 
1239
		$tab_parametres_GET = explode ("&", $_SERVER["argv"][0]) ;
-
 
1240
		foreach ($tab_parametres_GET as $cle_param => $valeur_param) {
-
 
1241
			$tab_valeur = explode ('=', $valeur_param) ;
-
 
1242
			$GLOBALS['_BAZAR_']['url']->addQueryString($tab_valeur[0], $tab_valeur[1]);
1231
			die ($resultat->getMessage().$resultat->getDebugInfo()) ;
1243
		}
-
 
1244
						
-
 
1245
		$lien_s_abonner=$GLOBALS['_BAZAR_']['url'];
-
 
1246
		$lien_s_abonner->addQueryString('action', BAZ_S_INSCRIRE);
-
 
1247
		$lien_s_abonner->addQueryString('idtypeannonce', $ligne['bn_id_nature']);
-
 
Line 1248... Line 1232...
1248
		$lien_s_abonner->addQueryString('inscrip', 1);
1232
		}
1249
		
1233
		
1250
		$lien_se_desabonner=$GLOBALS['_BAZAR_']['url'];
-
 
1251
		$lien_se_desabonner->addQueryString('action', BAZ_S_INSCRIRE);
-
 
Line 1252... Line 1234...
1252
		$lien_se_desabonner->addQueryString('idtypeannonce', $ligne['bn_id_nature']);
1234
		// Nettoyage de l url
1253
		$lien_se_desabonner->addQueryString('inscrip', 0);
1235
		$GLOBALS['_BAZAR_']['url']->removeQueryString(BAZ_VARIABLE_VOIR);
-
 
1236
		
Line -... Line 1237...
-
 
1237
		$table = new HTML_Table(array ('width' => '100%', 'class' => 'table_bazar'));
-
 
1238
		$table->addRow(array(BAZ_TYPE_ANNONCES,/* BAZ_STATUT, BAZ_PASSER_EN, */ BAZ_RSS));
-
 
1239
		$table->setRowType(0, 'th');
-
 
1240
		
-
 
1241
		while ($ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {	
-
 
1242
			/*
-
 
1243
			$tab_parametres_GET = explode ("&", $_SERVER["argv"][0]) ;
-
 
1244
			foreach ($tab_parametres_GET as $cle_param => $valeur_param) {
-
 
1245
				$tab_valeur = explode ('=', $valeur_param) ;
-
 
1246
				$GLOBALS['_BAZAR_']['url']->addQueryString($tab_valeur[0], $tab_valeur[1]);
-
 
1247
			}
-
 
1248
				*/			
-
 
1249
			$lien_s_abonner=$GLOBALS['_BAZAR_']['url'];
-
 
1250
			$lien_s_abonner->addQueryString('action', BAZ_S_INSCRIRE);
-
 
1251
			$lien_s_abonner->addQueryString('annonce', $ligne['bn_id_nature']);
-
 
1252
			$lien_s_abonner->addQueryString('inscrip', 1);
-
 
1253
			
-
 
1254
			$lien_se_desabonner=$GLOBALS['_BAZAR_']['url'];
-
 
1255
			$lien_se_desabonner->addQueryString('action', BAZ_S_INSCRIRE);
-
 
1256
			$lien_se_desabonner->addQueryString('annonce', $ligne['bn_id_nature']);
-
 
1257
			$lien_se_desabonner->addQueryString('inscrip', 0);
1254
		
1258
			
1255
		$lien_RSS=$GLOBALS['_BAZAR_']['url'];
1259
			$lien_RSS=$GLOBALS['_BAZAR_']['url'];
1256
		$lien_RSS->addQueryString('action', BAZ_VOIR_FLUX_RSS);						
1260
			$lien_RSS->addQueryString('action', BAZ_VOIR_FLUX_RSS);						
1257
		
1261
			
1258
		//requete pour savoir si la personne est inscrite a ce type d'annonce
1262
			//requete pour savoir si la personne est inscrite a ce type d'annonce
1259
		$requete = 'SELECT ba_id_utilisateur '.
1263
			$requete = 'SELECT ba_id_utilisateur '.
1260
		           'FROM bazar_abonnement '.
1264
			           'FROM bazar_abonnement '.
1261
			       'WHERE ba_id_utilisateur='.$GLOBALS['id_user'].' AND ba_id_rubrique='.$ligne['bn_id_nature'];
1265
				       'WHERE ba_id_utilisateur='.$GLOBALS['id_user'].' AND ba_id_rubrique='.$ligne['bn_id_nature'];
1262
	        $resultat2 = $GLOBALS['_BAZAR_']['db']->query($requete) ;
1266
		        $resultat2 = $GLOBALS['_BAZAR_']['db']->query($requete) ;
1263
		if (DB::isError($resultat2)) {
1267
			if (DB::isError($resultat2)) {
1264
			die ($resultat2->getMessage().$resultat2->getDebugInfo()) ;
1268
				die ($resultat2->getMessage().$resultat2->getDebugInfo()) ;
1265
		}
1269
			}
1266
		if (isset($ligne['bn_image_titre'])) {$titre='&nbsp;<img src="client/bazar/images/'.$ligne['bn_image_titre'].'" alt="'.$ligne['bn_label_nature'].'" />'."\n";}
1270
			if (isset($ligne['bn_image_titre'])) {$titre='&nbsp;<img src="client/bazar/images/'.$ligne['bn_image_titre'].'" alt="'.$ligne['bn_label_nature'].'" />'."\n";}
1267
		else {$titre='<strong>&nbsp;'.$ligne['bn_label_nature'].'</strong>'."\n";}
1271
			else {$titre='<strong>&nbsp;'.$ligne['bn_label_nature'].'</strong>'."\n";}
1268
		if ($resultat2->numRows()>0) {
1272
			if ($resultat2->numRows()>0) {
1269
			$lien_RSS->addQueryString('annonce', $ligne['bn_id_nature']);
1273
				//$lien_RSS->addQueryString('annonce', $ligne['bn_id_nature']);
1270
			$table->addRow(array($titre,
1274
				$table->addRow(array($titre,
1271
					     BAZ_ABONNE,
1275
						   /*    BAZ_ABONNE,
1272
					     '<a href='.$lien_se_desabonner->getURL().'>'.BAZ_SE_DESABONNER.'</a>',
1276
						   '<a href='.$lien_se_desabonner->getURL().'>'.BAZ_SE_DESABONNER.'</a>', */
1273
					     '<a href='.$lien_RSS->getURL().'><img src="client/bazar/images/BAZ_rss.png" alt="'.BAZ_RSS.'"></a>'));
1277
						     '<a href="'.$lien_RSS->getURL().'"><img src="client/bazar/images/BAZ_rss.png" alt="'.BAZ_RSS.'"></a>'));
1274
			$lien_RSS->removeQueryString('annonce');
1278
				$lien_RSS->removeQueryString('annonce');
1275
		}
1279
			}
1276
		else {
1280
			else {
1277
			$lien_RSS->addQueryString('annonce', $ligne['bn_id_nature']);
1281
				$lien_RSS->removeQueryString('inscrip');
1278
			$table->addRow(array($titre,
-
 
1279
			                     BAZ_PAS_ABONNE,
1282
				$table->addRow(array($titre,
1280
			                     '<a href='.$lien_s_abonner->getURL().'>'.BAZ_S_ABONNER.'</a>',
1283
				                  /*    BAZ_PAS_ABONNE,
1281
					     '<a href='.$lien_RSS->getURL().'><img src="client/bazar/images/BAZ_rss.png" alt="'.BAZ_RSS.'" /></a>'));
1284
				                    '<a href='.$lien_s_abonner->getURL().'>'.BAZ_S_ABONNER.'</a>', */
1282
			$lien_RSS->removeQueryString('annonce');
1285
						     '<a href="'.$lien_RSS->getURL().'"><img src="client/bazar/images/BAZ_rss.png" alt="'.BAZ_RSS.'" /></a>'));
1283
		}
1286
			}
1284
	}
-
 
1285
	$table->altRowAttributes(1, array('class' => 'ligne_impaire'), array('class' => 'ligne_paire'));
-
 
1286
	$table->updateColAttributes(0, array('id' => 'col1'));
1287
		}
1287
	$table->updateColAttributes(1, array('id' => 'col2'));
1288
		$table->altRowAttributes(1, array('class' => 'ligne_impaire'), array('class' => 'ligne_paire'));
1288
	$table->updateColAttributes(2, array('id' => 'col3'));
1289
		$table->updateColAttributes(0, array('class' => 'col1'));
1289
	$table->updateColAttributes(3, array('id' => 'col4'));
1290
		$table->updateColAttributes(1, array('class' => 'col2'));
1290
	$res.=$table->toHTML() ;
1291
		$res.=$table->toHTML() ;
1291
	}
1292
	}
Line 1396... Line 1397...
1396
}
1397
}
Line 1397... Line 1398...
1397
 
1398
 
1398
/* +--Fin du code ----------------------------------------------------------------------------------------+
1399
/* +--Fin du code ----------------------------------------------------------------------------------------+
1399
*
1400
*
-
 
1401
* $Log: not supported by cvs2svn $
-
 
1402
* Revision 1.74  2007-10-25 09:41:31  alexandre_tb
-
 
1403
* mise en place de variable de session pour eviter que les formulaires soit valider 2 fois, pour les url, fichiers et image
1400
* $Log: not supported by cvs2svn $
1404
*
1401
* Revision 1.73  2007-10-24 13:27:00  alexandre_tb
1405
* Revision 1.73  2007-10-24 13:27:00  alexandre_tb
1402
* bug : double saisie d url
1406
* bug : double saisie d url
1403
* suppression de warning sur variable
1407
* suppression de warning sur variable
1404
*
1408
*