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= "
"; if($avis_quoifaire) $deplier=1; $aff=gen_plus("plus_avis_notice_".$id,$msg["avis_notice_titre"]." ($nb_avis)",$aff,$deplier,'',"recalc_recept();"); return $aff; }