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.fonct.php,v 1.25 2005-12-20 14:49:35 ddelon Exp $ |
// CVS : $Id: bazar.fonct.php,v 1.26 2006-01-03 10:19:31 florian Exp $ |
/** |
* |
* Fonctions du module bazar |
31,7 → 31,7 |
*@author Florian Schmitt <florian@ecole-et-nature.org> |
//Autres auteurs : |
*@copyright Tela-Botanica 2000-2004 |
*@version $Revision: 1.25 $ $Date: 2005-12-20 14:49:35 $ |
*@version $Revision: 1.26 $ $Date: 2006-01-03 10:19:31 $ |
// +------------------------------------------------------------------------------------------------------+ |
*/ |
|
81,8 → 81,8 |
function fiches_a_valider() { |
// Pour les administrateurs d'une rubrique, on affiche les fiches a valider de cette rubrique |
// On effectue une requete sur le bazar pour voir les fiches a administrer |
$res= '<h2>'.BAZ_ANNONCES_A_ADMINISTRER.'</h2>'; |
$requete = 'SELECT * FROM bazar_fiche, bazar_nature WHERE bf_statut_fiche=0 AND bn_id_nature=bf_ce_nature AND bn_ce_id_menu='.$GLOBALS['_GEN_commun']['info_menu']->gm_id_menu.' or bn_ce_id_menu=0 ORDER BY bf_date_maj_fiche DESC' ; |
$res= '<h2>'.BAZ_ANNONCES_A_ADMINISTRER.'</h2><br />'."\n"; |
$requete = 'SELECT * FROM bazar_fiche, bazar_nature WHERE bf_statut_fiche=0 AND bn_id_nature=bf_ce_nature AND bn_ce_id_menu='.$GLOBALS['_BAZAR_']['categorie_nature'].' ORDER BY bf_date_maj_fiche DESC' ; |
$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ; |
if (DB::isError($resultat)) { |
die ('Echec de la requete<br />'.$resultat->getMessage().'<br />'.$resultat->getDebugInfo()) ; |
108,27 → 108,27 |
$lien_voir=$GLOBALS['_BAZAR_']['url']; |
$lien_voir->addQueryString('action', BAZ_VOIR_FICHE); |
$lien_voir->addQueryString('id_fiche', $ligne['bf_id_fiche']); |
$lien_voir->addQueryString('typeannonce', $ligne['bn_label_nature']); |
$lien_voir->addQueryString('typeannonce', $ligne['bn_id_nature']); |
|
$lien_publie_oui=$GLOBALS['_BAZAR_']['url']; |
$lien_publie_oui->addQueryString('action', BAZ_ACTION_PUBLIER); |
$lien_publie_oui->addQueryString('id_fiche', $ligne['bf_id_fiche']); |
$lien_publie_oui->addQueryString('typeannonce', $ligne['bn_label_nature']); |
$lien_publie_oui->addQueryString('typeannonce', $ligne['bn_id_nature']); |
|
$lien_publie_non=$GLOBALS['_BAZAR_']['url']; |
$lien_publie_non->addQueryString('action', BAZ_ACTION_PAS_PUBLIER); |
$lien_publie_non->addQueryString('id_fiche', $ligne['bf_id_fiche']); |
$lien_publie_non->addQueryString('typeannonce', $ligne['bn_label_nature']); |
$lien_publie_non->addQueryString('typeannonce', $ligne['bn_id_nature']); |
|
$lien_supprimer=$GLOBALS['_BAZAR_']['url']; |
$lien_supprimer->addQueryString('action', BAZ_ACTION_SUPPRESSION); |
$lien_supprimer->addQueryString('id_fiche', $ligne['bf_id_fiche']); |
$lien_supprimer->addQueryString('typeannonce', $ligne['bn_label_nature']); |
$lien_supprimer->addQueryString('typeannonce', $ligne['bn_id_nature']); |
|
$table->addRow (array( |
'<a href="'.$lien_voir->getURL().'">'.$ligne['bf_titre'].'</a>'."\n", // col 1 : le nom |
$annonceur."\n", // col 2 : annonceur |
$ligne['bn_label_nature']."\n", // col 3 : type annonce |
constant($ligne['bn_label_nature'])."\n", // col 3 : type annonce |
"<a href=\"".$lien_publie_oui->getURL()."\">".BAZ_OUI."</a> / \n". |
"<a href=\"".$lien_publie_non->getURL()."\">".BAZ_NON."</a>", // col 4 : publier ou pas |
"<a href=\"".$lien_supprimer->getURL()."\"". |
156,10 → 156,10 |
*/ |
function mes_fiches() { |
if ($GLOBALS['AUTH']->getAuth()) { |
$res= '<h2>'.BAZ_VOS_ANNONCES.'</h2>'."\n"; |
// requête pour voir si l'utilisateur a des fiches à son nom, classées par date de MAJ et nature d'annonce |
$res= '<h2>'.BAZ_VOS_ANNONCES.'</h2><br />'."\n"; |
// requete pour voir si l'utilisateur a des fiches à son nom, classées par date de MAJ et nature d'annonce |
$requete = 'SELECT * FROM bazar_fiche, bazar_nature WHERE bf_ce_utilisateur='. $GLOBALS['id_user']. |
' AND bn_id_nature=bf_ce_nature AND bn_ce_id_menu='.$GLOBALS['_GEN_commun']['info_menu']->gm_id_menu.' or bn_ce_id_menu=0 ORDER BY bf_date_maj_fiche DESC,bf_ce_nature ASC'; |
' 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'; |
$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ; |
if (DB::isError($resultat)) { |
die ('Echec de la requete<br />'.$resultat->getMessage().'<br />'.$resultat->getDebugInfo()) ; |
180,24 → 180,24 |
$lien_voir=$GLOBALS['_BAZAR_']['url']; |
$lien_voir->addQueryString('action', BAZ_VOIR_FICHE); |
$lien_voir->addQueryString('id_fiche', $ligne['bf_id_fiche']); |
$lien_voir->addQueryString('typeannonce', $ligne['bn_label_nature']); |
$lien_voir->addQueryString('typeannonce', $ligne['bn_id_nature']); |
$lien_voir_url=$lien_voir->getURL(); |
|
$lien_modifier=$GLOBALS['_BAZAR_']['url']; |
$lien_modifier->addQueryString('action', BAZ_ACTION_MODIFIER); |
$lien_modifier->addQueryString('id_fiche', $ligne['bf_id_fiche']); |
$lien_modifier->addQueryString('typeannonce', $ligne['bn_label_nature']); |
$lien_modifier->addQueryString('typeannonce', $ligne['bn_id_nature']); |
$lien_modifier_url=$lien_modifier->getURL(); |
|
$lien_supprimer=$GLOBALS['_BAZAR_']['url']; |
$lien_supprimer->addQueryString('action', BAZ_ACTION_SUPPRESSION); |
$lien_supprimer->addQueryString('id_fiche', $ligne['bf_id_fiche']); |
$lien_supprimer->addQueryString('typeannonce', $ligne['bn_label_nature']); |
$lien_supprimer->addQueryString('typeannonce', $ligne['bn_id_nature']); |
$lien_supprimer_url=$lien_supprimer->getURL(); |
|
$table->addRow (array( |
'<a href="'.$lien_voir_url.'">'.$ligne['bf_titre'].'</a>'."\n", // col 1 : le nom |
$ligne['bn_label_nature']."\n", // col 2: type annonce |
constant($ligne['bn_label_nature'])."\n", // col 2: type annonce |
$publiee."\n", // col 3 : publiee ou non |
'<a href="'.$lien_modifier_url.'">'.BAZ_MODIFIER.'</a>'."\n", // col 4 : modifier |
'<a href="'.$lien_supprimer_url.'" onclick="javascript:return |
214,7 → 214,7 |
$res .= BAZ_PAS_DE_FICHE ; |
} |
} |
else $res=BAZ_IDENTIFIEZ_VOUS_POUR_SAISIR;; |
else $res=BAZ_IDENTIFIEZ_VOUS_POUR_SAISIR; |
return $res; |
} |
|
311,7 → 311,7 |
$res = ''; |
|
//requete pour obtenir le nom et la description des types d'annonce |
$requete = "SELECT bn_id_nature, bn_label_nature, bn_description, bn_condition ". |
$requete = "SELECT bn_id_nature, bn_label_nature, bn_description, bn_condition, bn_image_titre ". |
"FROM bazar_nature WHERE bn_ce_id_menu=".$GLOBALS['_GEN_commun']['info_menu']->gm_id_menu. |
" or bn_ce_id_menu=0 ORDER BY bn_label_nature ASC"; |
$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ; |
319,24 → 319,25 |
die ($resultat->getMessage().$resultat->getDebugInfo()) ; |
} |
$res.="<h2>".BAZ_DEPOSE_UNE_NOUVELLE_ANNONCE.'</h2>'."\n"; |
$res.=BAZ_CHOIX_TYPEANNONCE.'<br />'; |
$res.='<br />'.BAZ_CHOIX_TYPEANNONCE.'<br /><br />'."\n"; |
while ($ligne = $resultat->fetchRow (DB_FETCHMODE_ASSOC)) { |
$droitspers=niveau_droit($ligne["bn_id_nature"],$GLOBALS["id_user"]); |
if (($droitspers=='redacteur') or ($droitspers=='administrateur') or ($droitspers=='superadministrateur' or !BAZ_RESTREINDRE_DEPOT)) { |
$formtemplate->addElement('radio', 'typeannonce', '', '<strong>'.$ligne['bn_label_nature']. |
':</strong><br />'.$ligne['bn_description'], $ligne['bn_label_nature'], array("id" => 'select'.$ligne['bn_id_nature'], "style" => 'float:left;')); |
if (isset($ligne['bn_image_titre'])) {$titre=' <img src="client/bazar/images/'.$ligne['bn_image_titre'].'" alt="'.constant($ligne['bn_label_nature']).'" />'.'<br />'."\n";} |
else {$titre='<strong>'.constant($ligne['bn_label_nature']).' : </strong><br />'."\n";} |
$formtemplate->addElement('radio', 'typeannonce', '', $titre.$ligne['bn_description'].'<br /><br />'."\n", $ligne['bn_id_nature'], array("id" => 'select'.$ligne['bn_id_nature'], "style" => 'float:left;')); |
} |
} |
$squelette->setElementTemplate( '<div class="listechoix">'."\n".'{element}'."\n".'</div>'."\n"); |
|
//Mettre les annonces en choix par defaut |
$formtemplate->setdefaults(array('typeannonce'=>'Annonces')); |
$formtemplate->setdefaults(array('typeannonce'=>'1')); |
|
//Bouton de validation du formulaire |
$formtemplate->addElement('submit', 'valider', BAZ_VALIDER); |
|
//Affichage a l'ecran |
$res.= $formtemplate->toHTML() ; |
$res.= $formtemplate->toHTML()."\n".'<br />'."\n".mes_fiches(); ; |
} |
|
//------------------------------------------------------------------------------------------------ |
428,7 → 429,7 |
} |
} |
|
//requete pour obtenir l'id, le nom et prénom des personnes inscrites à l'annuaire sauf soi même |
//requete pour obtenir l'id, le nom et prenom des personnes inscrites a l'annuaire sauf soi meme |
$requete = 'SELECT '.BAZ_CHAMPS_ID.', '.BAZ_CHAMPS_NOM.', '.BAZ_CHAMPS_PRENOM.' FROM '.BAZ_ANNUAIRE. |
' WHERE '.BAZ_CHAMPS_ID."!=".$GLOBALS['id_user'].' ORDER BY '.BAZ_CHAMPS_NOM.' ASC'; |
$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ; |
435,20 → 436,18 |
if (DB::isError($resultat)) { |
die ($resultat->getMessage().$resultat->getDebugInfo()) ; |
} |
$res='<h2>'.BAZ_GESTION_DES_DROITS.'</h2>'."\n"; |
$res.=BAZ_DESCRIPTION_GESTION_DES_DROITS.'<br /><br />'; |
$res='<h2>'.BAZ_GESTION_DES_DROITS.'</h2><br />'."\n"; |
$res.=BAZ_DESCRIPTION_GESTION_DES_DROITS.'<br /><br />'."\n"; |
$personnes_select[0]=BAZ_SELECTION; |
while ($ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) { |
$personnes_select[$ligne[BAZ_CHAMPS_ID]] = $ligne[BAZ_CHAMPS_NOM]." ".$ligne[BAZ_CHAMPS_PRENOM] ; |
} |
$java=array ('onchange'=>'this.form.submit();'); |
$java=array ('style'=>'width:250px;','onchange'=>'this.form.submit();'); |
$formtemplate->addElement ('select', 'personnes', BAZ_LABEL_CHOIX_PERSONNE, $personnes_select, $java) ; |
$defauts=array ('personnes'=>$personne); |
$formtemplate->setDefaults($defauts); |
$res.= $formtemplate->toHTML() ; |
|
|
|
$res.= $formtemplate->toHTML().'<br />'."\n" ; |
|
if ($personne!=0) { |
//cas du super utilisateur |
if (niveau_droit(0,$personne)=='superadministrateur') { |
466,8 → 465,8 |
$lien_passer_superadmin->addQueryString('droits', 'superadmin'); |
$res.= '<a href='.$lien_passer_superadmin->getURL().'>'.BAZ_PASSER_SUPERADMINISTRATEUR.'</a><br />'."\n"; |
|
//on cherche les différentes rubriques d'annonces |
$requete = 'SELECT bn_id_nature, bn_label_nature FROM bazar_nature WHERE bn_ce_id_menu='.$GLOBALS['_GEN_commun']['info_menu']->gm_id_menu .' or bn_ce_id_menu=0'; |
//on cherche les differentes rubriques d'annonces |
$requete = 'SELECT bn_id_nature, bn_label_nature, bn_image_titre FROM bazar_nature WHERE bn_ce_id_menu='.$GLOBALS['_GEN_commun']['info_menu']->gm_id_menu .' or bn_ce_id_menu=0'; |
$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ; |
if (DB::isError($resultat)) { |
die ($resultat->getMessage().$resultat->getDebugInfo()) ; |
475,10 → 474,10 |
$res.='<br /><b>'.BAZ_DROITS_PAR_TYPE.'</b><br /><br />'; |
|
$table = new HTML_Table(array ('width' => '100%', 'class' => 'table_bazar')) ; |
$table->addRow(array ('<b>'.BAZ_TYPE_ANNONCES.'</b>', |
'<b>'.BAZ_DROITS_ACTUELS.'</b>', |
'<b>'.BAZ_PASSER_EN.'</b>', |
'<b>'.BAZ_OU_PASSER_EN.'</b>')) ; |
$table->addRow(array ('<strong>'.BAZ_TYPE_ANNONCES.'</strong>', |
'<strong>'.BAZ_DROITS_ACTUELS.'</strong>', |
'<strong>'.BAZ_PASSER_EN.'</strong>', |
'<strong>'.BAZ_OU_PASSER_EN.'</strong>')) ; |
$table->setRowType (0, 'th') ; |
|
while ($ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) { |
501,21 → 500,22 |
$lien_passer_admin->addQueryString('pers', $personne); |
$lien_passer_admin->addQueryString('droits', 'admin'); |
$lien_passer_admin->addQueryString('idtypeannonce', $ligne["bn_id_nature"]); |
|
if (isset($ligne['bn_image_titre'])) {$titre=' <img src="client/bazar/images/'.$ligne['bn_image_titre'].'" alt="'.constant($ligne['bn_label_nature']).'" />'."\n";} |
else {$titre='<strong> '.constant($ligne['bn_label_nature']).'</strong>'."\n";} |
if ($droits=='aucun') { |
$table->addRow(array('<b>'.$ligne['bn_label_nature'].'</b>', |
$table->addRow(array($titre, |
BAZ_AUCUN_DROIT, |
'<a href='.$lien_passer_redacteur->getURL().'>'.BAZ_DROIT_REDACTEUR.'</a>', |
'<a href='.$lien_passer_admin->getURL().'>'.BAZ_DROIT_ADMIN.'</a>')); |
} |
elseif ($droits=='redacteur') { |
$table->addRow(array('<b>'.$ligne['bn_label_nature'].'</b>', |
$table->addRow(array($titre, |
BAZ_DROIT_REDACTEUR, |
'<a href='.$lien_aucun_droit->getURL().'>'.BAZ_AUCUN_DROIT.'</a>', |
'<a href='.$lien_passer_admin->getURL().'>'.BAZ_DROIT_ADMIN.'</a>')); |
} |
else { |
$table->addRow(array('<b>'.$ligne['bn_label_nature'].'</b>', |
$table->addRow(array($titre, |
BAZ_DROIT_ADMIN, |
'<a href='.$lien_aucun_droit->getURL().'>'.BAZ_AUCUN_DROIT.'</a>', |
'<a href='.$lien_passer_redacteur->getURL().'>'.BAZ_DROIT_REDACTEUR.'</a>')); |
559,7 → 559,7 |
} |
|
//titre de la rubrique |
$res= '<h2>'.BAZ_TITRE_SAISIE_ANNONCE.$GLOBALS['_BAZAR_']['typeannonce'].'</h2>'; |
$res= '<h2>'.BAZ_TITRE_SAISIE_ANNONCE.$GLOBALS['_BAZAR_']['typeannonce'].'</h2><br />'."\n"; |
|
//ajout d'une page sur les conditions pour l'annonce si elles existent |
$requete = 'SELECT bn_condition FROM bazar_nature WHERE bn_label_nature="'.$GLOBALS['_BAZAR_']['typeannonce'].'"'; |
1083,7 → 1083,7 |
*/ |
function baz_s_inscrire() { |
if (isset($_GET['inscrip'])) { |
//cas d'une désinscription |
//cas d'une desinscription |
if ($_GET['inscrip']==0) { |
$requete='DELETE FROM bazar_abonnement WHERE ba_id_utilisateur='.$GLOBALS['id_user'].' AND ba_id_rubrique='.$_GET['idtypeannonce']; |
} |
1098,10 → 1098,10 |
} |
|
if ($GLOBALS['AUTH']->getAuth()) { |
$res= '<h2>'.BAZ_S_ABONNER.'</h2>'."\n"; |
$res= BAZ_LAIUS_S_ABONNER."\n"; |
$res= '<h2>'.BAZ_S_INSCRIRE_AUX_ANNONCES.'</h2><br />'."\n"; |
$res .= BAZ_LAIUS_S_ABONNER.'<br /><br />'."\n"; |
//requete pour obtenir l'id et le label des types d'annonces |
$requete = 'SELECT bn_id_nature, bn_label_nature '. |
$requete = 'SELECT bn_id_nature, bn_label_nature, bn_image_titre '. |
'FROM bazar_nature WHERE bn_ce_id_menu='.$GLOBALS['_GEN_commun']['info_menu']->gm_id_menu .' or bn_ce_id_menu=0'; |
$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ; |
if (DB::isError($resultat)) { |
1129,19 → 1129,21 |
$lien_RSS=$GLOBALS['_BAZAR_']['url']; |
$lien_RSS->addQueryString('action', BAZ_VOIR_FLUX_RSS); |
|
'http://'.$_SERVER['HTTP_HOST'].'/client/bazar/bazarRSS.php?annonce='.$ligne['bn_label_nature']; |
'http://'.$_SERVER['HTTP_HOST'].'/client/bazar/bazarRSS.php?annonce='.$ligne['bn_id_nature']; |
|
//requete pour savoir si la personne est inscrite à ce type d'annonce |
$requete = 'SELECT ba_id_utilisateur '. |
'FROM bazar_abonnement '. |
'WHERE ba_id_utilisateur='.$GLOBALS['id_user'].' AND ba_id_rubrique='.$ligne['bn_id_nature']; |
'WHERE ba_id_utilisateur='.$GLOBALS['id_user'].' AND ba_id_rubrique='.$ligne['bn_id_nature']; |
$resultat2 = $GLOBALS['_BAZAR_']['db']->query($requete) ; |
if (DB::isError($resultat2)) { |
die ($resultat2->getMessage().$resultat2->getDebugInfo()) ; |
} |
if (isset($ligne['bn_image_titre'])) {$titre=' <img src="client/bazar/images/'.$ligne['bn_image_titre'].'" alt="'.constant($ligne['bn_label_nature']).'" />'."\n";} |
else {$titre='<strong> '.constant($ligne['bn_label_nature']).'</strong>'."\n";} |
if ($resultat2->numRows()>0) { |
$lien_RSS->addQueryString('annonce', $ligne['bn_label_nature']); |
$table->addRow(array('<b>'.$ligne['bn_label_nature'].'</b>', |
$lien_RSS->addQueryString('annonce', $ligne['bn_id_nature']); |
$table->addRow(array($titre, |
BAZ_ABONNE, |
'<a href='.$lien_se_desabonner->getURL().'>'.BAZ_SE_DESABONNER.'</a>', |
'<a href='.$lien_RSS->getURL().'><img src="client/bazar/images/BAZ_rss.png" alt="'.BAZ_RSS.'"></a>')); |
1148,8 → 1150,8 |
$lien_RSS->removeQueryString('annonce'); |
} |
else { |
$lien_RSS->addQueryString('annonce', $ligne['bn_label_nature']); |
$table->addRow(array('<b>'.$ligne['bn_label_nature'].'</b>', |
$lien_RSS->addQueryString('annonce', $ligne['bn_id_nature']); |
$table->addRow(array($titre, |
BAZ_PAS_ABONNE, |
'<a href='.$lien_s_abonner->getURL().'>'.BAZ_S_ABONNER.'</a>', |
'<a href='.$lien_RSS->getURL().'><img src="client/bazar/images/BAZ_rss.png" alt="'.BAZ_RSS.'" /></a>')); |
1157,7 → 1159,7 |
} |
} |
$table->altRowAttributes(1, array('class' => 'ligne_impaire'), array('class' => 'ligne_paire')); |
$table->updateColAttributes(0, array('style' => 'text-align:left;')); |
$table->updateColAttributes(0, array('align' => 'center')); |
$table->updateColAttributes(1, array('align' => 'center')); |
$table->updateColAttributes(2, array('align' => 'center')); |
$table->updateColAttributes(3, array('style' => 'text-align:center;')); |
1346,6 → 1348,9 |
/* +--Fin du code ----------------------------------------------------------------------------------------+ |
* |
* $Log: not supported by cvs2svn $ |
* Revision 1.25 2005/12/20 14:49:35 ddelon |
* Fusion Head vers Livraison |
* |
* Revision 1.24 2005/12/16 15:44:40 alexandre_tb |
* ajout de l'option restreindre dépôt |
* |