19,7 → 19,7 |
// | 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.18 2005-12-02 10:57:03 florian Exp $ |
// CVS : $Id: bazar.php,v 1.19 2006-01-03 10:19:31 florian Exp $ |
/** |
* |
*@package bazar |
28,7 → 28,7 |
*@author Florian Schmitt <florian@ecole-et-nature.org> |
//Autres auteurs : |
*@copyright Tela-Botanica 2000-2004 |
*@version $Revision: 1.18 $ $Date: 2005-12-02 10:57:03 $ |
*@version $Revision: 1.19 $ $Date: 2006-01-03 10:19:31 $ |
// +------------------------------------------------------------------------------------------------------+ |
*/ |
|
36,9 → 36,7 |
// | 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) ; |
70,95 → 68,92 |
if (defined('PAP_VERSION')) { //si on est dans Papyrus |
GEN_stockerStyleExterne( 'bazar_interne', 'client/bazar/bazar.interne.css'); |
} |
//initialisation de l'id user |
$GLOBALS['id_user']=$GLOBALS['AUTH']->getAuthData(BAZ_CHAMPS_ID); |
|
//si un parametre est précisé dans le gestionnaire de menus papyrus, on le prends en compte |
//parametre action pour lancer directement l'action indiquée |
if (!isset($_GET['action'])and(isset($GLOBALS['_GEN_commun']['info_application']->action))) { |
$_GET['action']=$GLOBALS['_GEN_commun']['info_application']->action; |
} |
//parametre voir_menu pour afficher le menu ou pas (par défaut, il l'affiche) |
if ((isset($GLOBALS['_GEN_commun']['info_application']->voir_menu))and($GLOBALS['_GEN_commun']['info_application']->voir_menu==0)) { |
$GLOBALS['_BAZAR_']['affiche_menu']=0; |
} |
else $GLOBALS['_BAZAR_']['affiche_menu']=1; |
//parametre categorie_nature pour préciser quels types de fiches sont montrees (par défaut, il affiche les id_menu=0) |
if (isset($GLOBALS['_GEN_commun']['info_application']->categorie_nature)) { |
$GLOBALS['_BAZAR_']['categorie_nature']=$GLOBALS['_GEN_commun']['info_application']->categorie_nature; |
} |
else $GLOBALS['_BAZAR_']['categorie_nature']=0; |
//parametre id_nature pour afficher un certain type de fiche (par défaut, tous les types de fiches) |
if (isset($GLOBALS['_GEN_commun']['info_application']->id_nature)) { |
$GLOBALS['_BAZAR_']['id_nature']=$GLOBALS['_GEN_commun']['info_application']->id_nature; |
} |
else $GLOBALS['_BAZAR_']['id_nature']='toutes'; |
|
// +------------------------------------------------------------------------------------------------------+ |
// | LISTE de FONCTIONS | |
// +------------------------------------------------------------------------------------------------------+ |
|
function afficherContenuCorps() { |
if ($GLOBALS['_BAZAR_']['affiche_menu']) { |
//---------------le menu de l'appli----------- |
function afficherContenuNavigation () { |
$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".'</li>'."\n"; |
$GLOBALS['_BAZAR_']['url']->removeQueryString('nature'); |
|
$GLOBALS['id_user']=$GLOBALS['AUTH']->getAuthData(BAZ_CHAMPS_ID); |
|
//partie abonnement aux annonces |
$GLOBALS['_BAZAR_']['url']->addQueryString('action', BAZ_S_INSCRIRE); |
$res .= '<li><a href="'.$GLOBALS['_BAZAR_']['url']->getURL().'">'.BAZ_S_ABONNER.'</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".'</li>'."\n"; |
$GLOBALS['_BAZAR_']['url']->removeQueryString('action'); |
|
//choix des administrateurs |
$est_admin=0; |
if ($GLOBALS['AUTH']->getAuth()) { |
$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></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'); |
} |
} |
} |
$res.= '</ul>'."\n"; |
return $res ; |
} |
} |
|
function afficherContenuCorps() { |
$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".'</li>'."\n"; |
$GLOBALS['_BAZAR_']['url']->removeQueryString('nature'); |
|
//partie abonnement aux annonces |
$GLOBALS['_BAZAR_']['url']->addQueryString('action', BAZ_S_INSCRIRE); |
$res .= '<li><a href="'.$GLOBALS['_BAZAR_']['url']->getURL().'">'.BAZ_S_ABONNER.'</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; |
if ($GLOBALS['AUTH']->getAuth()) { |
$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"; |
$res.='</div>'."\n"; |
|
//le corps de l'appli |
$res.='<div id="BAZ_corps">'."\n"; |
|
//si un parametre est précisé dans le gestionnaire de menus papyrus, on le prends en compte |
if (!isset($_GET['action'])and(isset($GLOBALS['_GEN_commun']['info_application']->action))) { |
$_GET['action']=$GLOBALS['_GEN_commun']['info_application']->action; |
} |
if (isset($_GET['action'])) { |
switch ($_GET['action']) { |
case BAZ_VOIR_VOS_ANNONCES : $res .= mes_fiches(); break; |
case BAZ_VOIR_TOUTES_ANNONCES : $res .= baz_liste($_REQUEST['nature'],'',''); break; |
case BAZ_RECHERCHER_ANNONCE : $res .= baz_rechercher(); break; |
case BAZ_VOIR_TOUTES_ANNONCES : $res .= baz_liste($GLOBALS['_BAZAR_']['id_nature']); 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; |
179,9 → 174,8 |
} |
} |
else { |
$res .= baz_liste('toutes','',''); |
$res .= baz_liste($GLOBALS['_BAZAR_']['id_nature']); |
} |
$res.='</div>'."\n"; |
return $res ; |
} |
|
189,6 → 183,9 |
/* +--Fin du code ----------------------------------------------------------------------------------------+ |
* |
* $Log: not supported by cvs2svn $ |
* Revision 1.18 2005/12/02 10:57:03 florian |
* MAJ pour paramétrage dans gestion de menus papyrus |
* |
* Revision 1.17 2005/12/01 16:05:41 florian |
* changement des chemins pour appli Pear |
* |