Subversion Repositories Applications.bazar

Rev

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

Rev 153 Rev 154
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.56 2006-09-28 15:41:36 alexandre_tb Exp $
22
// CVS : $Id: bazar.fonct.php,v 1.57 2006-10-05 08:53:50 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.56 $ $Date: 2006-09-28 15:41:36 $
34
*@version       $Revision: 1.57 $ $Date: 2006-10-05 08:53:50 $
35
// +------------------------------------------------------------------------------------------------------+
35
// +------------------------------------------------------------------------------------------------------+
36
*/
36
*/
Line 37... Line 37...
37
 
37
 
38
// +------------------------------------------------------------------------------------------------------+
38
// +------------------------------------------------------------------------------------------------------+
Line 144... Line 144...
144
		$res .= $table->toHTML() ;
144
		$res .= $table->toHTML() ;
145
	}
145
	}
146
	else {
146
	else {
147
		$res .= '<p class="zone_info">'.BAZ_PAS_DE_FICHE_A_VALIDER.'</p>'."\n" ;
147
		$res .= '<p class="zone_info">'.BAZ_PAS_DE_FICHE_A_VALIDER.'</p>'."\n" ;
148
	}
148
	}
149
	
-
 
-
 
149
	$GLOBALS['_BAZAR_']['url']->addQueryString('action', BAZ_VOIR_TOUTES_ANNONCES);
-
 
150
	$res .= '<br /><ul style="clear:both;"><li><a href="'.$GLOBALS['_BAZAR_']['url']->getURL().'" title="'.BAZ_CONSULTER_FICHES_VALIDEES.'">'.BAZ_CONSULTER_FICHES_VALIDEES.'</a></li></ul>';
-
 
151
	$GLOBALS['_BAZAR_']['url']->removeQueryString('action');
150
	return $res;
152
	return $res;
151
}
153
}
Line 152... Line 154...
152
 
154
 
153
 
155
 
154
/** mes_fiches () - Renvoie les fiches bazar d'un utilisateur
156
/** mes_fiches () - Renvoie les fiches bazar d'un utilisateur
155
*
157
*
156
* @return   string  HTML
158
* @return   string  HTML
-
 
159
*/
157
*/
160
function mes_fiches() {
158
function mes_fiches() {
-
 
159
	if ($GLOBALS['AUTH']->getAuth()) {
161
	$res= '<h2>'.BAZ_VOS_ANNONCES.'</h2><br />'."\n";
160
		$res= '<h2>'.BAZ_VOS_ANNONCES.'</h2><br />'."\n";
162
	if ($GLOBALS['AUTH']->getAuth()) {		
161
		// requete pour voir si l'utilisateur a des fiches a son nom, classees par date de MAJ et nature d'annonce
163
		// requete pour voir si l'utilisateur a des fiches a son nom, classees par date de MAJ et nature d'annonce
162
		$requete = 'SELECT * FROM bazar_fiche, bazar_nature WHERE bf_ce_utilisateur='. $GLOBALS['id_user'].
164
		$requete = 'SELECT * FROM bazar_fiche, bazar_nature WHERE bf_ce_utilisateur='. $GLOBALS['id_user'].
163
		           ' 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';
165
		           ' 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';
Line 203... Line 205...
203
					'<a href="'.$lien_modifier_url.'">'.BAZ_MODIFIER.'</a>'."\n", // col 4 : modifier
205
					'<a href="'.$lien_modifier_url.'">'.BAZ_MODIFIER.'</a>'."\n", // col 4 : modifier
204
					'<a href="'.$lien_supprimer_url.'" onclick="javascript:return '.
206
					'<a href="'.$lien_supprimer_url.'" onclick="javascript:return '.
205
					'confirm(\''.BAZ_CONFIRMATION_SUPPRESSION.'\');" >'.BAZ_SUPPRIMER.'</a>'."\n")) ; // col 5 : supprimer
207
					'confirm(\''.BAZ_CONFIRMATION_SUPPRESSION.'\');" >'.BAZ_SUPPRIMER.'</a>'."\n")) ; // col 5 : supprimer
206
		}
208
		}
207
		$table->altRowAttributes(1, array("class" => "ligne_impaire"), array("class" => "ligne_paire"));
209
		$table->altRowAttributes(1, array("class" => "ligne_impaire"), array("class" => "ligne_paire"));
208
		$table->updateColAttributes(1, array("align" => "center"));
210
		$table->updateColAttributes(1, array("align" => "left"));
209
		$table->updateColAttributes(2, array("align" => "center"));
211
		$table->updateColAttributes(2, array("align" => "center"));
210
		$table->updateColAttributes(3, array("align" => "center"));
212
		$table->updateColAttributes(3, array("align" => "center"));
211
		$table->updateColAttributes(4, array("align" => "center"));
213
		$table->updateColAttributes(4, array("align" => "center"));
212
		$res .= $table->toHTML() ;
214
		$res .= $table->toHTML() ;
213
		}
215
		}
214
	    else {
216
	    else {
215
	    	$res .= '<p class="zone_info">'.BAZ_PAS_DE_FICHE.'</p>'."\n" ;
217
	    	$res .= '<p class="zone_info">'.BAZ_PAS_DE_FICHE.'</p>'."\n" ;
216
	    }
218
	    }
-
 
219
	    $GLOBALS['_BAZAR_']['url']->addQueryString('action', BAZ_DEPOSER_ANNONCE);
-
 
220
		$res .= '<br /><ul><li><a href="'.$GLOBALS['_BAZAR_']['url']->getURL().'" title="'.BAZ_SAISIR_UNE_NOUVELLE_FICHE.'">'.BAZ_SAISIR_UNE_NOUVELLE_FICHE.'</a></li></ul>';
-
 
221
		$GLOBALS['_BAZAR_']['url']->removeQueryString('action');	    
-
 
222
	}
-
 
223
	else  { 
-
 
224
		$res .= '<p class="zone_info">'.BAZ_IDENTIFIEZ_VOUS_POUR_SAISIR.'</p>'."\n" ;
-
 
225
		$res .= '<form id="form_connexion" style="clear:both;" class="form_identification" action="' ;
-
 
226
		$GLOBALS['_BAZAR_']['url']->addQueryString('action', BAZ_ACTION_VOIR_VOS_ANNONCES);
-
 
227
		$res .= $GLOBALS['_BAZAR_']['url']->getURL();
-
 
228
		$res .= '" method="post">
-
 
229
                <fieldset>
-
 
230
                    <legend>Identifiez vous</legend>                    
-
 
231
                        <label for="username">Courriel : </label>
-
 
232
                        <input type="text"  id="username" name="username" maxlength="80" tabindex="1" value="courriel" />                    
-
 
233
                        <label for="password">Mot de passe : </label>
-
 
234
                        <input type="password" id="password" name="password" maxlength="80" tabindex="2" value="mot de passe" />                    
-
 
235
                        <input type="submit" id="connexion" name="connexion" tabindex="3" value="ok" />                    
-
 
236
                </fieldset>
-
 
237
                </form>';
217
	}
238
	}
218
	else $res=BAZ_IDENTIFIEZ_VOUS_POUR_SAISIR;
-
 
219
	return $res;
239
	return $res;
220
}
240
}
Line 221... Line 241...
221
 
241
 
222
/** baz_gestion_droits() interface de gestion des droits
242
/** baz_gestion_droits() interface de gestion des droits
Line 551... Line 571...
551
		}
571
		}
552
    }
572
    }
553
	else {
573
	else {
554
		$res .= '<h2>'.BAZ_DEPOSE_UNE_NOUVELLE_ANNONCE.'</h2><br />'."\n";
574
		$res .= '<h2>'.BAZ_DEPOSE_UNE_NOUVELLE_ANNONCE.'</h2><br />'."\n";
555
		$res .= '<p class="zone_info">'.BAZ_IDENTIFIEZ_VOUS_POUR_SAISIR.'</p>'."\n" ;
575
		$res .= '<p class="zone_info">'.BAZ_IDENTIFIEZ_VOUS_POUR_SAISIR.'</p>'."\n" ;
556
		$res .= '<form id="form_connexion" class="form_identification" action="' ;
576
		$res .= '<form id="form_connexion" style="clear:both;" class="form_identification" action="' ;
557
		$GLOBALS['_BAZAR_']['url']->addQueryString('action', BAZ_DEPOSER_ANNONCE);
577
		$GLOBALS['_BAZAR_']['url']->addQueryString('action', BAZ_DEPOSER_ANNONCE);
558
		$res .= $GLOBALS['_BAZAR_']['url']->getURL();
578
		$res .= $GLOBALS['_BAZAR_']['url']->getURL();
559
		$res .= '" method="post">
579
		$res .= '" method="post">
560
                <fieldset>
580
                <fieldset>
561
                    <legend>Identifiez vous</legend>                    
581
                    <legend>Identifiez vous</legend>                    
Line 1027... Line 1047...
1027
	
1047
	
1028
	if ($GLOBALS['AUTH']->getAuth()) {
1048
	if ($GLOBALS['AUTH']->getAuth()) {
1029
	$res .= BAZ_LAIUS_S_ABONNER.'<br /><br />'."\n";
1049
	$res .= BAZ_LAIUS_S_ABONNER.'<br /><br />'."\n";
1030
	//requete pour obtenir l'id et le label des types d'annonces
1050
	//requete pour obtenir l'id et le label des types d'annonces
1031
	$requete = 'SELECT bn_id_nature, bn_label_nature, bn_image_titre '.
1051
	$requete = 'SELECT bn_id_nature, bn_label_nature, bn_image_titre '.
1032
	           'FROM bazar_nature WHERE bn_ce_id_menu='.$GLOBALS['_BAZAR_']['categorie_nature'];
1052
	           'FROM bazar_nature WHERE 1'; /*bn_ce_id_menu='.$GLOBALS['_BAZAR_']['categorie_nature'];*/
1033
	$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
1053
	$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
1034
	if (DB::isError($resultat)) {
1054
	if (DB::isError($resultat)) {
1035
		die ($resultat->getMessage().$resultat->getDebugInfo()) ;
1055
		die ($resultat->getMessage().$resultat->getDebugInfo()) ;
Line 1040... Line 1060...
1040
	                      '<b>'.BAZ_STATUT.'</b>',
1060
	                      '<b>'.BAZ_STATUT.'</b>',
1041
			      '<b>'.BAZ_PASSER_EN.'</b>',
1061
			      '<b>'.BAZ_PASSER_EN.'</b>',
1042
			      '<b>'.BAZ_RSS.'</b>',)) ;
1062
			      '<b>'.BAZ_RSS.'</b>',)) ;
1043
	$table->setRowType (0, 'th') ;
1063
	$table->setRowType (0, 'th') ;
Line 1044... Line 1064...
1044
	
1064
	
-
 
1065
	while ($ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {		
-
 
1066
		$tab_parametres_GET = explode ("&", $_SERVER["argv"][0]) ;
-
 
1067
		foreach ($tab_parametres_GET as $cle_param => $valeur_param) {
-
 
1068
			$tab_valeur = explode ('=', $valeur_param) ;
-
 
1069
			$GLOBALS['_BAZAR_']['url']->addQueryString($tab_valeur[0], $tab_valeur[1]);
-
 
1070
		}
1045
	while ($ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
1071
						
1046
		$lien_s_abonner=$GLOBALS['_BAZAR_']['url'];
1072
		$lien_s_abonner=$GLOBALS['_BAZAR_']['url'];
1047
		$lien_s_abonner->addQueryString('action', BAZ_S_INSCRIRE);
1073
		$lien_s_abonner->addQueryString('action', BAZ_S_INSCRIRE);
1048
		$lien_s_abonner->addQueryString('idtypeannonce', $ligne['bn_id_nature']);
1074
		$lien_s_abonner->addQueryString('idtypeannonce', $ligne['bn_id_nature']);
Line 1052... Line 1078...
1052
		$lien_se_desabonner->addQueryString('action', BAZ_S_INSCRIRE);
1078
		$lien_se_desabonner->addQueryString('action', BAZ_S_INSCRIRE);
1053
		$lien_se_desabonner->addQueryString('idtypeannonce', $ligne['bn_id_nature']);
1079
		$lien_se_desabonner->addQueryString('idtypeannonce', $ligne['bn_id_nature']);
1054
		$lien_se_desabonner->addQueryString('inscrip', 0);
1080
		$lien_se_desabonner->addQueryString('inscrip', 0);
Line 1055... Line 1081...
1055
		
1081
		
1056
		$lien_RSS=$GLOBALS['_BAZAR_']['url'];
1082
		$lien_RSS=$GLOBALS['_BAZAR_']['url'];
1057
		$lien_RSS->addQueryString('action', BAZ_VOIR_FLUX_RSS);
-
 
1058
		
-
 
Line 1059... Line 1083...
1059
		'http://'.$_SERVER['HTTP_HOST'].'/client/bazar/bazarRSS.php?annonce='.$ligne['bn_id_nature'];
1083
		$lien_RSS->addQueryString('action', BAZ_VOIR_FLUX_RSS);						
1060
		
1084
		
1061
		//requete pour savoir si la personne est inscrite à ce type d'annonce
1085
		//requete pour savoir si la personne est inscrite a ce type d'annonce
1062
		$requete = 'SELECT ba_id_utilisateur '.
1086
		$requete = 'SELECT ba_id_utilisateur '.
1063
		           'FROM bazar_abonnement '.
1087
		           'FROM bazar_abonnement '.
1064
			       'WHERE ba_id_utilisateur='.$GLOBALS['id_user'].' AND ba_id_rubrique='.$ligne['bn_id_nature'];
1088
			       'WHERE ba_id_utilisateur='.$GLOBALS['id_user'].' AND ba_id_rubrique='.$ligne['bn_id_nature'];
Line 1090... Line 1114...
1090
	$table->updateColAttributes(1, array('align' => 'center'));
1114
	$table->updateColAttributes(1, array('align' => 'center'));
1091
	$table->updateColAttributes(2, array('align' => 'center'));
1115
	$table->updateColAttributes(2, array('align' => 'center'));
1092
	$table->updateColAttributes(3, array('style' => 'text-align:center;'));
1116
	$table->updateColAttributes(3, array('style' => 'text-align:center;'));
1093
	$res.=$table->toHTML() ;
1117
	$res.=$table->toHTML() ;
1094
	}
1118
	}
-
 
1119
	else { 
1095
	else $res .= '<p class="zone_info">'.BAZ_IDENTIFIEZ_VOUS_POUR_SAISIR.'</p>'."\n";
1120
		$res .= '<p class="zone_info">'.BAZ_IDENTIFIEZ_VOUS_POUR_SAISIR.'</p>'."\n" ;
-
 
1121
		$res .= '<form id="form_connexion" style="clear:both;" class="form_identification" action="' ;
-
 
1122
		$GLOBALS['_BAZAR_']['url']->addQueryString('action', BAZ_S_INSCRIRE);
-
 
1123
		$res .= $GLOBALS['_BAZAR_']['url']->getURL();
-
 
1124
		$res .= '" method="post">
-
 
1125
                <fieldset>
-
 
1126
                    <legend>Identifiez vous</legend>                    
-
 
1127
                        <label for="username">Courriel : </label>
-
 
1128
                        <input type="text"  id="username" name="username" maxlength="80" tabindex="1" value="courriel" />                    
-
 
1129
                        <label for="password">Mot de passe : </label>
-
 
1130
                        <input type="password" id="password" name="password" maxlength="80" tabindex="2" value="mot de passe" />                    
-
 
1131
                        <input type="submit" id="connexion" name="connexion" tabindex="3" value="ok" />                    
-
 
1132
                </fieldset>
-
 
1133
                </form>';
-
 
1134
	}
Line 1096... Line 1135...
1096
	
1135
	
1097
	return $res;
1136
	return $res;
Line 1127... Line 1166...
1127
            	$val .= $result[0];
1166
            	$val .= $result[0];
1128
            	$nb++;
1167
            	$nb++;
1129
            }
1168
            }
1130
     		$valeurs_fiche[$tableau[$i]['type'].$tableau[$i]['nom_bdd']] = $val;
1169
     		$valeurs_fiche[$tableau[$i]['type'].$tableau[$i]['nom_bdd']] = $val;
1131
     	}
1170
     	}
1132
     	elseif ($tableau[$i]['type']=='texte' || $tableau[$i]['type']=='textelong' || $tableau[$i]['type']=='listedatedeb' || $tableau[$i]['type']=='listedatefin' || $tableau[$i]['type']=='wikini') {
1171
     	elseif ($tableau[$i]['type']=='texte' || $tableau[$i]['type']=='textelong' || $tableau[$i]['type']=='listedatedeb' || $tableau[$i]['type']=='listedatefin') {
1133
     		$valeurs_fiche[$tableau[$i]['nom_bdd']] = stripslashes($ligne[$tableau[$i]['nom_bdd']]);
1172
     		$valeurs_fiche[$tableau[$i]['nom_bdd']] = stripslashes($ligne[$tableau[$i]['nom_bdd']]);
1134
     	}	     
1173
     	}	     
1135
	}
1174
	}
1136
	return $valeurs_fiche;
1175
	return $valeurs_fiche;
1137
}
1176
}
Line 1214... Line 1253...
1214
}
1253
}
Line 1215... Line 1254...
1215
 
1254
 
1216
/* +--Fin du code ----------------------------------------------------------------------------------------+
1255
/* +--Fin du code ----------------------------------------------------------------------------------------+
1217
*
1256
*
-
 
1257
* $Log: not supported by cvs2svn $
-
 
1258
* Revision 1.56  2006/09/28 15:41:36  alexandre_tb
-
 
1259
* Le formulaire pour se logguer dans l'action saisir reste sur l'action saisir après
1218
* $Log: not supported by cvs2svn $
1260
*
1219
* Revision 1.55  2006/09/21 14:19:39  florian
1261
* Revision 1.55  2006/09/21 14:19:39  florian
1220
* amélioration des fonctions liés au wikini
1262
* amélioration des fonctions liés au wikini
1221
*
1263
*
1222
* Revision 1.54  2006/09/14 15:11:23  alexandre_tb
1264
* Revision 1.54  2006/09/14 15:11:23  alexandre_tb