47,10 → 47,22 |
if (isset($_GET['id_fiche'])) $GLOBALS['_BAZAR_']['id_fiche']=$_GET['id_fiche']; |
if ($idfiche!='') $GLOBALS['_BAZAR_']['id_fiche']=$idfiche; |
|
//on met à jour le nb de visites pour la fiche |
$requete = 'UPDATE bazar_fiche SET bf_nb_consultations=bf_nb_consultations+1 WHERE bf_id_fiche='.$GLOBALS['_BAZAR_']['id_fiche']; |
$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ; |
$url= $GLOBALS['_BAZAR_']['url']; |
$url->addQueryString('action', BAZ_VOIR_FICHE); |
$url->addQueryString('id_fiche', $GLOBALS['_BAZAR_']['id_fiche']); |
$url = preg_replace ('/&/', '&', $url->getURL()) ; |
|
//cas ou un commetaire a été entré |
if (isset($_POST['Nom'])) { |
$requete = 'INSERT INTO bazar_commentaires VALUES ('.$GLOBALS['_BAZAR_']['id_fiche'].', "'.$_POST['Nom'].'", "'.$_POST['Commentaire'].'", NOW() )'; |
$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ; |
} |
else { |
//sinon on met à jour le nb de visites pour la fiche, puisque c'est une simple consultation |
$requete = 'UPDATE bazar_fiche SET bf_nb_consultations=bf_nb_consultations+1 WHERE bf_id_fiche='.$GLOBALS['_BAZAR_']['id_fiche']; |
$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ; |
} |
|
//on cherche le type d'annonce, l'annonceur et les stats |
$requete = 'SELECT bn_label_nature, bn_commentaire, bn_appropriation, bf_ce_utilisateur,bf_nb_consultations FROM bazar_fiche, bazar_nature WHERE bn_id_nature=bf_ce_nature AND bf_id_fiche='.$GLOBALS['_BAZAR_']['id_fiche']; |
$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ; |
64,6 → 76,23 |
$GLOBALS['_BAZAR_']['annonceur']=$ligne['bf_ce_utilisateur']; |
$GLOBALS['_BAZAR_']['nb_consultations']=$ligne['bf_nb_consultations']; |
} |
|
//on vérifie si l'utilisateur est administrateur |
$est_admin=0; |
if ($GLOBALS['AUTH']->getAuth()) { |
$requete='SELECT bn_id_nature FROM bazar_nature WHERE bn_label_nature="'.$GLOBALS['_BAZAR_']['typeannonce'].'"'; |
$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ; |
if (DB::isError($resultat)) { |
die ($resultat->getMessage().$resultat->getDebugInfo()) ; |
} |
$result = $resultat->fetchRow(DB_FETCHMODE_ASSOC); |
if ((niveau_droit($result['bn_id_nature'],$GLOBALS['AUTH']->getAuthData(BAZ_CHAMPS_ID))=='administrateur') |
or(niveau_droit('0',$GLOBALS['AUTH']->getAuthData(BAZ_CHAMPS_ID))=='superadministrateur')) |
{ |
$est_admin=1; |
} |
} |
|
$res = '<div class="BAZ_cadre_fiche">'."\n"; |
$res .= '<div class="BAZ_cadre_fiche_haut">'."\n"; |
$res .= ' </div>'."\n"; |
152,8 → 181,8 |
} |
$res .= '</ul></span>'."\n"; |
} |
$res .= '<div id="bulle_haut"> </div>'."\n"; |
$res .= '<div id="bulle_corps">'."\n"; |
$res .= '<div class="bulle_haut"> </div>'."\n"; |
$res .= '<div class="bulle_corps">'."\n"; |
|
//affichage du rédacteur de la fiche |
$requete = 'SELECT '.BAZ_CHAMPS_NOM.', '.BAZ_CHAMPS_PRENOM.', '.BAZ_CHAMPS_EMAIL.' FROM '.BAZ_ANNUAIRE.' WHERE '.BAZ_CHAMPS_ID.'='.$GLOBALS['_BAZAR_']['annonceur']; |
166,8 → 195,9 |
} |
$res .= BAZ_NB_VUS.'<strong>'.$GLOBALS['_BAZAR_']['nb_consultations'].'</strong>'.BAZ_FOIS.'<br />'."\n"; |
$res .= '</div>'."\n"; |
$res .= '<div id="bulle_bas"> </div>'."\n"; |
$res .= '<div class="bulle_bas"> </div>'."\n"; |
$res .= '<div id="BAZ_bas_page">'; |
|
//informations complémentaires (id fiche, état publication,... ) |
if ($danslappli==1) { |
$res .= '<span class="rubrique">'.BAZ_NUM_FICHE.':</span> '.$GLOBALS['_BAZAR_']['id_fiche'].'<br />'."\n"; |
180,25 → 210,12 |
} |
$res .= '<span class="rubrique">'.BAZ_DATE_CREATION.':</span> '.strftime('%d.%m.%Y à %H:%M',strtotime($ligne['bf_date_creation_fiche'])).'<br />'."\n"; |
$res .= '<span class="rubrique">'.BAZ_DATE_MAJ.':</span> '.strftime('%d.%m.%Y à %H:%M',strtotime($ligne['bf_date_maj_fiche'])); |
//pour les identifiés seulement, administrateurs de la rubrique ou superadmins |
if ($GLOBALS['AUTH']->getAuth()) { |
$est_admin=0; |
$requete='SELECT bn_id_nature FROM bazar_nature WHERE bn_label_nature="'.$GLOBALS['_BAZAR_']['typeannonce'].'"'; |
$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ; |
if (DB::isError($resultat)) { |
die ($resultat->getMessage().$resultat->getDebugInfo()) ; |
} |
$result = $resultat->fetchRow(DB_FETCHMODE_ASSOC); |
if ((niveau_droit($result['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')or($GLOBALS['_BAZAR_']['annonceur']==$GLOBALS['AUTH']->getAuthData(BAZ_CHAMPS_ID))) { |
$lien_modifier=$GLOBALS['_BAZAR_']['url']; |
$lien_modifier->addQueryString('action', BAZ_ACTION_MODIFIER); |
$lien_modifier->addQueryString('id_fiche', $GLOBALS['_BAZAR_']['id_fiche']); |
$lien_modifier->addQueryString('typeannonce', $GLOBALS['_BAZAR_']['typeannonce']); |
$res .= ' <a href="'.$lien_modifier->getURL().'">'.BAZ_MODIFIER_LA_FICHE.'</a>'."\n"; |
} |
if (($est_admin)or($GLOBALS['_BAZAR_']['annonceur']==$GLOBALS['AUTH']->getAuthData(BAZ_CHAMPS_ID))) { |
$lien_modifier=$GLOBALS['_BAZAR_']['url']; |
$lien_modifier->addQueryString('action', BAZ_ACTION_MODIFIER); |
$lien_modifier->addQueryString('id_fiche', $GLOBALS['_BAZAR_']['id_fiche']); |
$lien_modifier->addQueryString('typeannonce', $GLOBALS['_BAZAR_']['typeannonce']); |
$res .= ' <a href="'.$lien_modifier->getURL().'">'.BAZ_MODIFIER_LA_FICHE.'</a>'."\n"; |
} |
} |
$res .= '</div>'."\n"; |
218,14 → 235,48 |
die ($resultat->getMessage().'<br />'.$resultat->getDebugInfo()) ; |
} |
if ($resultat->numRows()>0) { |
$res .= 'Il y a '.$resultat->numRows(); |
if ($resultat->numRows()==1) $res .= 'commentaire : '.'<br />'."\n"; |
else $res .= 'commentaires : '.'<br />'."\n"; |
$res .= BAZ_IL_Y_A.$resultat->numRows().' '; |
if ($resultat->numRows()==1) $res .= BAZ_COMMENTAIRE.'<br />'."\n"; |
else $res .= BAZ_COMMENTAIRES.'<br />'."\n"; |
while ($ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) { |
$res .= 'essai'."\n"; |
$res .= '<div class="bulle_haut"> </div>'."\n"; |
$res .= '<div class="bulle_corps">'."\n"; |
//affichage du commentaire |
$res .= $ligne['bc_commentaire'].'<br />'."\n"; |
$res .= '</div>'."\n"; |
$res .= '<div class="bulle_bas">'."\n"; |
$res .= '<span style="font-size:9px;margin-left:10px;">'.BAZ_PAR.' : <strong>'.$ligne['bc_nom'].'</strong>'.BAZ_ECRIT_LE.$ligne['bc_date'].'</span>'."\n"; |
//pour les identifiés seulement, administrateurs de la rubrique ou superadmins |
if ($est_admin==1) { |
$url_comment= $GLOBALS['_BAZAR_']['url']; |
$url_comment->addQueryString('action', BAZ_VOIR_FICHE); |
$url_comment->addQueryString('id_fiche', $GLOBALS['_BAZAR_']['id_fiche']); |
$url_comment->addQueryString('date', $ligne['bc_date']); |
$res .= '<span style="float:right;"><a href="'.$url_comment->getURL().'">'.BAZ_SUPPRIMER.'</a></span>'."\n"; |
} |
$res .= '</div>'."\n"; |
} |
} |
else $res .= BAZ_PAS_DE_COMMENTAIRES.'<br />'."\n"; |
else $res .= BAZ_PAS_DE_COMMENTAIRES.'<br /><br />'."\n"; |
|
//formulaire des commentaires |
$form_commentaire = new HTML_QuickForm('commentaire', 'post', $url); |
$squelette =& $form_commentaire->defaultRenderer(); |
$squelette->setFormTemplate("\n".'<form {attributes}>'."\n".'{content}'."\n".'</form>'."\n"); |
$squelette->setElementTemplate( '<label style="width:200px;">{label} </label><br />'."\n".'{element}<br />'."\n"); |
$squelette->setRequiredNoteTemplate("\n".'{requiredNote} '."\n"); |
$option=array('style'=>'width:300px;', 'maxlength'=>100); |
$form_commentaire->addElement('text', 'Nom', BAZ_ENTREZ_VOTRE_NOM, $option); |
$option=array('style'=>'width:100%;height:100px;white-space: pre;padding:3px;'); |
require_once 'HTML/QuickForm/textarea.php'; |
$formtexte= new HTML_QuickForm_textarea('Commentaire', BAZ_ENTREZ_VOTRE_COMMENTAIRE, $option); |
$form_commentaire->addElement($formtexte) ; |
$form_commentaire->addElement('submit', 'Envoyer', BAZ_ENVOYER); |
$form_commentaire->addRule('Nom', BAZ_NOM_REQUIS, 'required', '', 'client') ; |
$form_commentaire->addRule('Commentaire', BAZ_COMMENTAIRE_REQUIS, 'required', '', 'client') ; |
$form_commentaire->setRequiredNote(BAZ_CHAMPS_REQUIS) ; |
$res .= $form_commentaire->toHTML(); |
|
$res .= '</div>'."\n"; |
$res .= '<div class="BAZ_cadre_fiche_bas"> </div>'."\n"; |
$res .= '</div>'."\n"; |