Subversion Repositories Applications.papyrus

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
427 florian 1
<?php
2
/*vim: set expandtab tabstop=4 shiftwidth=4: */
3
// +------------------------------------------------------------------------------------------------------+
4
// | PHP version 4.1                                                                                      |
5
// +------------------------------------------------------------------------------------------------------+
6
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org)                                         |
7
// +------------------------------------------------------------------------------------------------------+
8
// | This library is free software; you can redistribute it and/or                                        |
9
// | modify it under the terms of the GNU Lesser General Public                                           |
10
// | License as published by the Free Software Foundation; either                                         |
11
// | version 2.1 of the License, or (at your option) any later version.                                   |
12
// |                                                                                                      |
13
// | This library is distributed in the hope that it will be useful,                                      |
14
// | but WITHOUT ANY WARRANTY; without even the implied warranty of                                       |
15
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU                                    |
16
// | Lesser General Public License for more details.                                                      |
17
// |                                                                                                      |
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                                  |
20
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                            |
21
// +------------------------------------------------------------------------------------------------------+
22
// CVS : $Id: bazar.php,v 1.4 2005-07-21 19:03:12 florian Exp $
23
/**
24
*
25
*@package bazar
26
//Auteur original :
27
*@author        Alexandre GRANIER <alexandre@tela-botanica.org>
28
*@author        Florian Schmitt <florian@ecole-et-nature.org>
29
//Autres auteurs :
30
*@copyright     Tela-Botanica 2000-2004
31
*@version       $Revision: 1.4 $ $Date: 2005-07-21 19:03:12 $
32
// +------------------------------------------------------------------------------------------------------+
33
*/
34
 
35
// +------------------------------------------------------------------------------------------------------+
36
// |                             LES CONSTANTES DES ACTIONS DE BAZAR                                      |
37
// +------------------------------------------------------------------------------------------------------+
38
 
39
define ('BAZ_VOIR_VOS_ANNONCES', 0);
40
define ('BAZ_VOIR_TOUTES_ANNONCES', 1) ;
41
define ('BAZ_RECHERCHER_ANNONCE', 2) ;
42
define ('BAZ_DEPOSER_ANNONCE', 3) ;
43
define ('BAZ_ANNONCES_A_VALIDER', 4) ;
44
define ('BAZ_GERER_DROITS', 5) ;
45
define ('BAZ_ADMINISTRER_ANNONCES', 6) ;
46
define ('BAZ_MODIFIER_FICHE', 7) ;
47
define ('BAZ_VOIR_FICHE', 8) ;
48
define ('BAZ_SUPPRIMER_FICHE', 9) ;
49
define ('BAZ_ACTION_NOUVEAU', 10) ;
50
define ('BAZ_ACTION_NOUVEAU_V', 11) ;
51
define ('BAZ_ACTION_MODIFIER', 12) ;
52
define ('BAZ_ACTION_MODIFIER_V', 13) ;
53
define ('BAZ_ACTION_SUPPRESSION', 14) ;
54
define ('BAZ_ACTION_PUBLIER', 15) ;
55
define ('BAZ_ACTION_PAS_PUBLIER', 16) ;
56
define ('BAZ_S_INSCRIRE', 17);
57
define ('BAZ_VOIR_FLUX_RSS', 18);
58
 
59
 
60
// +------------------------------------------------------------------------------------------------------+
61
// |                                            ENTETE du PROGRAMME                                       |
62
// +------------------------------------------------------------------------------------------------------+
63
 
64
error_reporting(E_ALL);
65
include_once 'DB.php' ;
66
include_once 'Auth.php' ;
67
include_once 'configuration/baz_config.inc.php'; //fichier de configuration de Bazar
68
include_once 'bibliotheque/bazar.fonct.php'; //fichier des fonctions de Bazar
69
 
70
if (defined('PAP_VERSION')) { //si on est dans Papyrus
71
	GEN_stockerStyleExterne( 'bazar_interne', 'client/bazar/bazar.interne.css');
72
}
73
 
74
// +------------------------------------------------------------------------------------------------------+
75
// |                                           LISTE de FONCTIONS                                         |
76
// +------------------------------------------------------------------------------------------------------+
77
 
78
function afficherContenuCorps() {
79
 
80
	$GLOBALS['id_user']=$GLOBALS['AUTH']->getAuthData(BAZ_CHAMPS_ID);
81
 
82
	$res = '';
83
 
84
	//---------------l'entête de l'appli-----------
85
	$res.='<div id="BAZ_hautdepage">'."\n";
86
	$res.='<h1>'.BAZ_TITREAPPLI.'</h1>'."\n";
87
	$res.='</div>'."\n";
88
 
89
	//---------------le menu de l'appli-----------
90
	$res.='<div id="BAZ_menu">'."\n";
91
	$res .='<ul>'."\n";
92
	$GLOBALS['_BAZAR_']['url']->addQueryString('action', BAZ_VOIR_TOUTES_ANNONCES);
93
	$GLOBALS['_BAZAR_']['url']->addQueryString('nature', 'toutes');
94
	//partie consultation d'annonces
95
	$res .= '<li><a href="'.$GLOBALS['_BAZAR_']['url']->getURL().'">'.BAZ_CONSULTER.'</a>'."\n".'<ul>'."\n";
96
	$GLOBALS['_BAZAR_']['url']->removeQueryString('nature');
97
 
98
	$requete = 'SELECT bn_id_nature, bn_label_nature FROM bazar_nature' ;
99
	$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
100
	if (DB::isError($resultat)) {
101
		die ($resultat->getMessage().$resultat->getDebugInfo()) ;
102
	}
103
	while ($ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
104
		$GLOBALS['_BAZAR_']['url']->addQueryString('nature', $ligne['bn_label_nature']);
105
		$res .='<li><a href="'.$GLOBALS['_BAZAR_']['url']->getURL().'">'.$ligne['bn_label_nature'].'</a></li>'."\n";
106
		$GLOBALS['_BAZAR_']['url']->removeQueryString('nature');
107
	}
108
 
109
	$GLOBALS['_BAZAR_']['url']->addQueryString('nature', 'toutes');
110
	$res .='<li><a href="'.$GLOBALS['_BAZAR_']['url']->getURL().'">'.BAZ_TOUTES_LES_ANNONCES.'</a></li></ul></li>'."\n";
111
	$GLOBALS['_BAZAR_']['url']->removeQueryString('nature');
112
	$GLOBALS['_BAZAR_']['url']->removeQueryString('action');
113
 
114
 
115
	//partie recherche d'annonces
116
	$GLOBALS['_BAZAR_']['url']->addQueryString('action', BAZ_RECHERCHER_ANNONCE);
117
	$res .='<li><a href="'.$GLOBALS['_BAZAR_']['url']->getURL().'">'.BAZ_RECHERCHER_DES_ANNONCES.'</a></li>'."\n";
118
	$GLOBALS['_BAZAR_']['url']->removeQueryString('action');
119
 
120
	//pour les identifiés seulement
121
	if ($GLOBALS['AUTH']->getAuth()) {
122
		//partie abonnement aux annonces
123
		$GLOBALS['_BAZAR_']['url']->addQueryString('action', BAZ_S_INSCRIRE);
124
		$res .= '<li><a href="'.$GLOBALS['_BAZAR_']['url']->getURL().'">'.BAZ_S_INSCRIRE_AUX_ANNONCES.'</a></li>'."\n" ;
125
		$GLOBALS['_BAZAR_']['url']->removeQueryString('action');
126
 
127
		//partie saisie d'annonces
128
		$GLOBALS['_BAZAR_']['url']->addQueryString('action', BAZ_DEPOSER_ANNONCE);
129
		$res .= '<li><a href="'.$GLOBALS['_BAZAR_']['url']->getURL().'">'.BAZ_SAISIR.'</a>'."\n".'<ul>'."\n";
130
		$res .= '<li><a href="'.$GLOBALS['_BAZAR_']['url']->getURL().'">'.BAZ_DEPOSE_UNE_NOUVELLE_ANNONCE.'</a></li>'."\n" ;
131
		$GLOBALS['_BAZAR_']['url']->removeQueryString('action');
132
 
133
		//annonces propres
134
		$GLOBALS['_BAZAR_']['url']->addQueryString('action', BAZ_VOIR_VOS_ANNONCES);
135
		$res .='<li><a href="'.$GLOBALS['_BAZAR_']['url']->getURL().'">'.BAZ_VOS_ANNONCES.'</a></li>'."\n";
136
		$GLOBALS['_BAZAR_']['url']->removeQueryString('action');
137
		$res .='</ul></li>'."\n";
138
 
139
 
140
		//choix des administrateurs
141
		$est_admin=0;
142
		$requete='SELECT bn_id_nature FROM bazar_nature';
143
		$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
144
		if (DB::isError($resultat)) {
145
			die ($resultat->getMessage().$resultat->getDebugInfo()) ;
146
		}
147
		while ($ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
148
			if ((niveau_droit($ligne['bn_id_nature'],$GLOBALS['AUTH']->getAuthData(BAZ_CHAMPS_ID)))=='administrateur') {
149
				$est_admin=1;
150
			}
151
		}
152
		if (($est_admin)or(niveau_droit($id_nature_offre='0',$GLOBALS['AUTH']->getAuthData(BAZ_CHAMPS_ID))=='superadministrateur')) {
153
			//partie administrer
154
			$GLOBALS['_BAZAR_']['url']->addQueryString('action', BAZ_ANNONCES_A_VALIDER);
155
			$res .= '<li><a href="'.$GLOBALS['_BAZAR_']['url']->getURL().'">'.BAZ_ADMINISTRER.'</a><ul>'."\n";
156
			$res .= '<li><a href="'.$GLOBALS['_BAZAR_']['url']->getURL().'">'.BAZ_ANNONCES_A_ADMINISTRER.'</a></li>'."\n" ;
157
			$GLOBALS['_BAZAR_']['url']->removeQueryString('action');
158
 
159
			if (niveau_droit($id_nature_offre='0',$GLOBALS['AUTH']->getAuthData(BAZ_CHAMPS_ID))=='superadministrateur') {
160
				$GLOBALS['_BAZAR_']['url']->addQueryString('action', BAZ_GERER_DROITS);
161
				$res .= '<li><a href="'.$GLOBALS['_BAZAR_']['url']->getURL().'">'.BAZ_GESTION_DES_DROITS.'</a></li>'."\n" ;
162
				$GLOBALS['_BAZAR_']['url']->removeQueryString('action');
163
 
164
				$GLOBALS['_BAZAR_']['url']->addQueryString('action', BAZ_ADMINISTRER_ANNONCES);
165
				$res .= '<li><a href="'.$GLOBALS['_BAZAR_']['url']->getURL().'">'.BAZ_ADMIN_ANNONCES.'</a></li>'."\n" ;
166
				$GLOBALS['_BAZAR_']['url']->removeQueryString('action');
167
			}
168
			$res .= '</ul></li>'."\n";
169
			$res.= '</ul>'."\n";
170
		}
171
	}
172
	else $res .='<li><span style="color:#02587B;">'.BAZ_IDENTIFIEZ_VOUS_POUR_SAISIR.'</span></li></ul>';
173
 
174
 
175
	$res.='</div>'."\n";
176
 
177
	//le corps de l'appli
178
	$res.='<div id="BAZ_corps">'."\n";
179
	if (isset($_GET['action'])) {
180
		switch ($_GET['action']) {
181
			case BAZ_VOIR_VOS_ANNONCES : $res .= mes_fiches(); break;
182
			case BAZ_VOIR_TOUTES_ANNONCES : $res .= baz_liste($_GET['nature'],'',''); break;
183
			case BAZ_RECHERCHER_ANNONCE : $res .= baz_rechercher(); break;
184
			case BAZ_DEPOSER_ANNONCE : $res .= baz_formulaire(BAZ_DEPOSER_ANNONCE); break;
185
			case BAZ_ANNONCES_A_VALIDER : $res .= fiches_a_valider(); break;
186
			case BAZ_ADMINISTRER_ANNONCES : $res .= baz_administrer_annonces(); break;
187
			case BAZ_MODIFIER_FICHE : $res .= baz_formulaire(BAZ_ACTION_MODIFIER); break;
188
			case BAZ_SUPPRIMER_FICHE : $res .= baz_suppression().baz_liste('',$GLOBALS['id_user'],''); break;
189
			case BAZ_VOIR_FICHE : $res .= baz_voir_fiche(1); break;
190
			case BAZ_ACTION_NOUVEAU : $res .= baz_formulaire(BAZ_ACTION_NOUVEAU); break;
191
			case BAZ_ACTION_NOUVEAU_V : $res .= baz_formulaire().mes_fiches(); break;
192
			case BAZ_ACTION_MODIFIER : $res .= baz_formulaire(BAZ_ACTION_MODIFIER); break;
193
			case BAZ_ACTION_MODIFIER_V : $res .= baz_formulaire(BAZ_ACTION_MODIFIER_V).mes_fiches(); break;
194
			case BAZ_ACTION_SUPPRESSION : $res .= baz_suppression().mes_fiches(); break;
195
			case BAZ_ACTION_PUBLIER : publier_fiche(1) ;$res .= fiches_a_valider(); break;
196
			case BAZ_ACTION_PAS_PUBLIER : publier_fiche(0) ;$res .= fiches_a_valider(); break;
197
			case BAZ_GERER_DROITS : $res .= baz_formulaire(BAZ_GERER_DROITS); break;
198
			case BAZ_S_INSCRIRE : $res .= baz_s_inscrire(); break;
199
			case BAZ_VOIR_FLUX_RSS : header('Content-type: text/xml; charset=ISO-8859-1');include("bazarRSS.php");exit(0);break;
200
			default : $res .= accueil() ;
201
		}
202
	}
203
	else {
204
		$res .= baz_liste('toutes','','');
205
	}
206
	$res.='</div>'."\n";
207
	return $res ;
208
}
209
 
210
 
211
/* +--Fin du code ----------------------------------------------------------------------------------------+
212
*
213
* $Log: not supported by cvs2svn $
214
* Revision 1.2  2005/02/22 15:33:32  florian
215
* integration dans Papyrus
216
*
217
* Revision 1.1.1.1  2005/02/17 18:05:11  florian
218
* Import initial de Bazar
219
*
220
* Revision 1.1.1.1  2005/02/17 11:09:50  florian
221
* Import initial
222
*
223
* Revision 1.1.1.1  2005/02/16 18:06:35  florian
224
* import de la nouvelle version
225
*
226
* Revision 1.3  2004/07/05 15:10:14  florian
227
* changement interface de saisie
228
*
229
* Revision 1.2  2004/07/01 10:13:41  florian
230
* modif Florian
231
*
232
* Revision 1.1  2004/06/23 09:58:32  alex
233
* version initiale
234
*
235
* Revision 1.1  2004/06/18 09:00:07  alex
236
* version initiale
237
*
238
*
239
* +-- Fin du code ----------------------------------------------------------------------------------------+
240
*/
241
?>