';
}
print $tablefooter;
print " ";
}
function show_set_form($id=0, $set_type=0, $set_caption='', $config_form=NULL, $cache_config_form=NULL) {
global $msg, $charset;
global $connector_out_set_types, $connector_out_set_types_msgs;
print '';
if ($out_of_form_result)
print $out_of_form_result;
}
function update_set_from_form() {
global $msg, $charset,$dbh,$id;
global $set_type, $set_caption;
if (!$id) {
//Ajout d'un nouveau set
if (!$set_caption) {
print $msg['admin_connecteurs_set_emptyfield'];
show_set_form(0, stripslashes($set_type), stripslashes($set_caption));
return false;
}
if (connector_out_set::caption_exists($set_caption)) {
print $msg['admin_connecteurs_set_namealreadyexists'];
show_set_form(0, stripslashes($set_type), stripslashes($set_caption));
return false;
}
$new_set = connector_out_set::add_new();
$new_set->type = $set_type;
$new_set->caption = stripslashes($set_caption);
$new_set->commit_to_db();
}
else {
$theset = new_connector_out_set_typed($id);
if ($theset->error) {
return false;
}
$theset->type = $set_type;
$theset->caption = stripslashes($set_caption);
$theset->update_config_from_form();
$theset->cache->update_from_form();
$theset->commit_to_db();
$theset->cache->commit_to_db();
}
return true;
}
function show_import_noticesearch_into_multicritere_set_form() {
global $toset_search, $msg, $candidate_id;
$candidate_id += 0;
$serialized_search = stripslashes($toset_search);
//Un petit tour dans la classe search histoire de filtrer la recherche
$sc = new search(false);
$sc->unserialize_search($serialized_search);
$serialized_search = $sc->serialize_search();
$human_query = $sc->make_human_query();
print '';
}
function import_noticesearch_into_multicritere_set() {
global $dbh, $toset_search, $set_id;
$set_id+=0;
//Pas de set spécifié?
if (!$set_id)
return;
//Vérifions que le set spécifié est bien un bon set multicritère
$the_set = new connector_out_set($set_id, true);
if ($the_set->type != 2)
return;
$serialized_search = stripslashes($toset_search);
//Un petit tour dans la classe search histoire de filtrer la recherche
$sc = new search(false);
$sc->unserialize_search($serialized_search);
$serialized_search = $sc->serialize_search();
//Mettons à jour le set
$the_set_m = new connector_out_set_noticemulticritere($set_id, true);
$the_set_m->config["search"] = $serialized_search;
$the_set_m->commit_to_db();
$the_set_m->clear_cache(true);
}
if (!isset($action))
$action="";
switch ($action) {
case "add":
show_set_form(0, '', '');
break;
case "edit":
$set_type=0;
$set_caption='';
$set_config_form=NULL;
$setcache_config_form=NULL;
if ($id) {
$the_set = new_connector_out_set_typed($id);
if ($the_set->error) {
$id = 0;
}
else {
$set_type=$the_set->type;
$set_caption=$the_set->caption;
$set_config_form=array($the_set, 'get_config_form');
$setcache_config_form=array($the_set->cache, 'get_config_form');
}
}
show_set_form($id, $set_type, $set_caption, $set_config_form, $setcache_config_form);
break;
case "update":
if (update_set_from_form())
list_out_sets();
break;
case "manual_update":
$theset = new_connector_out_set_typed($id);
if ($theset->error) {
return false;
}
$theset->update_cache();
list_out_sets();
break;
case "del":
if ($id) {
$the_set = new connector_out_set($id);
$the_set->delete();
}
list_out_sets();
break;
case "import_notice_search_into_set":
show_import_noticesearch_into_multicritere_set_form();
break;
case "import_notice_search_into_set_do":
import_noticesearch_into_multicritere_set();
list_out_sets();
break;
default:
list_out_sets();
break;
}
?>