Line 45... |
Line 45... |
45 |
*/
|
45 |
*/
|
46 |
function baz_voir_fiche($danslappli, $idfiche='') {
|
46 |
function baz_voir_fiche($danslappli, $idfiche='') {
|
47 |
if (isset($_GET['id_fiche'])) $GLOBALS['_BAZAR_']['id_fiche']=$_GET['id_fiche'];
|
47 |
if (isset($_GET['id_fiche'])) $GLOBALS['_BAZAR_']['id_fiche']=$_GET['id_fiche'];
|
48 |
if ($idfiche!='') $GLOBALS['_BAZAR_']['id_fiche']=$idfiche;
|
48 |
if ($idfiche!='') $GLOBALS['_BAZAR_']['id_fiche']=$idfiche;
|
Line -... |
Line 49... |
- |
|
49 |
|
- |
|
50 |
$url= $GLOBALS['_BAZAR_']['url'];
|
- |
|
51 |
$url->addQueryString('action', BAZ_VOIR_FICHE);
|
- |
|
52 |
$url->addQueryString('id_fiche', $GLOBALS['_BAZAR_']['id_fiche']);
|
- |
|
53 |
$url = preg_replace ('/&/', '&', $url->getURL()) ;
|
- |
|
54 |
|
- |
|
55 |
//cas ou un commetaire a été entré
|
- |
|
56 |
if (isset($_POST['Nom'])) {
|
- |
|
57 |
$requete = 'INSERT INTO bazar_commentaires VALUES ('.$GLOBALS['_BAZAR_']['id_fiche'].', "'.$_POST['Nom'].'", "'.$_POST['Commentaire'].'", NOW() )';
|
- |
|
58 |
$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
|
- |
|
59 |
}
|
49 |
|
60 |
else {
|
50 |
//on met à jour le nb de visites pour la fiche
|
61 |
//sinon on met à jour le nb de visites pour la fiche, puisque c'est une simple consultation
|
51 |
$requete = 'UPDATE bazar_fiche SET bf_nb_consultations=bf_nb_consultations+1 WHERE bf_id_fiche='.$GLOBALS['_BAZAR_']['id_fiche'];
|
62 |
$requete = 'UPDATE bazar_fiche SET bf_nb_consultations=bf_nb_consultations+1 WHERE bf_id_fiche='.$GLOBALS['_BAZAR_']['id_fiche'];
|
- |
|
63 |
$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
|
Line 52... |
Line 64... |
52 |
$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
|
64 |
}
|
53 |
|
65 |
|
54 |
//on cherche le type d'annonce, l'annonceur et les stats
|
66 |
//on cherche le type d'annonce, l'annonceur et les stats
|
55 |
$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'];
|
67 |
$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'];
|
Line 62... |
Line 74... |
62 |
$GLOBALS['_BAZAR_']['commentaire']=$ligne['bn_commentaire'];
|
74 |
$GLOBALS['_BAZAR_']['commentaire']=$ligne['bn_commentaire'];
|
63 |
$GLOBALS['_BAZAR_']['appropriation']=$ligne['bn_appropriation'];
|
75 |
$GLOBALS['_BAZAR_']['appropriation']=$ligne['bn_appropriation'];
|
64 |
$GLOBALS['_BAZAR_']['annonceur']=$ligne['bf_ce_utilisateur'];
|
76 |
$GLOBALS['_BAZAR_']['annonceur']=$ligne['bf_ce_utilisateur'];
|
65 |
$GLOBALS['_BAZAR_']['nb_consultations']=$ligne['bf_nb_consultations'];
|
77 |
$GLOBALS['_BAZAR_']['nb_consultations']=$ligne['bf_nb_consultations'];
|
66 |
}
|
78 |
}
|
- |
|
79 |
|
- |
|
80 |
//on vérifie si l'utilisateur est administrateur
|
- |
|
81 |
$est_admin=0;
|
- |
|
82 |
if ($GLOBALS['AUTH']->getAuth()) {
|
- |
|
83 |
$requete='SELECT bn_id_nature FROM bazar_nature WHERE bn_label_nature="'.$GLOBALS['_BAZAR_']['typeannonce'].'"';
|
- |
|
84 |
$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
|
- |
|
85 |
if (DB::isError($resultat)) {
|
- |
|
86 |
die ($resultat->getMessage().$resultat->getDebugInfo()) ;
|
- |
|
87 |
}
|
- |
|
88 |
$result = $resultat->fetchRow(DB_FETCHMODE_ASSOC);
|
- |
|
89 |
if ((niveau_droit($result['bn_id_nature'],$GLOBALS['AUTH']->getAuthData(BAZ_CHAMPS_ID))=='administrateur')
|
- |
|
90 |
or(niveau_droit('0',$GLOBALS['AUTH']->getAuthData(BAZ_CHAMPS_ID))=='superadministrateur'))
|
- |
|
91 |
{
|
- |
|
92 |
$est_admin=1;
|
- |
|
93 |
}
|
- |
|
94 |
}
|
- |
|
95 |
|
67 |
$res = '<div class="BAZ_cadre_fiche">'."\n";
|
96 |
$res = '<div class="BAZ_cadre_fiche">'."\n";
|
68 |
$res .= '<div class="BAZ_cadre_fiche_haut">'."\n";
|
97 |
$res .= '<div class="BAZ_cadre_fiche_haut">'."\n";
|
69 |
$res .= ' </div>'."\n";
|
98 |
$res .= ' </div>'."\n";
|
70 |
$res .= '<div class="BAZ_cadre_fiche_corps">'."\n";
|
99 |
$res .= '<div class="BAZ_cadre_fiche_corps">'."\n";
|
Line 150... |
Line 179... |
150 |
while ($ligne2 = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
|
179 |
while ($ligne2 = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
|
151 |
$res .= '<li><a href="http://'.$_SERVER['HTTP_HOST'].'/client/bazar/upload/'.$ligne2['bfj_fichier'].'">'.$ligne2['bfj_description'].'</a></li>'."\n";
|
180 |
$res .= '<li><a href="http://'.$_SERVER['HTTP_HOST'].'/client/bazar/upload/'.$ligne2['bfj_fichier'].'">'.$ligne2['bfj_description'].'</a></li>'."\n";
|
152 |
}
|
181 |
}
|
153 |
$res .= '</ul></span>'."\n";
|
182 |
$res .= '</ul></span>'."\n";
|
154 |
}
|
183 |
}
|
155 |
$res .= '<div id="bulle_haut"> </div>'."\n";
|
184 |
$res .= '<div class="bulle_haut"> </div>'."\n";
|
156 |
$res .= '<div id="bulle_corps">'."\n";
|
185 |
$res .= '<div class="bulle_corps">'."\n";
|
Line 157... |
Line 186... |
157 |
|
186 |
|
158 |
//affichage du rédacteur de la fiche
|
187 |
//affichage du rédacteur de la fiche
|
159 |
$requete = 'SELECT '.BAZ_CHAMPS_NOM.', '.BAZ_CHAMPS_PRENOM.', '.BAZ_CHAMPS_EMAIL.' FROM '.BAZ_ANNUAIRE.' WHERE '.BAZ_CHAMPS_ID.'='.$GLOBALS['_BAZAR_']['annonceur'];
|
188 |
$requete = 'SELECT '.BAZ_CHAMPS_NOM.', '.BAZ_CHAMPS_PRENOM.', '.BAZ_CHAMPS_EMAIL.' FROM '.BAZ_ANNUAIRE.' WHERE '.BAZ_CHAMPS_ID.'='.$GLOBALS['_BAZAR_']['annonceur'];
|
160 |
$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
|
189 |
$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
|
Line 164... |
Line 193... |
164 |
while ($redacteur = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
|
193 |
while ($redacteur = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
|
165 |
$res .= BAZ_FICHE_ECRITE.'<a href="mailto:'.$redacteur[BAZ_CHAMPS_EMAIL].'">'.$redacteur[BAZ_CHAMPS_PRENOM].' '.$redacteur[BAZ_CHAMPS_NOM].'</a><br />'."\n";
|
194 |
$res .= BAZ_FICHE_ECRITE.'<a href="mailto:'.$redacteur[BAZ_CHAMPS_EMAIL].'">'.$redacteur[BAZ_CHAMPS_PRENOM].' '.$redacteur[BAZ_CHAMPS_NOM].'</a><br />'."\n";
|
166 |
}
|
195 |
}
|
167 |
$res .= BAZ_NB_VUS.'<strong>'.$GLOBALS['_BAZAR_']['nb_consultations'].'</strong>'.BAZ_FOIS.'<br />'."\n";
|
196 |
$res .= BAZ_NB_VUS.'<strong>'.$GLOBALS['_BAZAR_']['nb_consultations'].'</strong>'.BAZ_FOIS.'<br />'."\n";
|
168 |
$res .= '</div>'."\n";
|
197 |
$res .= '</div>'."\n";
|
169 |
$res .= '<div id="bulle_bas"> </div>'."\n";
|
198 |
$res .= '<div class="bulle_bas"> </div>'."\n";
|
170 |
$res .= '<div id="BAZ_bas_page">';
|
199 |
$res .= '<div id="BAZ_bas_page">';
|
- |
|
200 |
|
171 |
//informations complémentaires (id fiche, état publication,... )
|
201 |
//informations complémentaires (id fiche, état publication,... )
|
172 |
if ($danslappli==1) {
|
202 |
if ($danslappli==1) {
|
173 |
$res .= '<span class="rubrique">'.BAZ_NUM_FICHE.':</span> '.$GLOBALS['_BAZAR_']['id_fiche'].'<br />'."\n";
|
203 |
$res .= '<span class="rubrique">'.BAZ_NUM_FICHE.':</span> '.$GLOBALS['_BAZAR_']['id_fiche'].'<br />'."\n";
|
174 |
$res .= '<span class="rubrique">'.BAZ_NATURE.':</span> '.$GLOBALS['_BAZAR_']['typeannonce'].'<br />'."\n";
|
204 |
$res .= '<span class="rubrique">'.BAZ_NATURE.':</span> '.$GLOBALS['_BAZAR_']['typeannonce'].'<br />'."\n";
|
175 |
if ($ligne['bf_statut_fiche']==1) {
|
205 |
if ($ligne['bf_statut_fiche']==1) {
|
Line 178... |
Line 208... |
178 |
else {
|
208 |
else {
|
179 |
$res .= '<span class="rubrique">'.BAZ_PUBLIEE.':</span> '.BAZ_NON.'<br />'."\n";
|
209 |
$res .= '<span class="rubrique">'.BAZ_PUBLIEE.':</span> '.BAZ_NON.'<br />'."\n";
|
180 |
}
|
210 |
}
|
181 |
$res .= '<span class="rubrique">'.BAZ_DATE_CREATION.':</span> '.strftime('%d.%m.%Y à %H:%M',strtotime($ligne['bf_date_creation_fiche'])).'<br />'."\n";
|
211 |
$res .= '<span class="rubrique">'.BAZ_DATE_CREATION.':</span> '.strftime('%d.%m.%Y à %H:%M',strtotime($ligne['bf_date_creation_fiche'])).'<br />'."\n";
|
182 |
$res .= '<span class="rubrique">'.BAZ_DATE_MAJ.':</span> '.strftime('%d.%m.%Y à %H:%M',strtotime($ligne['bf_date_maj_fiche']));
|
212 |
$res .= '<span class="rubrique">'.BAZ_DATE_MAJ.':</span> '.strftime('%d.%m.%Y à %H:%M',strtotime($ligne['bf_date_maj_fiche']));
|
183 |
//pour les identifiés seulement, administrateurs de la rubrique ou superadmins
|
- |
|
184 |
if ($GLOBALS['AUTH']->getAuth()) {
|
- |
|
185 |
$est_admin=0;
|
- |
|
186 |
$requete='SELECT bn_id_nature FROM bazar_nature WHERE bn_label_nature="'.$GLOBALS['_BAZAR_']['typeannonce'].'"';
|
- |
|
187 |
$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
|
- |
|
188 |
if (DB::isError($resultat)) {
|
- |
|
189 |
die ($resultat->getMessage().$resultat->getDebugInfo()) ;
|
- |
|
190 |
}
|
- |
|
191 |
$result = $resultat->fetchRow(DB_FETCHMODE_ASSOC);
|
- |
|
192 |
if ((niveau_droit($result['bn_id_nature'],$GLOBALS['AUTH']->getAuthData(BAZ_CHAMPS_ID)))=='administrateur') {
|
213 |
if (($est_admin)or($GLOBALS['_BAZAR_']['annonceur']==$GLOBALS['AUTH']->getAuthData(BAZ_CHAMPS_ID))) {
|
193 |
$est_admin=1;
|
- |
|
194 |
}
|
- |
|
195 |
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))) {
|
- |
|
196 |
$lien_modifier=$GLOBALS['_BAZAR_']['url'];
|
214 |
$lien_modifier=$GLOBALS['_BAZAR_']['url'];
|
197 |
$lien_modifier->addQueryString('action', BAZ_ACTION_MODIFIER);
|
215 |
$lien_modifier->addQueryString('action', BAZ_ACTION_MODIFIER);
|
198 |
$lien_modifier->addQueryString('id_fiche', $GLOBALS['_BAZAR_']['id_fiche']);
|
216 |
$lien_modifier->addQueryString('id_fiche', $GLOBALS['_BAZAR_']['id_fiche']);
|
199 |
$lien_modifier->addQueryString('typeannonce', $GLOBALS['_BAZAR_']['typeannonce']);
|
217 |
$lien_modifier->addQueryString('typeannonce', $GLOBALS['_BAZAR_']['typeannonce']);
|
200 |
$res .= ' <a href="'.$lien_modifier->getURL().'">'.BAZ_MODIFIER_LA_FICHE.'</a>'."\n";
|
218 |
$res .= ' <a href="'.$lien_modifier->getURL().'">'.BAZ_MODIFIER_LA_FICHE.'</a>'."\n";
|
201 |
}
|
219 |
}
|
202 |
}
|
220 |
}
|
203 |
}
|
- |
|
204 |
$res .= '</div>'."\n";
|
221 |
$res .= '</div>'."\n";
|
205 |
$res .= '</div>'."\n";
|
222 |
$res .= '</div>'."\n";
|
206 |
$res .= '<div class="BAZ_cadre_fiche_bas"> </div>'."\n";
|
223 |
$res .= '<div class="BAZ_cadre_fiche_bas"> </div>'."\n";
|
207 |
$res .= '</div>'."\n";
|
224 |
$res .= '</div>'."\n";
|
Line 216... |
Line 233... |
216 |
$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
|
233 |
$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
|
217 |
if (DB::isError ($resultat)) {
|
234 |
if (DB::isError ($resultat)) {
|
218 |
die ($resultat->getMessage().'<br />'.$resultat->getDebugInfo()) ;
|
235 |
die ($resultat->getMessage().'<br />'.$resultat->getDebugInfo()) ;
|
219 |
}
|
236 |
}
|
220 |
if ($resultat->numRows()>0) {
|
237 |
if ($resultat->numRows()>0) {
|
221 |
$res .= 'Il y a '.$resultat->numRows();
|
238 |
$res .= BAZ_IL_Y_A.$resultat->numRows().' ';
|
222 |
if ($resultat->numRows()==1) $res .= 'commentaire : '.'<br />'."\n";
|
239 |
if ($resultat->numRows()==1) $res .= BAZ_COMMENTAIRE.'<br />'."\n";
|
223 |
else $res .= 'commentaires : '.'<br />'."\n";
|
240 |
else $res .= BAZ_COMMENTAIRES.'<br />'."\n";
|
224 |
while ($ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
|
241 |
while ($ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
|
- |
|
242 |
$res .= '<div class="bulle_haut"> </div>'."\n";
|
- |
|
243 |
$res .= '<div class="bulle_corps">'."\n";
|
- |
|
244 |
//affichage du commentaire
|
- |
|
245 |
$res .= $ligne['bc_commentaire'].'<br />'."\n";
|
225 |
$res .= 'essai'."\n";
|
246 |
$res .= '</div>'."\n";
|
- |
|
247 |
$res .= '<div class="bulle_bas">'."\n";
|
- |
|
248 |
$res .= '<span style="font-size:9px;margin-left:10px;">'.BAZ_PAR.' : <strong>'.$ligne['bc_nom'].'</strong>'.BAZ_ECRIT_LE.$ligne['bc_date'].'</span>'."\n";
|
- |
|
249 |
//pour les identifiés seulement, administrateurs de la rubrique ou superadmins
|
- |
|
250 |
if ($est_admin==1) {
|
- |
|
251 |
$url_comment= $GLOBALS['_BAZAR_']['url'];
|
- |
|
252 |
$url_comment->addQueryString('action', BAZ_VOIR_FICHE);
|
- |
|
253 |
$url_comment->addQueryString('id_fiche', $GLOBALS['_BAZAR_']['id_fiche']);
|
- |
|
254 |
$url_comment->addQueryString('date', $ligne['bc_date']);
|
- |
|
255 |
$res .= '<span style="float:right;"><a href="'.$url_comment->getURL().'">'.BAZ_SUPPRIMER.'</a></span>'."\n";
|
- |
|
256 |
}
|
- |
|
257 |
$res .= '</div>'."\n";
|
226 |
}
|
258 |
}
|
227 |
}
|
259 |
}
|
228 |
else $res .= BAZ_PAS_DE_COMMENTAIRES.'<br />'."\n";
|
260 |
else $res .= BAZ_PAS_DE_COMMENTAIRES.'<br /><br />'."\n";
|
- |
|
261 |
|
- |
|
262 |
//formulaire des commentaires
|
- |
|
263 |
$form_commentaire = new HTML_QuickForm('commentaire', 'post', $url);
|
- |
|
264 |
$squelette =& $form_commentaire->defaultRenderer();
|
- |
|
265 |
$squelette->setFormTemplate("\n".'<form {attributes}>'."\n".'{content}'."\n".'</form>'."\n");
|
- |
|
266 |
$squelette->setElementTemplate( '<label style="width:200px;">{label} </label><br />'."\n".'{element}<br />'."\n");
|
- |
|
267 |
$squelette->setRequiredNoteTemplate("\n".'{requiredNote} '."\n");
|
- |
|
268 |
$option=array('style'=>'width:300px;', 'maxlength'=>100);
|
- |
|
269 |
$form_commentaire->addElement('text', 'Nom', BAZ_ENTREZ_VOTRE_NOM, $option);
|
- |
|
270 |
$option=array('style'=>'width:100%;height:100px;white-space: pre;padding:3px;');
|
- |
|
271 |
require_once 'HTML/QuickForm/textarea.php';
|
- |
|
272 |
$formtexte= new HTML_QuickForm_textarea('Commentaire', BAZ_ENTREZ_VOTRE_COMMENTAIRE, $option);
|
- |
|
273 |
$form_commentaire->addElement($formtexte) ;
|
- |
|
274 |
$form_commentaire->addElement('submit', 'Envoyer', BAZ_ENVOYER);
|
- |
|
275 |
$form_commentaire->addRule('Nom', BAZ_NOM_REQUIS, 'required', '', 'client') ;
|
- |
|
276 |
$form_commentaire->addRule('Commentaire', BAZ_COMMENTAIRE_REQUIS, 'required', '', 'client') ;
|
- |
|
277 |
$form_commentaire->setRequiredNote(BAZ_CHAMPS_REQUIS) ;
|
- |
|
278 |
$res .= $form_commentaire->toHTML();
|
- |
|
279 |
|
229 |
$res .= '</div>'."\n";
|
280 |
$res .= '</div>'."\n";
|
230 |
$res .= '<div class="BAZ_cadre_fiche_bas"> </div>'."\n";
|
281 |
$res .= '<div class="BAZ_cadre_fiche_bas"> </div>'."\n";
|
231 |
$res .= '</div>'."\n";
|
282 |
$res .= '</div>'."\n";
|
232 |
}
|
283 |
}
|