Subversion Repositories Applications.bazar

Rev

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

Rev 361 Rev 366
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.2.5 2008-01-29 09:35:36 alexandre_tb Exp $
22
// CVS : $Id: bazar.fonct.php,v 1.74.2.6 2008-01-29 09:55:07 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.2.5 $ $Date: 2008-01-29 09:35:36 $
34
*@version       $Revision: 1.74.2.6 $ $Date: 2008-01-29 09:55:07 $
35
// +------------------------------------------------------------------------------------------------------+
35
// +------------------------------------------------------------------------------------------------------+
36
*/
36
*/
Line 37... Line 37...
37
 
37
 
38
// +------------------------------------------------------------------------------------------------------+
38
// +------------------------------------------------------------------------------------------------------+
Line 1227... Line 1227...
1227
		if (DB::isError($resultat)) {
1227
		if (DB::isError($resultat)) {
1228
			die ($resultat->getMessage().$resultat->getDebugInfo()) ;
1228
			die ($resultat->getMessage().$resultat->getDebugInfo()) ;
1229
		}
1229
		}
1230
	}
1230
	}
Line 1231... Line -...
1231
	
-
 
1232
	if ($GLOBALS['AUTH']->getAuth()) {
1231
	
1233
		$res .= '<p id="laius_abonnement">'.BAZ_LAIUS_S_ABONNER.'</p>'."\n";
1232
	$res .= '<p id="laius_abonnement">'.BAZ_LAIUS_S_ABONNER.'</p>'."\n";
1234
		//requete pour obtenir l'id et le label des types d'annonces
1233
	//requete pour obtenir l'id et le label des types d'annonces
1235
		$requete = 'SELECT bn_id_nature, bn_label_nature, bn_image_titre '.
1234
	$requete = 'SELECT bn_id_nature, bn_label_nature, bn_image_titre '.
1236
		           'FROM bazar_nature WHERE 1'; /*bn_ce_id_menu='.$GLOBALS['_BAZAR_']['categorie_nature'];*/
1235
	           'FROM bazar_nature WHERE 1'; /*bn_ce_id_menu='.$GLOBALS['_BAZAR_']['categorie_nature'];*/
1237
		$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
1236
	$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
1238
		if (DB::isError($resultat)) {
1237
	if (DB::isError($resultat)) {
1239
			die ($resultat->getMessage().$resultat->getDebugInfo()) ;
1238
		die ($resultat->getMessage().$resultat->getDebugInfo()) ;
-
 
1239
	}
-
 
1240
	
-
 
1241
	// Nettoyage de l url
-
 
1242
	$GLOBALS['_BAZAR_']['url']->removeQueryString(BAZ_VARIABLE_VOIR);
-
 
1243
	
-
 
1244
	$table = new HTML_Table(array ('width' => '100%', 'class' => 'table_bazar'));
-
 
1245
	$table->addRow(array(BAZ_TYPE_ANNONCES,/* BAZ_STATUT, BAZ_PASSER_EN, */ BAZ_RSS));
-
 
1246
	$table->setRowType(0, 'th');
-
 
1247
	
Line 1240... Line 1248...
1240
		}
1248
	while ($ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {	
1241
		
1249
		
-
 
1250
		$lien_s_abonner=$GLOBALS['_BAZAR_']['url'];
-
 
1251
		$lien_s_abonner->addQueryString(BAZ_VARIABLE_ACTION, BAZ_S_INSCRIRE);
Line -... Line 1252...
-
 
1252
		$lien_s_abonner->addQueryString('annonce', $ligne['bn_id_nature']);
1242
		// Nettoyage de l url
1253
		$lien_s_abonner->addQueryString('inscrip', 1);
1243
		$GLOBALS['_BAZAR_']['url']->removeQueryString(BAZ_VARIABLE_VOIR);
1254
		
1244
		
1255
		$lien_se_desabonner=$GLOBALS['_BAZAR_']['url'];
Line 1245... Line -...
1245
		$table = new HTML_Table(array ('width' => '100%', 'class' => 'table_bazar'));
-
 
1246
		$table->addRow(array(BAZ_TYPE_ANNONCES,/* BAZ_STATUT, BAZ_PASSER_EN, */ BAZ_RSS));
-
 
1247
		$table->setRowType(0, 'th');
-
 
1248
		
-
 
1249
		while ($ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {	
-
 
1250
			/*
-
 
1251
			$tab_parametres_GET = explode ("&", $_SERVER["argv"][0]) ;
-
 
1252
			foreach ($tab_parametres_GET as $cle_param => $valeur_param) {
-
 
1253
				$tab_valeur = explode ('=', $valeur_param) ;
-
 
1254
				$GLOBALS['_BAZAR_']['url']->addQueryString($tab_valeur[0], $tab_valeur[1]);
-
 
1255
			}
-
 
1256
				*/			
-
 
1257
			$lien_s_abonner=$GLOBALS['_BAZAR_']['url'];
-
 
1258
			$lien_s_abonner->addQueryString(BAZ_VARIABLE_ACTION, BAZ_S_INSCRIRE);
-
 
1259
			$lien_s_abonner->addQueryString('annonce', $ligne['bn_id_nature']);
-
 
1260
			$lien_s_abonner->addQueryString('inscrip', 1);
-
 
1261
			
-
 
1262
			$lien_se_desabonner=$GLOBALS['_BAZAR_']['url'];
-
 
1263
			$lien_se_desabonner->addQueryString(BAZ_VARIABLE_ACTION, BAZ_S_INSCRIRE);
1256
		$lien_se_desabonner->addQueryString(BAZ_VARIABLE_ACTION, BAZ_S_INSCRIRE);
1264
			$lien_se_desabonner->addQueryString('annonce', $ligne['bn_id_nature']);
1257
		$lien_se_desabonner->addQueryString('annonce', $ligne['bn_id_nature']);
1265
			$lien_se_desabonner->addQueryString('inscrip', 0);
1258
		$lien_se_desabonner->addQueryString('inscrip', 0);
1266
			
1259
		
1267
			$lien_RSS=$GLOBALS['_BAZAR_']['url'];
1260
		$lien_RSS=$GLOBALS['_BAZAR_']['url'];
1268
			$lien_RSS->addQueryString(BAZ_VARIABLE_ACTION, BAZ_VOIR_FLUX_RSS);						
1261
		$lien_RSS->addQueryString(BAZ_VARIABLE_ACTION, BAZ_VOIR_FLUX_RSS);						
1269
			
1262
		
1270
			//requete pour savoir si la personne est inscrite a ce type d'annonce
1263
		//requete pour savoir si la personne est inscrite a ce type d'annonce
1271
			$requete = 'SELECT ba_id_utilisateur '.
1264
		$requete = 'SELECT ba_id_utilisateur '.
1272
			           'FROM bazar_abonnement '.
1265
		           'FROM bazar_abonnement '.
1273
				       'WHERE ba_id_utilisateur='.$GLOBALS['id_user'].' AND ba_id_rubrique='.$ligne['bn_id_nature'];
1266
			       'WHERE ba_id_utilisateur='.$GLOBALS['id_user'].' AND ba_id_rubrique='.$ligne['bn_id_nature'];
1274
		        $resultat2 = $GLOBALS['_BAZAR_']['db']->query($requete) ;
1267
	        $resultat2 = $GLOBALS['_BAZAR_']['db']->query($requete) ;
1275
			if (DB::isError($resultat2)) {
1268
		if (DB::isError($resultat2)) {
1276
				die ($resultat2->getMessage().$resultat2->getDebugInfo()) ;
1269
			die ($resultat2->getMessage().$resultat2->getDebugInfo()) ;
1277
			}
1270
		}
1278
			if (isset($ligne['bn_image_titre'])) {$titre='&nbsp;<img src="client/bazar/images/'.$ligne['bn_image_titre'].'" alt="'.$ligne['bn_label_nature'].'" />'."\n";}
1271
		if (isset($ligne['bn_image_titre'])) {$titre='&nbsp;<img src="client/bazar/images/'.$ligne['bn_image_titre'].'" alt="'.$ligne['bn_label_nature'].'" />'."\n";}
1279
			else {$titre='<strong>&nbsp;'.$ligne['bn_label_nature'].'</strong>'."\n";}
1272
		else {$titre='<strong>&nbsp;'.$ligne['bn_label_nature'].'</strong>'."\n";}
1280
			if ($resultat2->numRows()>0) {
1273
		if ($resultat2->numRows()>0) {
1281
				//$lien_RSS->addQueryString('annonce', $ligne['bn_id_nature']);
1274
			//$lien_RSS->addQueryString('annonce', $ligne['bn_id_nature']);
1282
				$table->addRow(array($titre,
1275
			$table->addRow(array($titre,
1283
						   /*    BAZ_ABONNE,
1276
					   /*    BAZ_ABONNE,
1284
						   '<a href='.$lien_se_desabonner->getURL().'>'.BAZ_SE_DESABONNER.'</a>', */
1277
					   '<a href='.$lien_se_desabonner->getURL().'>'.BAZ_SE_DESABONNER.'</a>', */
1285
						     '<a href="'.$lien_RSS->getURL().'"><img src="client/bazar/images/BAZ_rss.png" alt="'.BAZ_RSS.'"></a>'));
1278
					     '<a href="'.$lien_RSS->getURL().'"><img src="client/bazar/images/BAZ_rss.png" alt="'.BAZ_RSS.'"></a>'));
1286
				$lien_RSS->removeQueryString('annonce');
1279
			$lien_RSS->removeQueryString('annonce');
1287
			}
1280
		}
1288
			else {
1281
		else {
1289
				$lien_RSS->removeQueryString('inscrip');
1282
			$lien_RSS->removeQueryString('inscrip');
1290
				$table->addRow(array($titre,
-
 
1291
				                  /*    BAZ_PAS_ABONNE,
1283
			$table->addRow(array($titre,
1292
				                    '<a href='.$lien_s_abonner->getURL().'>'.BAZ_S_ABONNER.'</a>', */
-
 
1293
						     '<a href="'.$lien_RSS->getURL().'"><img src="client/bazar/images/BAZ_rss.png" alt="'.BAZ_RSS.'" /></a>'));
-
 
1294
			}
-
 
1295
		}
-
 
1296
		$table->altRowAttributes(1, array('class' => 'ligne_impaire'), array('class' => 'ligne_paire'));
-
 
1297
		$table->updateColAttributes(0, array('class' => 'col1'));
-
 
1298
		$table->updateColAttributes(1, array('class' => 'col2'));
-
 
1299
		$res.=$table->toHTML() ;
-
 
1300
	}
-
 
1301
	else { 
-
 
1302
		$res .= '<p class="zone_info">'.BAZ_IDENTIFIEZ_VOUS_POUR_SAISIR.'</p>'."\n" ;
-
 
1303
		$res .= '<form id="form_connexion" style="clear:both;" class="form_identification" action="' ;
-
 
1304
		$GLOBALS['_BAZAR_']['url']->addQueryString(BAZ_VARIABLE_ACTION, BAZ_S_INSCRIRE);
-
 
1305
		$res .= $GLOBALS['_BAZAR_']['url']->getURL();
-
 
1306
		$res .= '" method="post">
-
 
1307
                <fieldset>
-
 
1308
                    <legend>Identifiez vous</legend>                    
-
 
1309
                        <label for="username">Courriel : </label>
-
 
1310
                        <input type="text"  id="username" name="username" maxlength="80" tabindex="1" value="courriel" />                    
-
 
1311
                        <label for="password">Mot de passe : </label>
-
 
1312
                        <input type="password" id="password" name="password" maxlength="80" tabindex="2" value="mot de passe" />                    
1284
			                  /*    BAZ_PAS_ABONNE,
-
 
1285
			                    '<a href='.$lien_s_abonner->getURL().'>'.BAZ_S_ABONNER.'</a>', */
-
 
1286
					     '<a href="'.$lien_RSS->getURL().'"><img src="client/bazar/images/BAZ_rss.png" alt="'.BAZ_RSS.'" /></a>'));
-
 
1287
		}
-
 
1288
	}
1313
                        <input type="submit" id="connexion" name="connexion" tabindex="3" value="ok" />                    
1289
	$table->altRowAttributes(1, array('class' => 'ligne_impaire'), array('class' => 'ligne_paire'));
1314
                </fieldset>
1290
	$table->updateColAttributes(0, array('class' => 'col1'));
1315
                </form>';
1291
	$table->updateColAttributes(1, array('class' => 'col2'));
1316
	}
1292
	$res.=$table->toHTML() ;
1317
	
1293
 
Line 1405... Line 1381...
1405
}
1381
}
Line 1406... Line 1382...
1406
 
1382
 
1407
/* +--Fin du code ----------------------------------------------------------------------------------------+
1383
/* +--Fin du code ----------------------------------------------------------------------------------------+
1408
*
1384
*
-
 
1385
* $Log: not supported by cvs2svn $
-
 
1386
* Revision 1.74.2.5  2008-01-29 09:35:36  alexandre_tb
-
 
1387
* remplacement des variables action par une constante
-
 
1388
* Utilisation d un redirection pour eviter que les formulaires soient valides 2 fois
-
 
1389
* simplification de la suppression d un lien associe a une liste
1409
* $Log: not supported by cvs2svn $
1390
*
1410
* Revision 1.74.2.4  2008-01-11 14:10:12  alexandre_tb
1391
* Revision 1.74.2.4  2008-01-11 14:10:12  alexandre_tb
1411
* Remplacement de la variable action ecrite en dur par la constante BAZ_VARIABLE_ACTION
1392
* Remplacement de la variable action ecrite en dur par la constante BAZ_VARIABLE_ACTION
1412
*
1393
*
1413
* Revision 1.74.2.3  2007-12-14 09:55:05  alexandre_tb
1394
* Revision 1.74.2.3  2007-12-14 09:55:05  alexandre_tb