5 |
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 |
// +------------------------------------------------------------------------------------------------------+
|
59 |
florian |
22 |
// CVS : $Id: bazar.php,v 1.18 2005-12-02 10:57:03 florian Exp $
|
5 |
florian |
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
|
59 |
florian |
31 |
*@version $Revision: 1.18 $ $Date: 2005-12-02 10:57:03 $
|
5 |
florian |
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) ;
|
30 |
ddelon |
47 |
if (!defined('BAZ_VOIR_FICHE')) define ('BAZ_VOIR_FICHE', 8) ;
|
5 |
florian |
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);
|
57 |
florian |
65 |
require_once 'DB.php' ;
|
|
|
66 |
require_once 'Auth.php' ;
|
54 |
florian |
67 |
require_once 'configuration/baz_config.inc.php'; //fichier de configuration de Bazar
|
|
|
68 |
require_once 'bibliotheque/bazar.fonct.php'; //fichier des fonctions de Bazar
|
5 |
florian |
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 = '';
|
54 |
florian |
83 |
|
5 |
florian |
84 |
//---------------l'entête de l'appli-----------
|
|
|
85 |
$res.='<div id="BAZ_hautdepage">'."\n";
|
7 |
florian |
86 |
$res.='<h1>'.$GLOBALS['_GEN_commun']['info_menu']->gm_titre.'</h1>'."\n";
|
5 |
florian |
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
|
22 |
florian |
95 |
$res .= '<li><a href="'.$GLOBALS['_BAZAR_']['url']->getURL().'">'.BAZ_CONSULTER.'</a>'."\n".'</li>'."\n";
|
5 |
florian |
96 |
$GLOBALS['_BAZAR_']['url']->removeQueryString('nature');
|
45 |
florian |
97 |
|
|
|
98 |
//partie abonnement aux annonces
|
|
|
99 |
$GLOBALS['_BAZAR_']['url']->addQueryString('action', BAZ_S_INSCRIRE);
|
|
|
100 |
$res .= '<li><a href="'.$GLOBALS['_BAZAR_']['url']->getURL().'">'.BAZ_S_ABONNER.'</a></li>'."\n" ;
|
5 |
florian |
101 |
$GLOBALS['_BAZAR_']['url']->removeQueryString('action');
|
45 |
florian |
102 |
|
|
|
103 |
//partie saisie d'annonces
|
|
|
104 |
$GLOBALS['_BAZAR_']['url']->addQueryString('action', BAZ_DEPOSER_ANNONCE);
|
|
|
105 |
$res .= '<li><a href="'.$GLOBALS['_BAZAR_']['url']->getURL().'">'.BAZ_SAISIR.'</a>'."\n".'<ul>'."\n";
|
|
|
106 |
$res .= '<li><a href="'.$GLOBALS['_BAZAR_']['url']->getURL().'">'.BAZ_DEPOSE_UNE_NOUVELLE_ANNONCE.'</a></li>'."\n" ;
|
5 |
florian |
107 |
$GLOBALS['_BAZAR_']['url']->removeQueryString('action');
|
45 |
florian |
108 |
|
|
|
109 |
//annonces propres
|
|
|
110 |
$GLOBALS['_BAZAR_']['url']->addQueryString('action', BAZ_VOIR_VOS_ANNONCES);
|
|
|
111 |
$res .='<li><a href="'.$GLOBALS['_BAZAR_']['url']->getURL().'">'.BAZ_VOS_ANNONCES.'</a></li>'."\n";
|
|
|
112 |
$GLOBALS['_BAZAR_']['url']->removeQueryString('action');
|
|
|
113 |
$res .='</ul></li>'."\n";
|
5 |
florian |
114 |
|
45 |
florian |
115 |
//choix des administrateurs
|
|
|
116 |
$est_admin=0;
|
|
|
117 |
if ($GLOBALS['AUTH']->getAuth()) {
|
|
|
118 |
$requete='SELECT bn_id_nature FROM bazar_nature';
|
|
|
119 |
$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
|
|
|
120 |
if (DB::isError($resultat)) {
|
|
|
121 |
die ($resultat->getMessage().$resultat->getDebugInfo()) ;
|
|
|
122 |
}
|
|
|
123 |
while ($ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
|
|
|
124 |
if ((niveau_droit($ligne['bn_id_nature'],$GLOBALS['AUTH']->getAuthData(BAZ_CHAMPS_ID)))=='administrateur') {
|
|
|
125 |
$est_admin=1;
|
|
|
126 |
}
|
|
|
127 |
}
|
|
|
128 |
if (($est_admin)or(niveau_droit($id_nature_offre='0',$GLOBALS['AUTH']->getAuthData(BAZ_CHAMPS_ID))=='superadministrateur')) {
|
|
|
129 |
//partie administrer
|
|
|
130 |
$GLOBALS['_BAZAR_']['url']->addQueryString('action', BAZ_ANNONCES_A_VALIDER);
|
|
|
131 |
$res .= '<li><a href="'.$GLOBALS['_BAZAR_']['url']->getURL().'">'.BAZ_ADMINISTRER.'</a><ul>'."\n";
|
|
|
132 |
$res .= '<li><a href="'.$GLOBALS['_BAZAR_']['url']->getURL().'">'.BAZ_ANNONCES_A_ADMINISTRER.'</a></li>'."\n" ;
|
5 |
florian |
133 |
$GLOBALS['_BAZAR_']['url']->removeQueryString('action');
|
|
|
134 |
|
45 |
florian |
135 |
if (niveau_droit($id_nature_offre='0',$GLOBALS['AUTH']->getAuthData(BAZ_CHAMPS_ID))=='superadministrateur') {
|
|
|
136 |
$GLOBALS['_BAZAR_']['url']->addQueryString('action', BAZ_GERER_DROITS);
|
|
|
137 |
$res .= '<li><a href="'.$GLOBALS['_BAZAR_']['url']->getURL().'">'.BAZ_GESTION_DES_DROITS.'</a></li>'."\n" ;
|
5 |
florian |
138 |
$GLOBALS['_BAZAR_']['url']->removeQueryString('action');
|
|
|
139 |
|
45 |
florian |
140 |
$GLOBALS['_BAZAR_']['url']->addQueryString('action', BAZ_ADMINISTRER_ANNONCES);
|
|
|
141 |
$res .= '<li><a href="'.$GLOBALS['_BAZAR_']['url']->getURL().'">'.BAZ_ADMIN_ANNONCES.'</a></li>'."\n" ;
|
|
|
142 |
$GLOBALS['_BAZAR_']['url']->removeQueryString('action');
|
|
|
143 |
}
|
|
|
144 |
$res .= '</ul></li>'."\n";
|
|
|
145 |
}
|
22 |
florian |
146 |
}
|
|
|
147 |
$res.= '</ul>'."\n";
|
5 |
florian |
148 |
$res.='</div>'."\n";
|
|
|
149 |
|
|
|
150 |
//le corps de l'appli
|
|
|
151 |
$res.='<div id="BAZ_corps">'."\n";
|
59 |
florian |
152 |
|
|
|
153 |
//si un parametre est précisé dans le gestionnaire de menus papyrus, on le prends en compte
|
|
|
154 |
if (!isset($_GET['action'])and(isset($GLOBALS['_GEN_commun']['info_application']->action))) {
|
|
|
155 |
$_GET['action']=$GLOBALS['_GEN_commun']['info_application']->action;
|
|
|
156 |
}
|
5 |
florian |
157 |
if (isset($_GET['action'])) {
|
|
|
158 |
switch ($_GET['action']) {
|
|
|
159 |
case BAZ_VOIR_VOS_ANNONCES : $res .= mes_fiches(); break;
|
22 |
florian |
160 |
case BAZ_VOIR_TOUTES_ANNONCES : $res .= baz_liste($_REQUEST['nature'],'',''); break;
|
5 |
florian |
161 |
case BAZ_RECHERCHER_ANNONCE : $res .= baz_rechercher(); break;
|
|
|
162 |
case BAZ_DEPOSER_ANNONCE : $res .= baz_formulaire(BAZ_DEPOSER_ANNONCE); break;
|
|
|
163 |
case BAZ_ANNONCES_A_VALIDER : $res .= fiches_a_valider(); break;
|
|
|
164 |
case BAZ_ADMINISTRER_ANNONCES : $res .= baz_administrer_annonces(); break;
|
|
|
165 |
case BAZ_MODIFIER_FICHE : $res .= baz_formulaire(BAZ_ACTION_MODIFIER); break;
|
|
|
166 |
case BAZ_SUPPRIMER_FICHE : $res .= baz_suppression().baz_liste('',$GLOBALS['id_user'],''); break;
|
|
|
167 |
case BAZ_VOIR_FICHE : $res .= baz_voir_fiche(1); break;
|
|
|
168 |
case BAZ_ACTION_NOUVEAU : $res .= baz_formulaire(BAZ_ACTION_NOUVEAU); break;
|
56 |
florian |
169 |
case BAZ_ACTION_NOUVEAU_V : $res .= baz_formulaire(BAZ_ACTION_NOUVEAU_V).mes_fiches(); break;
|
5 |
florian |
170 |
case BAZ_ACTION_MODIFIER : $res .= baz_formulaire(BAZ_ACTION_MODIFIER); break;
|
|
|
171 |
case BAZ_ACTION_MODIFIER_V : $res .= baz_formulaire(BAZ_ACTION_MODIFIER_V).mes_fiches(); break;
|
|
|
172 |
case BAZ_ACTION_SUPPRESSION : $res .= baz_suppression().mes_fiches(); break;
|
|
|
173 |
case BAZ_ACTION_PUBLIER : publier_fiche(1) ;$res .= fiches_a_valider(); break;
|
|
|
174 |
case BAZ_ACTION_PAS_PUBLIER : publier_fiche(0) ;$res .= fiches_a_valider(); break;
|
|
|
175 |
case BAZ_GERER_DROITS : $res .= baz_formulaire(BAZ_GERER_DROITS); break;
|
|
|
176 |
case BAZ_S_INSCRIRE : $res .= baz_s_inscrire(); break;
|
|
|
177 |
case BAZ_VOIR_FLUX_RSS : header('Content-type: text/xml; charset=ISO-8859-1');include("bazarRSS.php");exit(0);break;
|
|
|
178 |
default : $res .= accueil() ;
|
|
|
179 |
}
|
|
|
180 |
}
|
|
|
181 |
else {
|
|
|
182 |
$res .= baz_liste('toutes','','');
|
|
|
183 |
}
|
|
|
184 |
$res.='</div>'."\n";
|
|
|
185 |
return $res ;
|
|
|
186 |
}
|
|
|
187 |
|
|
|
188 |
|
|
|
189 |
/* +--Fin du code ----------------------------------------------------------------------------------------+
|
|
|
190 |
*
|
10 |
ddelon |
191 |
* $Log: not supported by cvs2svn $
|
59 |
florian |
192 |
* Revision 1.17 2005/12/01 16:05:41 florian
|
|
|
193 |
* changement des chemins pour appli Pear
|
|
|
194 |
*
|
57 |
florian |
195 |
* Revision 1.16 2005/12/01 15:31:30 florian
|
|
|
196 |
* correction bug modifs et saisies
|
|
|
197 |
*
|
56 |
florian |
198 |
* Revision 1.15 2005/11/30 13:58:45 florian
|
|
|
199 |
* ajouts graphisme (logos, boutons), changement structure SQL bazar_fiche
|
|
|
200 |
*
|
55 |
florian |
201 |
* Revision 1.14 2005/11/24 16:17:13 florian
|
|
|
202 |
* corrections bugs, ajout des cases à cocher
|
|
|
203 |
*
|
54 |
florian |
204 |
* Revision 1.13 2005/11/14 16:04:54 florian
|
|
|
205 |
* maj bug affichage flux
|
|
|
206 |
*
|
51 |
florian |
207 |
* Revision 1.12 2005/11/07 17:05:46 florian
|
|
|
208 |
* amélioration validation conditions de saisie, ajout des règles spécifiques de saisie des formulaires
|
|
|
209 |
*
|
45 |
florian |
210 |
* Revision 1.11 2005/10/21 16:15:04 florian
|
|
|
211 |
* mise a jour appropriation
|
|
|
212 |
*
|
39 |
florian |
213 |
* Revision 1.10 2005/10/12 17:20:33 ddelon
|
|
|
214 |
* Reorganisation calendrier + applette
|
|
|
215 |
*
|
30 |
ddelon |
216 |
* Revision 1.9 2005/10/12 13:35:07 florian
|
|
|
217 |
* amélioration de l'interface de bazar, de manière a simplifier les consultations, et à harmoniser par rapport aux Ressources
|
|
|
218 |
*
|
22 |
florian |
219 |
* Revision 1.8 2005/09/30 13:00:05 ddelon
|
|
|
220 |
* Fiche bazar generique
|
|
|
221 |
*
|
11 |
ddelon |
222 |
* Revision 1.7 2005/09/30 12:34:44 ddelon
|
|
|
223 |
* petite modification pour integration bazar dans papyrus
|
|
|
224 |
*
|
10 |
ddelon |
225 |
* Revision 1.6 2005/09/30 12:22:54 florian
|
|
|
226 |
* Ajouts commentaires pour fiche, modifications graphiques, maj SQL
|
|
|
227 |
*
|
7 |
florian |
228 |
* Revision 1.4 2005/07/21 19:03:12 florian
|
|
|
229 |
* nouveautés bazar: templates fiches, correction de bugs, ...
|
|
|
230 |
*
|
5 |
florian |
231 |
* Revision 1.2 2005/02/22 15:33:32 florian
|
|
|
232 |
* integration dans Papyrus
|
|
|
233 |
*
|
|
|
234 |
* Revision 1.1.1.1 2005/02/17 18:05:11 florian
|
|
|
235 |
* Import initial de Bazar
|
|
|
236 |
*
|
|
|
237 |
* Revision 1.1.1.1 2005/02/17 11:09:50 florian
|
|
|
238 |
* Import initial
|
|
|
239 |
*
|
|
|
240 |
* Revision 1.1.1.1 2005/02/16 18:06:35 florian
|
|
|
241 |
* import de la nouvelle version
|
|
|
242 |
*
|
|
|
243 |
* Revision 1.3 2004/07/05 15:10:14 florian
|
|
|
244 |
* changement interface de saisie
|
|
|
245 |
*
|
|
|
246 |
* Revision 1.2 2004/07/01 10:13:41 florian
|
|
|
247 |
* modif Florian
|
|
|
248 |
*
|
|
|
249 |
* Revision 1.1 2004/06/23 09:58:32 alex
|
|
|
250 |
* version initiale
|
|
|
251 |
*
|
|
|
252 |
* Revision 1.1 2004/06/18 09:00:07 alex
|
|
|
253 |
* version initiale
|
|
|
254 |
*
|
|
|
255 |
*
|
|
|
256 |
* +-- Fin du code ----------------------------------------------------------------------------------------+
|
|
|
257 |
*/
|
|
|
258 |
?>
|