Subversion Repositories Applications.bazar

Compare Revisions

Ignore whitespace Rev 6 → Rev 7

/trunk/bibliotheque/bazar.fonct.rss.php
44,28 → 44,35
* @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;
//on cherche le type d'annonce
$requete = 'SELECT bn_label_nature FROM bazar_fiche, bazar_nature WHERE bn_id_nature=bf_ce_nature AND bf_id_fiche='.$GLOBALS['_BAZAR_']['id_fiche'];
//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) ;
//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) ;
if (DB::isError($resultat)) {
die ($resultat->getMessage().$resultat->getDebugInfo()) ;
}
while ($ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
$GLOBALS['_BAZAR_']['typeannonce']=$ligne['bn_label_nature'];
$GLOBALS['_BAZAR_']['commentaire']=$ligne['bn_commentaire'];
$GLOBALS['_BAZAR_']['appropriation']=$ligne['bn_appropriation'];
$GLOBALS['_BAZAR_']['annonceur']=$ligne['bf_ce_utilisateur'];
$GLOBALS['_BAZAR_']['nb_consultations']=$ligne['bf_nb_consultations'];
}
$res = '<div id="BAZ_cadre_fiche">'."\n";
$res .= '<div id="BAZ_cadre_fiche_haut">'."\n";
$res = '<div class="BAZ_cadre_fiche">'."\n";
$res .= '<div class="BAZ_cadre_fiche_haut">'."\n";
$res .= '&nbsp;</div>'."\n";
$res .= '<div id="BAZ_cadre_fiche_corps">'."\n";
$res .= '<div class="BAZ_cadre_fiche_corps">'."\n";
//si le template existe, on génère 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'],$danslappli);
$res .=genere_fiche($GLOBALS['_BAZAR_']['id_fiche']);
}
//on affiche ligne par ligne sinon
else {
76,10 → 83,17
}
$ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC) ;
if (isset($ligne['bf_url_image'])) $res .= '<img src="'.'http://'.$_SERVER['HTTP_HOST'].'/client/bazar/images/'.$ligne['bf_url_image'].'" border=0 alt="'.BAZ_TEXTE_IMG_ALTERNATIF.'" align="left" style="padding:0 10px 5px 0;" />'."\n";
$res .= '<h2>'.$ligne['bf_titre'].'</h2>'."\n" ;
if (isset($ligne['bf_description'])) $res .= '<br />'.$ligne['bf_description'].'<br /><br />'."\n";
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 .= '</div>'."\n";
$res .= '<div id="fiche_titre_image">'.$ligne['bf_titre'];
}
else {
$res .= '<div id="fiche_titre">'.$ligne['bf_titre'];
}
$res .= '</div>'."\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']])) {
92,67 → 106,142
die ($resultat->getMessage().'<br />'.$resultat->getDebugInfo()) ;
}
while ($tab = $resultat->fetchRow()) {
$val=encoderChaine($tab[1]);
$val=$tab[1];
}
}
else {
$val=encoderChaine($ligne[$tableau[$i]['nom_bdd']]);
$val=$ligne[$tableau[$i]['nom_bdd']];
}
if (($tableau[$i]['nom_bdd']!='bf_titre')and($tableau[$i]['nom_bdd']!='bf_description')) {
if ($val!='') $res .= '<br /><strong>'.constant($tableau[$i]['label']).':</strong> '.$val.'<br />'."\n";
if ($val!='') {
$res .= '<span class="rubrique">'.constant($tableau[$i]['label']).':</span>'."\n";
$res .= '<span class="description"> '.$val.'</span>'."\n".'<br />'."\n";
}
}
}
}
//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) ;
if (DB::isError($resultat)) {
die ($resultat->getMessage().$resultat->getDebugInfo()) ;
}
//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) ;
if (DB::isError($resultat)) {
die ($resultat->getMessage().$resultat->getDebugInfo()) ;
}
if ($resultat->numRows()>0) {
$res .= '<span class="rubrique">'.BAZ_LIEN_INTERNET.':</span>'."\n";
$res .= '<span class="description">'."\n";
$res .= '<ul>'."\n";
while ($ligne1 = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
$res .= '<li><a href="'.$ligne1['bu_url'].'" target="_blank">'.$ligne1['bu_descriptif_url'].'</a></li>'."\n";
}
if ($resultat->numRows()>0) {
$res .= '<br /><strong>'.BAZ_LIEN_INTERNET.':</strong>'."\n";
$res .= '<ul>'."\n";
while ($ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
$res .= '<li><a href="'.$ligne['bu_url'].'" target="_blank">'.$ligne['bu_descriptif_url'].'</a></li>'."\n";
$res .= '</ul></span>'."\n";
}
//afficher les fichiers pour l'annonce
$requete = 'SELECT bfj_description, bfj_fichier FROM bazar_fichier_joint WHERE bfj_ce_fiche='.$GLOBALS['_BAZAR_']['id_fiche'];
$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
if (DB::isError($resultat)) {
die ($resultat->getMessage().$resultat->getDebugInfo()) ;
}
if ($resultat->numRows()>0) {
$res .= '<span class="rubrique">'.BAZ_LISTE_FICHIERS_JOINTS.':</span>'."\n";
$res .= '<span class="description">'."\n";
$res .= '<ul>'."\n";
while ($ligne2 = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
$res .= '<li><a href="http://'.$_SERVER['HTTP_HOST'].'/client/bazar/upload/'.$ligne2['bfj_fichier'].'">'.$ligne2['bfj_description'].'</a></li>'."\n";
}
$res .= '</ul></span>'."\n";
}
$res .= '<div id="bulle_haut">&nbsp;</div>'."\n";
$res .= '<div id="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'];
$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
if (DB::isError($resultat)) {
die ($resultat->getMessage().$resultat->getDebugInfo()) ;
}
while ($redacteur = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
$res .= BAZ_FICHE_ECRITE.'<a href="mailto:'.$redacteur[BAZ_CHAMPS_EMAIL].'">'.$redacteur[BAZ_CHAMPS_PRENOM].' '.$redacteur[BAZ_CHAMPS_NOM].'</a><br />'."\n";
}
$res .= BAZ_NB_VUS.'<strong>'.$GLOBALS['_BAZAR_']['nb_consultations'].'</strong>'.BAZ_FOIS.'<br />'."\n";
$res .= '</div>'."\n";
$res .= '<div id="bulle_bas">&nbsp;</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";
$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";
}
else {
$res .= '<span class="rubrique">'.BAZ_PUBLIEE.':</span> '.BAZ_NON.'<br />'."\n";
}
$res .= '<span class="rubrique">'.BAZ_DATE_CREATION.':</span> '.strftime('%d.%m.%Y &agrave; %H:%M',strtotime($ligne['bf_date_creation_fiche'])).'<br />'."\n";
$res .= '<span class="rubrique">'.BAZ_DATE_MAJ.':</span> '.strftime('%d.%m.%Y &agrave; %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()) ;
}
$res .= '</ul>'."\n";
$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 .= '&nbsp;<a href="'.$lien_modifier->getURL().'">'.BAZ_MODIFIER_LA_FICHE.'</a>'."\n";
}
}
//afficher les fichiers pour l'annonce
$requete = 'SELECT bfj_description, bfj_fichier FROM bazar_fichier_joint WHERE bfj_ce_fiche='.$GLOBALS['_BAZAR_']['id_fiche'];
}
$res .= '</div>'."\n";
$res .= '</div>'."\n";
$res .= '<div class="BAZ_cadre_fiche_bas">&nbsp;</div>'."\n";
$res .= '</div>'."\n";
//on ajoute les commentaires, s'il le faut
if ($GLOBALS['_BAZAR_']['commentaire']==1) {
$res .= '<div class="BAZ_cadre_fiche">'."\n";
$res .= '<div class="BAZ_cadre_fiche_haut">&nbsp;</div>'."\n";
$res .= '<div class="BAZ_cadre_fiche_corps">'."\n";
$res .= '<h3>'.BAZ_LES_COMMENTAIRES.'</h3>'."\n";
$requete = 'SELECT * FROM bazar_commentaires WHERE bc_ce_id_fiche='.$GLOBALS['_BAZAR_']['id_fiche'].' ORDER BY bc_date ASC';
$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
if (DB::isError($resultat)) {
die ($resultat->getMessage().$resultat->getDebugInfo()) ;
if (DB::isError ($resultat)) {
die ($resultat->getMessage().'<br />'.$resultat->getDebugInfo()) ;
}
if ($resultat->numRows()>0) {
$res .= '<br /><strong>'.BAZ_LISTE_FICHIERS_JOINTS.':</strong>'."\n";
$res .= '<ul>'."\n";
$res .= 'Il y a '.$resultat->numRows();
if ($resultat->numRows()==1) $res .= 'commentaire : '.'<br />'."\n";
else $res .= 'commentaires : '.'<br />'."\n";
while ($ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
$res .= '<li><a href="http://'.$_SERVER['HTTP_HOST'].'/client/bazar/upload/'.$ligne['bfj_fichier'].'">'.$ligne['bfj_description'].'</a></li>'."\n";
$res .= 'essai'."\n";
}
$res .= '</ul>'."\n";
}
else $res .= BAZ_PAS_DE_COMMENTAIRES.'<br />'."\n";
$res .= '</div>'."\n";
$res .= '<div class="BAZ_cadre_fiche_bas">&nbsp;</div>'."\n";
$res .= '</div>'."\n";
}
//on ajoute les appropriations, s'il le faut
if ($GLOBALS['_BAZAR_']['appropriation']==1) {
$res .= '<div class="BAZ_cadre_fiche">'."\n";
$res .= '<div class="BAZ_cadre_fiche_haut">&nbsp;</div>'."\n";
$res .= '<div class="BAZ_cadre_fiche_corps">'."\n";
//informations complémentaires (id fiche, état publication,... )
if ($danslappli==1) {
$res .= '<br /><br /><strong>'.BAZ_NUM_FICHE.':</strong> '.$GLOBALS['_BAZAR_']['id_fiche'];
$res .= '<br /><strong>'.BAZ_NATURE.':</strong> '.$GLOBALS['_BAZAR_']['typeannonce'];
if ($ligne['bf_statut_fiche']==1) {
$res .= '<br /><strong>'.BAZ_PUBLIEE.':</strong> '.BAZ_OUI;
}
else {
$res .= '<br /><strong>'.BAZ_PUBLIEE.':</strong> '.BAZ_NON;
}
$res .= '<br /><strong>'.BAZ_DATE_CREATION.':</strong> '.$ligne['bf_date_creation_fiche'];
$res .= '<br /><strong>'.BAZ_DATE_MAJ.':</strong> '.$ligne['bf_date_maj_fiche'];
$res .='<ul><li><a href="Javascript:history.go(-1)">'.BAZ_RETOUR.'</a></li></ul>'."\n";
}
$res .= '</div>'."\n";
$res .= '<div class="BAZ_cadre_fiche_bas">&nbsp;</div>'."\n";
$res .= '</div>'."\n";
}
$res .= '</div>'."\n";
$res .= '<div id="BAZ_cadre_fiche_bas">'."\n";
$res .= '&nbsp;</div>'."\n";
$res .= '</div>'."\n";
return $res ;
}