";
print " ";
print '';
print "
";
if ($id) {
print confirmation_delete("./admin.php?categ=connecteurs&sub=categout_sets&action=del&id=");
print "";
}
print "
";
print '';
}
function update_setcateg_from_form() {
global $msg, $charset,$dbh,$id;
global $setcateg_name, $setcateg_sets;
if (!$id) {
//Ajout d'un nouveau set
if (!$setcateg_name) {
print $msg['admin_connecteurs_setcateg_emptyfield'];
show_categ_form(0, stripslashes($setcateg_name));
return false;
}
if (connector_out_setcateg::name_exists($set_caption)) {
print $msg['admin_connecteurs_setcateg_namealreadyexists'];
show_categ_form(0, stripslashes($setcateg_name));
return false;
}
$new_setcateg = connector_out_setcateg::add_new();
$new_setcateg->name = $setcateg_name;
$new_setcateg->sets = $setcateg_sets;
$new_setcateg->commit_to_db();
}
else {
$thecateg = new connector_out_setcateg($id);
if ($thecateg->error) {
return false;
}
$thecateg->caption = $setcateg_name;
$thecateg->sets = $setcateg_sets;
$thecateg->commit_to_db();
}
return true;
}
switch ($action) {
case "add":
show_categ_form(0, '', array());
break;
case "edit":
$categ_name='';
$categ_sets=array();
if ($id) {
$the_categ = new connector_out_setcateg($id);
if ($the_categ->error) {
$id = 0;
}
else {
$categ_name=$the_categ->name;
$categ_sets=$the_categ->sets;
}
}
show_categ_form($id, $categ_name, $categ_sets);
break;
case "update":
if (update_setcateg_from_form())
list_categ();
break;
case "del":
if ($id) {
$the_categ = new connector_out_setcateg($id);
$the_categ->delete();
}
list_categ();
break;
default:
list_categ();
break;
}
?>