59,6 → 59,7 |
* @return string HTML |
*/ |
function baz_voir_fiche($danslappli, $idfiche='') { |
$res=''; |
if (isset($_GET['id_fiche'])) $GLOBALS['_BAZAR_']['id_fiche']=$_GET['id_fiche']; |
if ($idfiche!='') $GLOBALS['_BAZAR_']['id_fiche']=$idfiche; |
|
91,7 → 92,7 |
} |
|
//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']; |
$requete = 'SELECT bn_label_nature, bn_commentaire, bn_appropriation, bn_image_titre, bn_image_logo, 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) ; |
if (DB::isError($resultat)) { |
die ($resultat->getMessage().$resultat->getDebugInfo()) ; |
102,6 → 103,8 |
$GLOBALS['_BAZAR_']['appropriation']=$ligne['bn_appropriation']; |
$GLOBALS['_BAZAR_']['annonceur']=$ligne['bf_ce_utilisateur']; |
$GLOBALS['_BAZAR_']['nb_consultations']=$ligne['bf_nb_consultations']; |
$GLOBALS['_BAZAR_']['image_titre']=$ligne['bn_image_titre']; |
$GLOBALS['_BAZAR_']['image_logo']=$ligne['bn_image_logo']; |
} |
|
//on verifie si l'utilisateur est administrateur |
119,41 → 122,47 |
$est_admin=1; |
} |
} |
|
$res = '<div class="BAZ_cadre_fiche">'."\n"; |
if ($GLOBALS['_BAZAR_']['image_titre']!='') { |
$res .= '<img src="client/bazar/images/'.$GLOBALS['_BAZAR_']['image_titre'].'" alt="'.$GLOBALS['_BAZAR_']['typeannonce'].'" />'.'<br />'."\n"; |
} else { |
$res .= '<h1>'.$GLOBALS['_BAZAR_']['typeannonce'].'</h1>'."\n"; |
} |
$res .= '<div class="BAZ_cadre_fiche">'."\n"; |
$res .= '<div class="BAZ_cadre_fiche_haut">'."\n"; |
$res .= ' </div>'."\n"; |
$res .= '<div class="BAZ_cadre_fiche_corps">'."\n"; |
|
$requete = 'SELECT * FROM bazar_fiche WHERE bf_id_fiche='.$GLOBALS['_BAZAR_']['id_fiche']; |
$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ; |
if (DB::isError ($resultat)) { |
die ($resultat->getMessage().'<br />'.$resultat->getDebugInfo()) ; |
} |
$ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC) ; |
//si le template existe, on genere le template |
if ((file_exists(BAZ_CHEMIN_APPLI.'templates/'.$GLOBALS['_BAZAR_']['typeannonce'].'-fiche.php'))) { |
include_once(BAZ_CHEMIN_APPLI.'templates/'.$GLOBALS['_BAZAR_']['typeannonce'].'-fiche.php'); |
$res .=genere_fiche($GLOBALS['_BAZAR_']['id_fiche']); |
$res .=genere_fiche($ligne); |
} |
//on affiche ligne par ligne sinon |
else { |
$requete = 'SELECT * FROM bazar_fiche WHERE bf_id_fiche='.$GLOBALS['_BAZAR_']['id_fiche']; |
$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ; |
if (DB::isError ($resultat)) { |
die ($resultat->getMessage().'<br />'.$resultat->getDebugInfo()) ; |
} |
$ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC) ; |
|
//cas d'une image personalisée |
if (isset($ligne['bf_url_image'])) { |
$res .= '<div id="fiche_image">'."\n"; |
$res .= '<img src="'.'http://'.$_SERVER['HTTP_HOST'].'/client/bazar/images/'.$ligne['bf_url_image'].'" border=0 alt="'.BAZ_TEXTE_IMG_ALTERNATIF.'" />'."\n"; |
$res .= '<img src="client/bazar/images/'.$ligne['bf_url_image'].'" border=0 alt="'.BAZ_TEXTE_IMG_ALTERNATIF.'" />'."\n"; |
$res .= '</div>'."\n"; |
$res .= '<div id="fiche_titre_image">'.$ligne['bf_titre']; |
} |
else { |
$res .= '<div id="fiche_titre">'.$ligne['bf_titre']; |
//cas d'une image par défaut |
elseif ($GLOBALS['_BAZAR_']['image_logo']!='') { |
$res .= '<div id="fiche_image">'."\n"; |
$res .= '<img src="client/bazar/images/'.$GLOBALS['_BAZAR_']['image_logo'].'" border=0 alt="'.BAZ_TEXTE_IMG_ALTERNATIF.'" />'."\n"; |
$res .= '</div>'."\n"; |
} |
$res .= '</div>'."\n"; |
$res .= '<h1 id="fiche_titre">'.$ligne['bf_titre'].'</h1>'."\n"; |
$res .= '<div id="BAZ_description">'.$ligne['bf_description'].'</div>'."\n"; |
$tableau=baz_valeurs_template($GLOBALS['_BAZAR_']['typeannonce'].'.tpl'); |
for ($i=0; $i<count($tableau); $i++) { |
if (isset($ligne[$tableau[$i]['nom_bdd']])) { |
//pour les champs renseignés par une liste, on va chercher le label de la liste, plutot que l'id |
//pour les champs renseignes par une liste, on va chercher le label de la liste, plutot que l'id |
if ($tableau[$i]['type']=='liste') { |
$requete = 'SELECT '.$tableau[$i]['table_source'].'.* FROM bazar_fiche, '.$tableau[$i]['table_source']. |
' WHERE '.$tableau[$i]['nom_bdd'].'='.$tableau[$i]['id_source'].' AND bf_id_fiche='.$GLOBALS['_BAZAR_']['id_fiche']; |
161,15 → 170,15 |
if (DB::isError ($resultat)) { |
die ($resultat->getMessage().'<br />'.$resultat->getDebugInfo()) ; |
} |
while ($tab = $resultat->fetchRow()) { |
$val=$tab[1]; |
while ($tab = $resultat->fetchRow()) { |
$val=$tab[1]; |
} |
} |
else { |
$val=$ligne[$tableau[$i]['nom_bdd']]; |
} |
if (($tableau[$i]['nom_bdd']!='bf_titre')and($tableau[$i]['nom_bdd']!='bf_description')) { |
if ($val!='') { |
if (($tableau[$i]['nom_bdd']!='bf_titre')and($tableau[$i]['nom_bdd']!='bf_description')and($tableau[$i]['nom_bdd']!='bf_date_debut_validite_fiche')and($tableau[$i]['nom_bdd']!='bf_date_fin_validite_fiche')) { |
if (($val!='')and($val!=BAZ_CHOISIR)and($val!=BAZ_NON_PRECISE)) { |
$res .= '<span class="rubrique">'.constant($tableau[$i]['label']).':</span>'."\n"; |
$res .= '<span class="description"> '.$val.'</span>'."\n".'<br />'."\n"; |
} |
176,7 → 185,6 |
} |
} |
} |
} |
//afficher les liens pour l'annonce |
$requete = 'SELECT bu_url, bu_descriptif_url FROM bazar_url WHERE bu_ce_fiche='.$GLOBALS['_BAZAR_']['id_fiche']; |
$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ; |
224,19 → 232,20 |
$res .= '</div>'."\n"; |
$res .= '<div class="bulle_bas"> </div>'."\n"; |
$res .= '<div id="BAZ_bas_page">'; |
} |
|
//informations complementaires (id fiche, etat publication,... ) |
if ($danslappli==1) { |
$res .= '<span class="rubrique">'.BAZ_NUM_FICHE.':</span> '.$GLOBALS['_BAZAR_']['id_fiche'].'<br />'."\n"; |
$res .= '<span class="rubrique">'.BAZ_NATURE.':</span> '.$GLOBALS['_BAZAR_']['typeannonce'].'<br />'."\n"; |
if ($ligne['bf_statut_fiche']==1) { |
$res .= '<span class="rubrique">'.BAZ_PUBLIEE.':</span> '.BAZ_OUI.'<br />'."\n"; |
$res .= '<span class="rubrique">'.BAZ_PUBLIEE.':</span> '.BAZ_DU.' '.strftime('%d.%m.%Y',strtotime($ligne['bf_date_debut_validite_fiche'])).' '.BAZ_AU.' '.strftime('%d.%m.%Y',strtotime($ligne['bf_date_fin_validite_fiche'])).'<br />'."\n"; |
} |
else { |
$res .= '<span class="rubrique">'.BAZ_PUBLIEE.':</span> '.BAZ_NON.'<br />'."\n"; |
} |
$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'])); |
$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'])).'<br />'."\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); |