Rev 488 | Blame | Last modification | View Log | RSS feed
<?php/*vim: set expandtab tabstop=4 shiftwidth=4: */// +------------------------------------------------------------------------------------------------------+// | PHP version 4.1 |// +------------------------------------------------------------------------------------------------------+// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |// +------------------------------------------------------------------------------------------------------+// | This library is free software; you can redistribute it and/or |// | modify it under the terms of the GNU Lesser General Public |// | License as published by the Free Software Foundation; either |// | version 2.1 of the License, or (at your option) any later version. |// | |// | This library is distributed in the hope that it will be useful, |// | but WITHOUT ANY WARRANTY; without even the implied warranty of |// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |// | Lesser General Public License for more details. |// | |// | You should have received a copy of the GNU Lesser General Public |// | License along with this library; if not, write to the Free Software |// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |// +------------------------------------------------------------------------------------------------------+// CVS : $Id: bazar.php,v 1.7 2005-09-30 12:34:44 ddelon Exp $/****@package bazar//Auteur original :*@author Alexandre GRANIER <alexandre@tela-botanica.org>*@author Florian Schmitt <florian@ecole-et-nature.org>//Autres auteurs :*@copyright Tela-Botanica 2000-2004*@version $Revision: 1.7 $ $Date: 2005-09-30 12:34:44 $// +------------------------------------------------------------------------------------------------------+*/// +------------------------------------------------------------------------------------------------------+// | LES CONSTANTES DES ACTIONS DE BAZAR |// +------------------------------------------------------------------------------------------------------+define ('BAZ_VOIR_VOS_ANNONCES', 0);define ('BAZ_VOIR_TOUTES_ANNONCES', 1) ;define ('BAZ_RECHERCHER_ANNONCE', 2) ;define ('BAZ_DEPOSER_ANNONCE', 3) ;define ('BAZ_ANNONCES_A_VALIDER', 4) ;define ('BAZ_GERER_DROITS', 5) ;define ('BAZ_ADMINISTRER_ANNONCES', 6) ;define ('BAZ_MODIFIER_FICHE', 7) ;define ('BAZ_VOIR_FICHE', 8) ;define ('BAZ_SUPPRIMER_FICHE', 9) ;define ('BAZ_ACTION_NOUVEAU', 10) ;define ('BAZ_ACTION_NOUVEAU_V', 11) ;define ('BAZ_ACTION_MODIFIER', 12) ;define ('BAZ_ACTION_MODIFIER_V', 13) ;define ('BAZ_ACTION_SUPPRESSION', 14) ;define ('BAZ_ACTION_PUBLIER', 15) ;define ('BAZ_ACTION_PAS_PUBLIER', 16) ;define ('BAZ_S_INSCRIRE', 17);define ('BAZ_VOIR_FLUX_RSS', 18);// +------------------------------------------------------------------------------------------------------+// | ENTETE du PROGRAMME |// +------------------------------------------------------------------------------------------------------+error_reporting(E_ALL);include_once 'DB.php' ;include_once 'Auth.php' ;include_once 'configuration/baz_config.inc.php'; //fichier de configuration de Bazarinclude_once 'bibliotheque/bazar.fonct.php'; //fichier des fonctions de Bazarif (defined('PAP_VERSION')) { //si on est dans PapyrusGEN_stockerStyleExterne( 'bazar_interne', 'client/bazar/bazar.interne.css');}// +------------------------------------------------------------------------------------------------------+// | LISTE de FONCTIONS |// +------------------------------------------------------------------------------------------------------+function afficherContenuCorps() {$GLOBALS['id_user']=$GLOBALS['AUTH']->getAuthData(BAZ_CHAMPS_ID);$res = '';//---------------l'entête de l'appli-----------$res.='<div id="BAZ_hautdepage">'."\n";$res.='<h1>'.$GLOBALS['_GEN_commun']['info_menu']->gm_titre.'</h1>'."\n";$res.='</div>'."\n";//---------------le menu de l'appli-----------$res.='<div id="BAZ_menu">'."\n";$res .='<ul>'."\n";$GLOBALS['_BAZAR_']['url']->addQueryString('action', BAZ_VOIR_TOUTES_ANNONCES);$GLOBALS['_BAZAR_']['url']->addQueryString('nature', 'toutes');//partie consultation d'annonces$res .= '<li><a href="'.$GLOBALS['_BAZAR_']['url']->getURL().'">'.BAZ_CONSULTER.'</a>'."\n".'<ul>'."\n";$GLOBALS['_BAZAR_']['url']->removeQueryString('nature');$requete = 'SELECT bn_id_nature, bn_label_nature FROM bazar_nature WHERE bn_ce_id_menu='.$GLOBALS['_GEN_commun']['info_menu']->gm_id_menu ;$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;if (DB::isError($resultat)) {die ($resultat->getMessage().$resultat->getDebugInfo()) ;}while ($ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {$GLOBALS['_BAZAR_']['url']->addQueryString('nature', $ligne['bn_label_nature']);$res .='<li><a href="'.$GLOBALS['_BAZAR_']['url']->getURL().'">'.$ligne['bn_label_nature'].'</a></li>'."\n";$GLOBALS['_BAZAR_']['url']->removeQueryString('nature');}$GLOBALS['_BAZAR_']['url']->addQueryString('nature', 'toutes');$res .='<li><a href="'.$GLOBALS['_BAZAR_']['url']->getURL().'">'.BAZ_TOUTES_LES_ANNONCES.'</a></li></ul></li>'."\n";$GLOBALS['_BAZAR_']['url']->removeQueryString('nature');$GLOBALS['_BAZAR_']['url']->removeQueryString('action');//partie recherche d'annonces$GLOBALS['_BAZAR_']['url']->addQueryString('action', BAZ_RECHERCHER_ANNONCE);$res .='<li><a href="'.$GLOBALS['_BAZAR_']['url']->getURL().'">'.BAZ_RECHERCHER_DES_ANNONCES.'</a></li>'."\n";$GLOBALS['_BAZAR_']['url']->removeQueryString('action');//pour les identifiés seulementif ($GLOBALS['AUTH']->getAuth()) {//partie abonnement aux annonces$GLOBALS['_BAZAR_']['url']->addQueryString('action', BAZ_S_INSCRIRE);$res .= '<li><a href="'.$GLOBALS['_BAZAR_']['url']->getURL().'">'.BAZ_S_INSCRIRE_AUX_ANNONCES.'</a></li>'."\n" ;$GLOBALS['_BAZAR_']['url']->removeQueryString('action');//partie saisie d'annonces$GLOBALS['_BAZAR_']['url']->addQueryString('action', BAZ_DEPOSER_ANNONCE);$res .= '<li><a href="'.$GLOBALS['_BAZAR_']['url']->getURL().'">'.BAZ_SAISIR.'</a>'."\n".'<ul>'."\n";$res .= '<li><a href="'.$GLOBALS['_BAZAR_']['url']->getURL().'">'.BAZ_DEPOSE_UNE_NOUVELLE_ANNONCE.'</a></li>'."\n" ;$GLOBALS['_BAZAR_']['url']->removeQueryString('action');//annonces propres$GLOBALS['_BAZAR_']['url']->addQueryString('action', BAZ_VOIR_VOS_ANNONCES);$res .='<li><a href="'.$GLOBALS['_BAZAR_']['url']->getURL().'">'.BAZ_VOS_ANNONCES.'</a></li>'."\n";$GLOBALS['_BAZAR_']['url']->removeQueryString('action');$res .='</ul></li>'."\n";//choix des administrateurs$est_admin=0;$requete='SELECT bn_id_nature FROM bazar_nature';$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;if (DB::isError($resultat)) {die ($resultat->getMessage().$resultat->getDebugInfo()) ;}while ($ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {if ((niveau_droit($ligne['bn_id_nature'],$GLOBALS['AUTH']->getAuthData(BAZ_CHAMPS_ID)))=='administrateur') {$est_admin=1;}}if (($est_admin)or(niveau_droit($id_nature_offre='0',$GLOBALS['AUTH']->getAuthData(BAZ_CHAMPS_ID))=='superadministrateur')) {//partie administrer$GLOBALS['_BAZAR_']['url']->addQueryString('action', BAZ_ANNONCES_A_VALIDER);$res .= '<li><a href="'.$GLOBALS['_BAZAR_']['url']->getURL().'">'.BAZ_ADMINISTRER.'</a><ul>'."\n";$res .= '<li><a href="'.$GLOBALS['_BAZAR_']['url']->getURL().'">'.BAZ_ANNONCES_A_ADMINISTRER.'</a></li>'."\n" ;$GLOBALS['_BAZAR_']['url']->removeQueryString('action');if (niveau_droit($id_nature_offre='0',$GLOBALS['AUTH']->getAuthData(BAZ_CHAMPS_ID))=='superadministrateur') {$GLOBALS['_BAZAR_']['url']->addQueryString('action', BAZ_GERER_DROITS);$res .= '<li><a href="'.$GLOBALS['_BAZAR_']['url']->getURL().'">'.BAZ_GESTION_DES_DROITS.'</a></li>'."\n" ;$GLOBALS['_BAZAR_']['url']->removeQueryString('action');$GLOBALS['_BAZAR_']['url']->addQueryString('action', BAZ_ADMINISTRER_ANNONCES);$res .= '<li><a href="'.$GLOBALS['_BAZAR_']['url']->getURL().'">'.BAZ_ADMIN_ANNONCES.'</a></li>'."\n" ;$GLOBALS['_BAZAR_']['url']->removeQueryString('action');}$res .= '</ul></li>'."\n";$res.= '</ul>'."\n";}}else $res .='<li><span style="color:#02587B;">'.BAZ_IDENTIFIEZ_VOUS_POUR_SAISIR.'</span></li></ul>';$res.='</div>'."\n";//le corps de l'appli$res.='<div id="BAZ_corps">'."\n";if (isset($_GET['action'])) {switch ($_GET['action']) {case BAZ_VOIR_VOS_ANNONCES : $res .= mes_fiches(); break;case BAZ_VOIR_TOUTES_ANNONCES : $res .= baz_liste($_GET['nature'],'',''); break;case BAZ_RECHERCHER_ANNONCE : $res .= baz_rechercher(); break;case BAZ_DEPOSER_ANNONCE : $res .= baz_formulaire(BAZ_DEPOSER_ANNONCE); break;case BAZ_ANNONCES_A_VALIDER : $res .= fiches_a_valider(); break;case BAZ_ADMINISTRER_ANNONCES : $res .= baz_administrer_annonces(); break;case BAZ_MODIFIER_FICHE : $res .= baz_formulaire(BAZ_ACTION_MODIFIER); break;case BAZ_SUPPRIMER_FICHE : $res .= baz_suppression().baz_liste('',$GLOBALS['id_user'],''); break;case BAZ_VOIR_FICHE : $res .= baz_voir_fiche(1); break;case BAZ_ACTION_NOUVEAU : $res .= baz_formulaire(BAZ_ACTION_NOUVEAU); break;case BAZ_ACTION_NOUVEAU_V : $res .= baz_formulaire().mes_fiches(); break;case BAZ_ACTION_MODIFIER : $res .= baz_formulaire(BAZ_ACTION_MODIFIER); break;case BAZ_ACTION_MODIFIER_V : $res .= baz_formulaire(BAZ_ACTION_MODIFIER_V).mes_fiches(); break;case BAZ_ACTION_SUPPRESSION : $res .= baz_suppression().mes_fiches(); break;case BAZ_ACTION_PUBLIER : publier_fiche(1) ;$res .= fiches_a_valider(); break;case BAZ_ACTION_PAS_PUBLIER : publier_fiche(0) ;$res .= fiches_a_valider(); break;case BAZ_GERER_DROITS : $res .= baz_formulaire(BAZ_GERER_DROITS); break;case BAZ_S_INSCRIRE : $res .= baz_s_inscrire(); break;case BAZ_VOIR_FLUX_RSS : header('Content-type: text/xml; charset=ISO-8859-1');include("bazarRSS.php");exit(0);break;default : $res .= accueil() ;}}else {$res .= baz_liste('toutes','','');}$res.='</div>'."\n";return $res ;}/* +--Fin du code ----------------------------------------------------------------------------------------+** $Log: not supported by cvs2svn $* Revision 1.6 2005/09/30 12:22:54 florian* Ajouts commentaires pour fiche, modifications graphiques, maj SQL** Revision 1.4 2005/07/21 19:03:12 florian* nouveautés bazar: templates fiches, correction de bugs, ...** Revision 1.2 2005/02/22 15:33:32 florian* integration dans Papyrus** Revision 1.1.1.1 2005/02/17 18:05:11 florian* Import initial de Bazar** Revision 1.1.1.1 2005/02/17 11:09:50 florian* Import initial** Revision 1.1.1.1 2005/02/16 18:06:35 florian* import de la nouvelle version** Revision 1.3 2004/07/05 15:10:14 florian* changement interface de saisie** Revision 1.2 2004/07/01 10:13:41 florian* modif Florian** Revision 1.1 2004/06/23 09:58:32 alex* version initiale** Revision 1.1 2004/06/18 09:00:07 alex* version initiale*** +-- Fin du code ----------------------------------------------------------------------------------------+*/?>