setDomain(1); $acces_jm = $dom_1->getJoin($PMBuserid,8,'num_notice'); //modification $acces_jl = $dom_1->getJoin($PMBuserid,4,'num_notice'); //lecture } switch ($avis_quoifaire) { case 'valider': for ($i=0 ; $i < sizeof($valid_id_avis) ; $i++) { $acces_m=1; if ($acces_jm) { $q = "select count(1) from avis $acces_jm where id_avis=".$valid_id_avis[$i]; $r = mysql_query($q, $dbh); if(mysql_result($r,0,0)==0) { $acces_m=0; } } if ($acces_m!=0) { $rqt = "update avis set valide=1 where id_avis='".$valid_id_avis[$i]."' "; mysql_query ($rqt, $dbh) ; } } break; case 'invalider': for ($i=0 ; $i < sizeof($valid_id_avis) ; $i++) { $acces_m=1; if ($acces_jm) { $q = "select count(1) from avis $acces_jm where id_avis=".$valid_id_avis[$i]; $r = mysql_query($q, $dbh); if(mysql_result($r,0,0)==0) { $acces_m=0; } } if ($acces_m!=0) { $rqt = "update avis set valide=0 where id_avis='".$valid_id_avis[$i]."' "; mysql_query ($rqt, $dbh) ; } } break; case 'supprimer' : for ($i=0 ; $i < sizeof($valid_id_avis) ; $i++) { $acces_m=1; if ($acces_jm) { $q = "select count(1) from avis $acces_jm where id_avis=".$valid_id_avis[$i]; $r = mysql_query($q, $dbh); if(mysql_result($r,0,0)==0) { $acces_m=0; } } if ($acces_m!=0) { $rqt = "delete from avis where id_avis='".$valid_id_avis[$i]."' "; mysql_query ($rqt, $dbh) ; } } break; case 'ajouter' : global $avis_note,$avis_sujet, $avis_commentaire; if (!$avis_note) $avis_note="NULL"; if($charset != "utf-8") $avis_commentaire=cp1252Toiso88591($avis_commentaire); $sql="insert into avis (num_empr,num_notice,note,sujet,commentaire) values ('0','$id','$avis_note','$avis_sujet','".$avis_commentaire."')"; mysql_query($sql, $dbh); break; default: break; } } $aff=""; $req_avis="select id_avis,note,sujet,commentaire,DATE_FORMAT(dateajout,'".$msg['format_date']."') as ladate,empr_login,empr_nom, empr_prenom, valide from avis left join empr on id_empr=num_empr where num_notice='".$id."' order by avis_rank, dateajout desc"; $r = mysql_query($req_avis, $dbh); $nb_avis=0; $nb_avis=mysql_numrows($r); $aff= "
"; $i=0; while ($loc = mysql_fetch_object($r)) { if($pmb_javascript_office_editor) { $office_editor_cmd=" tinyMCE.execCommand('mceAddControl', true, 'avis_desc_".$loc->id_avis."'); "; } $avis_notice= "
id_avis."');$office_editor_cmd\">
" ; if($opac_avis_note_display_mode==2){ $note=$msg["avis_detail_note_".$loc->note]." "; }else if($opac_avis_note_display_mode!=0){ $note=$msg[gestion_avis_note]." ".$loc->note." "; }else $note=""; if (!$loc->valide) $avis_notice.= "$note".htmlentities($loc->sujet,ENT_QUOTES,$charset).""; else $avis_notice.= "$note".htmlentities($loc->sujet,ENT_QUOTES,$charset).""; if($charset != "utf-8") $loc->commentaire=cp1252Toiso88591($loc->commentaire); $avis_notice.= ", ".$loc->ladate." $loc->empr_prenom $loc->empr_nom
".do_bbcode($loc->commentaire)."

"; //Drag pour tri $id_elt = $loc->id_avis; $drag_avis= "
"; $aff.= $drag_avis.$avis_notice."
"; $i++; } $avis_tpl_form=$avis_tpl_form1; $avis_tpl_form=str_replace("!!notice_id!!",$id,$avis_tpl_form); $add_avis_onclick="show_add_avis(".$id.");"; $aff.=" $avis_tpl_form
       
 
"; if($avis_quoifaire) $deplier=1; $aff=gen_plus("plus_avis_notice_".$id,$msg["avis_notice_titre"]." ($nb_avis)",$aff,$deplier,'',"recalc_recept();"); return $aff; }