\n";
if (isset($enregistrer) && $enregistrer==1 && !$nom_bannette) $enregistrer = 2 ;
$bannette = new bannette($id_bannette);
print "
".$msg['dsi_bannette_edit']."
\n";
//Instantiation d'une classe recherche
$search_class=new search();
if(isset($search) && $search) {
$search_class->unhistorize_search();
$search_class->strip_slashes();
$equation = $search_class->serialize_search();
} else {
$bannette_equations = new bannette_equations($bannette->id_bannette);
$equations = $bannette_equations->get_equations();
$instance_equation = new equation($equations[0]);
if (!isset($enregistrer) || !$enregistrer) {
$equation = $instance_equation->requete;
} else {
$equation = stripslashes($equation);
// $search_class->unserialize_search($equation);
}
}
$search_class->unserialize_search($equation);
$equ_human = $search_class->make_serialized_human_query($equation);
if ($equation) {
if (isset($enregistrer) && $enregistrer=='1') {
if(!isset($instance_equation)) {
$instance_equation = new equation();
}
$instance_equation->set_properties_from_form();
$instance_equation->save();
$bannette->set_properties_from_form();
$bannette->save();
$query = 'SELECT * FROM bannette_equation WHERE num_equation = '.$instance_equation->id_equation;
$result = pmb_mysql_query($query);
if (!pmb_mysql_num_rows($result)) {
$rqt_bannette_equation = "INSERT INTO bannette_equation (num_bannette, num_equation) VALUES (".$bannette->id_bannette.", $instance_equation->id_equation)";
pmb_mysql_query($rqt_bannette_equation);
$bannette->set_bannette_equations();
$bannette->vider();
$bannette->remplir();
} else {
// mise à jour de l'instance bannette_equations de classe bannette
$bannette->set_bannette_equations();
$bannette->vider();
$bannette->remplir();
}
// bannette modifiée, on supprime le bouton des rech multicritères
$_SESSION['abon_edit_bannette_priv'] = 0 ;
print "
" ;
print str_replace("!!nom_bannette!!", $bannette->nom_bannette, $msg['dsi_bannette_saved']);
print "
" ;
if (!empty($bannette_diffuse_checked)) {
$bannette->diffuser();
}
// pour construction correcte du mail de diffusion
$liens_opac = array() ;
} else {
print '';
print $equ_human;
$search_class->unserialize_search($equation);
print $search_class->make_hidden_search_form($base_path."/index.php?tab=dsi&bt_edit_bannette_priv=1&search_type_asked=extended_search&id_bannette=".$bannette->id_bannette,"bannette_search_form_".$bannette->id_bannette);
// $search_class->destroy_global_env();
print "
id_bannette."'].submit();\" style='cursor : pointer'>";
print "";
print "";
print "
";
print "
".$bannette->get_short_form($equation);
}
} else {
if (isset($enregistrer) && $enregistrer=='1') {
if(!isset($instance_equation)) {
$instance_equation = new equation();
}
$instance_equation->set_properties_from_form();
$instance_equation->save();
$bannette->set_properties_from_form();
$bannette->save();
$query = 'SELECT num_equation FROM bannette_equations WHERE num_equation = '.$instance_equation->id_equation. ' LIMIT 1';
$result = pmb_mysql_query($query);
if (!pmb_mysql_num_rows($result)) {
$rqt_bannette_equation = "INSERT INTO bannette_equation (num_bannette, num_equation) VALUES (".$bannette->id_bannette.", $instance_equation->id_equation)";
pmb_mysql_query($rqt_bannette_equation);
}
print "
";
print str_replace("!!nom_bannette!!", $bannette->nom_bannette, $msg['dsi_bannette_saved']);
print "
".$msg['dsi_bannette_no_equation'];
} else {
print '";
print "
".$bannette->get_short_form($equation);
}
}
print "\n";
?>