";
}
$display .= "
";
print $display;
}
/*
* Création/Modification
*/
function save(){
global $dbh, $libelle;
if(!$this->id_source){
$req = "insert into suggestions_source set libelle_source='".$libelle."'";
} else {
$req="update suggestions_source set libelle_source='".$libelle."' where id_source='".$this->id_source."'";
}
mysql_query($req,$dbh);
}
//Suppression d'une source
function delete(){
global $dbh,$msg;
$error = false;
if($this->hasSuggestions()){
error_message($msg[321],$msg['acquisition_sugg_source_used'],1, 'admin.php?categ=acquisition&sub=src');
$error=true;
} else {
$req="delete from suggestions_source where id_source='".$this->id_source."'";
mysql_query($req,$dbh);
}
return $error;
}
//Vérifie si la source de suggestions est utilisee dans les suggestions
function hasSuggestions(){
global $dbh;
$q = "select count(1) from suggestions where sugg_source = '".$this->id_source."' ";
$r = mysql_query($q, $dbh);
return mysql_result($r, 0, 0);
}
}
?>