function Fermer(obj,type_doc) {
var id_obj=parent.document.getElementById(obj);
if(type_doc==1) id_obj.className='lien_date';
else if(type_doc==2) id_obj.className='lien_date_hs';
else if(type_doc==3) id_obj.className='lien_date_hs_p';
else id_obj.className='';
parent.kill_frame_periodique();
}
ENDOFFILE;
$form="";
$type_doc=0;
switch ($act) {
case 'update':
$requete = "delete FROM abts_grille_modele WHERE num_modele='$modele_id' and date_parution ='$date_parution'";
mysql_query($requete, $dbh);
if (isset($doc_type[1])) {
$form=str_replace("!!check_periodique!!","checked",$form);
$requete = "INSERT INTO abts_grille_modele SET num_modele='$modele_id', date_parution ='$date_parution', type_serie = '1', nombre_recu= '$nombre_recu'";
mysql_query($requete, $dbh);
$type_doc=1;
}
if (isset($doc_type[2])) {
$form=str_replace("!!check_hors_serie!!","checked",$form);
$requete = "INSERT INTO abts_grille_modele SET num_modele='$modele_id', date_parution ='$date_parution', type_serie = '2', numero='$numero'";
mysql_query($requete, $dbh);
$type_doc+=2;
}
$form="";
break;
case 'change':
$requete = "select type_serie, numero from abts_grille_modele where num_modele='$modele_id' and date_parution ='$date_parution'";
$resultat=mysql_query($requete);
if(mysql_num_rows($resultat)) { // Supprimer une réception
while($r=mysql_fetch_object($resultat)) {
$type_serie=$r->type_serie;
$numero=$r->numero;
if($type_serie==1) {
$requete = "delete FROM abts_grille_modele WHERE num_modele='$modele_id' and date_parution ='$date_parution' and type_serie = '1'";
mysql_query($requete, $dbh);
$supprime=1;
}
if($type_serie==2) $type_doc=2;
}
}
if($supprime==0) { // Ajout
$requete = "INSERT INTO abts_grille_modele SET num_modele='$modele_id', date_parution ='$date_parution', type_serie = '1'";
mysql_query($requete, $dbh);
$type_doc+=1;
}
$form="";
break;
default:
$checked1="";
$checked2="";
$nombre_recu=1;
$requete = "select type_serie, numero, nombre_recu from abts_grille_modele where num_modele='$modele_id' and date_parution ='$date_parution'";
$resultat=mysql_query($requete);
if(mysql_num_rows($resultat)) {
while($r=mysql_fetch_object($resultat)){
$type_serie=$r->type_serie;
if($type_serie==1) {
$checked1="checked";
$nombre_recu=$r->nombre_recu;
}
if($type_serie==2) {
$numero=$r->numero;
$checked2="checked";
}
}
}
$form=str_replace("!!numero!!",$numero,$form);
$form=str_replace("!!check_periodique!!",$checked1,$form);
$form=str_replace("!!check_hors_serie!!",$checked2,$form);
$form=str_replace("!!date_parution!!",formatdate($date_parution),$form);
$form=str_replace("!!nombre_recu!!",$nombre_recu,$form);
break;
}
print str_replace("!!form!!",$form,$templates);
print "