get_source_params($source_id);
if ($params["PARAMETERS"]) {
$vars=unserialize($params["PARAMETERS"]);
$params["PARAMETERS"]=$vars;
}
return $params;
}
function get_libelle($message) {
if (substr($message,0,4)=="msg:") return $this->msg[substr($message,4)]; else return $message;
}
function source_get_property_form($source_id) {
$params=$this->get_source_params($source_id);
if ($params["PARAMETERS"]) {
//Affichage du formulaire avec $params["PARAMETERS"]
$vars=unserialize($params["PARAMETERS"]);
foreach ($vars as $key=>$val) {
global $$key;
$$key=$val;
}
}
$form ="
";
return $form;
}
function make_serialized_source_properties($source_id) {
global $libelle,$infobulle,$source_name;
global $cp_field;
global $width,$height;
$t=array();
$t['libelle'] = $libelle;
$t['infobulle'] = $infobulle;
$t['source_name'] = $source_name;
$t['cp_field'] = $cp_field;
$t['width'] = $width;
$t['height'] = $height;
$this->sources[$source_id]["PARAMETERS"]=serialize($t);
}
//Récupération des proriétés globales par défaut du connecteur (timeout, retry, repository, parameters)
function fetch_default_global_values() {
$this->timeout=5;
$this->repository=2;
$this->retry=3;
$this->ttl=1800;
$this->parameters="";
}
//Formulaire des propriétés générales
function get_property_form() {
return "";
}
function make_serialized_properties() {
$this->parameters = serialize(array());
}
function enrichment_is_allow(){
return true;
}
function getEnrichmentHeader($source_id){
$params=$this->get_source_params($source_id);
if ($params["PARAMETERS"]) {
//Affichage du formulaire avec $params["PARAMETERS"]
$vars=unserialize($params["PARAMETERS"]);
foreach ($vars as $key=>$val) {
global $$key;
$$key=$val;
}
}
$header= array();
$header[] ="
";
return $header;
}
function getTypeOfEnrichment($notice_id,$source_id){
$params=$this->get_source_params($source_id);
if ($params["PARAMETERS"]) {
//Affichage du formulaire avec $params["PARAMETERS"]
$vars=unserialize($params["PARAMETERS"]);
foreach ($vars as $key=>$val) {
global $$key;
$$key=$val;
}
}
$query = "select 1 from notices_custom_values where notices_custom_champ = ".$cp_field." and notices_custom_origine = ".$notice_id;
$result = mysql_query($query);
if(mysql_num_rows($result)){
$type['type'] = array(
array(
'code' => str_replace(array(" ","%","-","?","!",";",",",":"),"",strip_empty_chars(strtolower($libelle))),
'label' => $libelle,
'infobulle' => $infobulle
)
);
$type['source_id'] = $source_id;
}
return $type;
}
function getEnrichment($notice_id,$source_id,$type="",$enrich_params=array()){
$params=$this->get_source_params($source_id);
if ($params["PARAMETERS"]) {
//Affichage du formulaire avec $params["PARAMETERS"]
$vars=unserialize($params["PARAMETERS"]);
foreach ($vars as $key=>$val) {
global $$key;
$$key=$val;
}
}
$enrichment= array();
//on renvoi ce qui est demandé... si on demande rien, on renvoi tout..
switch ($type){
case str_replace(array(" ","%","-","?","!",";",",",":"),"",strip_empty_chars(strtolower($libelle))) :
default :
$enrichment[str_replace(array(" ","%","-","?","!",";",",",":"),"",strip_empty_chars(strtolower($libelle)))]['content'] = $this->urlsInfos($notice_id,$source_id);
break;
}
$enrichment['source_label']= sprintf($this->msg['urlslist_enrichment_source'],$source_name);
return $enrichment;
}
function urlsInfos($notice_id,$source_id){
$params=$this->get_source_params($source_id);
if ($params["PARAMETERS"]) {
//Affichage du formulaire avec $params["PARAMETERS"]
$vars=unserialize($params["PARAMETERS"]);
foreach ($vars as $key=>$val) {
global $$key;
$$key=$val;
}
}
if($cp_field){
$query = "select datatype from notices_custom where idchamp = ".$cp_field;
$datatype = mysql_result(mysql_query($query),0,0);
$query = "select notices_custom_".$datatype." from notices_custom_values where notices_custom_champ = ".$cp_field." and notices_custom_origine= ".$notice_id;
//return $query;
$result = mysql_query($query);
if(mysql_num_rows($result)){
$html_to_return = "
";
$i=0;
while($row = mysql_fetch_row($result)){
$tab = explode("|",$row[0]);
$html_to_return.= "
".$tab[1]."
|
";
$i++;
}
$html_to_return.= "
";
}else{
$html_to_return.= $this->msg['urlslist_no_informations'];
}
}else{
$html_to_return = $this->msg['urlslist_no_informations'];
}
return $html_to_return;
}
}
?>