".$msg[noti_statut_gestion]." ".$msg[noti_statut_opac]." ".$msg[noti_statut_libelle]." ".$msg[noti_statut_visu_gestion]." ".$msg[noti_statut_libelle]." ".$msg[noti_statut_visu_opac]." ".$msg[noti_statut_visu_expl]." ".$msg[noti_statut_visu_explnum]." "; // affichage du tableau des statuts $requete = "SELECT id_notice_statut, gestion_libelle, opac_libelle, "; $requete .= "notice_visible_opac, notice_visible_gestion, notice_visible_opac_abon,"; $requete .= "expl_visible_opac, expl_visible_opac_abon, "; $requete .= "explnum_visible_opac, explnum_visible_opac_abon, "; $requete .= "class_html FROM notice_statut ORDER BY gestion_libelle "; $res = mysql_query($requete, $dbh); $nbr = mysql_num_rows($res); $parity=1; for($i=0;$i<$nbr;$i++) { $row=mysql_fetch_object($res); if ($parity % 2) { $pair_impair = "even"; } else { $pair_impair = "odd"; } $parity += 1; $tr_javascript=" onmouseover=\"this.className='surbrillance'\" onmouseout=\"this.className='$pair_impair'\" onmousedown=\"document.location='./admin.php?categ=notices&sub=statut&action=modif&id=$row->id_notice_statut';\" "; print pmb_bidi(""); print pmb_bidi("") ; if ($row->id_notice_statut<3) print pmb_bidi("$row->gestion_libelle"); else print pmb_bidi("$row->gestion_libelle"); if($row->notice_visible_gestion) print "X"; else print " "; print "$row->opac_libelle"; if($row->notice_visible_opac) print "X"; else print " "; if($row->expl_visible_opac) print "X"; else print " "; if($row->explnum_visible_opac) print "X"; else print " "; print ""; } print " "; } function statut_form($id=0, $gestion_libelle="", $opac_libelle="", $visible_opac=1, $visible_gestion=1, $expl_visible_opac=1, $class_html='', $visible_opac_abon=0, $expl_visible_opac_abon=0, $explnum_visible_opac=1, $explnum_visible_opac_abon=0) { global $msg; global $admin_notice_statut_form; global $charset; if (!$id) { $admin_notice_statut_form = str_replace('!!form_title!!', $msg[115], $admin_notice_statut_form); $admin_notice_statut_form = str_replace("!!bouton_supprimer!!","",$admin_notice_statut_form) ; } else { $admin_notice_statut_form = str_replace("!!bouton_supprimer!!","",$admin_notice_statut_form) ; $admin_notice_statut_form = str_replace('!!form_title!!', $msg[118], $admin_notice_statut_form); } $admin_notice_statut_form = str_replace('!!id!!', $id, $admin_notice_statut_form); $admin_notice_statut_form = str_replace('!!gestion_libelle!!', htmlentities($gestion_libelle,ENT_QUOTES, $charset), $admin_notice_statut_form); $admin_notice_statut_form = str_replace('!!libelle_suppr!!', addslashes($gestion_libelle), $admin_notice_statut_form); if ($visible_gestion) $checkbox="checked"; else $checkbox=""; $admin_notice_statut_form = str_replace('!!checkbox_visible_gestion!!', $checkbox, $admin_notice_statut_form); $admin_notice_statut_form = str_replace('!!opac_libelle!!', htmlentities($opac_libelle,ENT_QUOTES, $charset), $admin_notice_statut_form); if ($visible_opac) $checkbox="checked"; else $checkbox=""; $admin_notice_statut_form = str_replace('!!checkbox_visible_opac!!', $checkbox, $admin_notice_statut_form); if ($expl_visible_opac) $checkbox="checked"; else $checkbox=""; $admin_notice_statut_form = str_replace('!!checkbox_visu_expl!!', $checkbox, $admin_notice_statut_form); if ($visible_opac_abon) $checkbox="checked"; else $checkbox=""; $admin_notice_statut_form = str_replace('!!checkbox_visu_abon!!', $checkbox, $admin_notice_statut_form); // $expl_visible_opac_abon=0, $explnum_visible_opac=1, $explnum_visible_opac_abon=0 if ($expl_visible_opac_abon) $checkbox="checked"; else $checkbox=""; $admin_notice_statut_form = str_replace('!!checkbox_expl_visu_abon!!', $checkbox, $admin_notice_statut_form); if ($explnum_visible_opac) $checkbox="checked"; else $checkbox=""; $admin_notice_statut_form = str_replace('!!checkbox_explnum_visu!!', $checkbox, $admin_notice_statut_form); if ($explnum_visible_opac_abon) $checkbox="checked"; else $checkbox=""; $admin_notice_statut_form = str_replace('!!checkbox_explnum_visu_abon!!', $checkbox, $admin_notice_statut_form); for ($i=1;$i<=20; $i++) { if ($class_html=="statutnot".$i) $checked = "checked"; else $checked = ""; $couleur[$i]=" "; if ($i==10) $couleur[10].="
"; elseif ($i!=20) $couleur[$i].="|"; } $couleurs=implode("",$couleur); $admin_notice_statut_form = str_replace('!!class_html!!', $couleurs, $admin_notice_statut_form); print confirmation_delete("./admin.php?categ=notices&sub=statut&action=del&id="); print $admin_notice_statut_form; } switch($action) { case 'update': if ($id) { if ($id==1) $visu=", notice_visible_gestion=1, notice_visible_opac='$form_visible_opac', expl_visible_opac='$form_visu_expl', notice_visible_opac_abon='$form_visu_abon', expl_visible_opac_abon='$form_expl_visu_abon', explnum_visible_opac='$form_explnum_visu', explnum_visible_opac_abon='$form_explnum_visu_abon' "; else $visu=", notice_visible_gestion='$form_visible_gestion', notice_visible_opac='$form_visible_opac', expl_visible_opac='$form_visu_expl', notice_visible_opac_abon='$form_visu_abon', expl_visible_opac_abon='$form_expl_visu_abon', explnum_visible_opac='$form_explnum_visu', explnum_visible_opac_abon='$form_explnum_visu_abon' "; $requete = "UPDATE notice_statut SET gestion_libelle='$form_gestion_libelle', opac_libelle='$form_opac_libelle', class_html='$form_class_html' $visu WHERE id_notice_statut='$id' "; $res = mysql_query($requete, $dbh); } else { $requete = "INSERT INTO notice_statut SET gestion_libelle='$form_gestion_libelle',notice_visible_gestion='$form_visible_gestion',opac_libelle='$form_opac_libelle', notice_visible_opac='$form_visible_opac', expl_visible_opac='$form_visu_expl', class_html='$form_class_html', notice_visible_opac_abon='$form_visu_abon', expl_visible_opac_abon='$form_expl_visu_abon', explnum_visible_opac='$form_explnum_visu', explnum_visible_opac_abon='$form_explnum_visu_abon' "; $res = mysql_query($requete, $dbh); } show_statut($dbh); break; case 'add': if (empty($form_gestion_libelle)) statut_form(); else show_statut($dbh); break; case 'modif': if ($id) { $requete = "SELECT id_notice_statut, gestion_libelle, opac_libelle, notice_visible_opac, notice_visible_gestion, expl_visible_opac, class_html, notice_visible_opac_abon, expl_visible_opac_abon, explnum_visible_opac, explnum_visible_opac_abon FROM notice_statut WHERE id_notice_statut='$id'"; $res = mysql_query($requete, $dbh); if(mysql_num_rows($res)) { $row=mysql_fetch_object($res); statut_form($row->id_notice_statut, $row->gestion_libelle, $row->opac_libelle, $row->notice_visible_opac, $row->notice_visible_gestion, $row->expl_visible_opac, $row->class_html, $row->notice_visible_opac_abon, $row->expl_visible_opac_abon, $row->explnum_visible_opac, $row->explnum_visible_opac_abon ); } else { show_statut($dbh); } } else { show_statut($dbh); } break; case 'del': if ($id && $id!=1 && $id!=2) { $total = 0; $total = mysql_result(mysql_query("select count(1) from notices where statut ='".$id."' ", $dbh), 0, 0); if ($total==0) { $requete = "DELETE FROM notice_statut WHERE id_notice_statut='$id' "; $res = mysql_query($requete, $dbh); $requete = "OPTIMIZE TABLE notice_statut "; $res = mysql_query($requete, $dbh); show_statut($dbh); } else { error_message( $msg[noti_statut_noti], $msg[noti_statut_used], 1, 'admin.php?categ=notices&sub=statut&action='); } } else show_statut($dbh); break; default: show_statut($dbh); break; }