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;
}
}
//URL
if (!isset($url))
$url = "http://travail-emploi.gouv.fr/etudes-recherche-statistiques-de,76/etudes-et-recherche,77/publications-dares,98/dares-analyses-dares-indicateurs,102";
$form="
";
return $form;
}
public function make_serialized_source_properties($source_id) {
global $url;
$t = array();
$t["url"]=stripslashes($url);
$this->sources[$source_id]["PARAMETERS"]=serialize($t);
}
//Récupération des proriétés globales par défaut du connecteur (timeout, retry, repository, parameters)
public function fetch_default_global_values() {
parent::fetch_default_global_values();
$this->timeout=40;
$this->repository=1;
$this->ttl=60000;
}
public function cancel_maj($source_id) {
return true;
}
public function break_maj($source_id) {
return true;
}
public function parse_xml($ch,$data) {
$notices=explode("6",$data);
print $notices[1];
return strlen($data);
}
public function search($source_id,$query,$search_id) {
global $base_path,$charset;
$params=$this->get_source_params($source_id);
$this->fetch_global_properties();
if ($params["PARAMETERS"]) {
//Affichage du formulaire avec $params["PARAMETERS"]
$vars=unserialize($params["PARAMETERS"]);
foreach ($vars as $key=>$val) {
global ${$key};
${$key}=$val;
}
}
if (!isset($url)) {
$this->error_message = $this->msg["emploi_unconfigured"];
$this->error = 1;
return;
}
$boolsearch="";
foreach ($query as $element) {
if($boolsearch)$boolsearch.=" ";
$boolsearch.= implode(" ", $element->values);
}
$boolsearch=str_replace(" ", "+", $boolsearch);
//$addr=$url."/search?value21=true&value22=true&discontin=factbooks&value1=".rawurlencode($boolsearch)."&option1=titleAbstract&option18=sort&site=fr&form_name=quick&option21=discontinued&option22=excludeKeyTableEditions&option19=content_type&value19=books";
$ch = curl_init();
//$addr="http://travail-emploi.gouv.fr/etudes-recherche-statistiques-de,76/etudes-et-recherche,77/publications-dares,98/dares-analyses-dares-indicateurs,102/";
$addr=$url;
// configuration des options CURL
curl_setopt($ch, CURLOPT_URL, $addr);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
configurer_proxy_curl($ch,$addr);
$html=curl_exec($ch);
if (!$html) {
$sortir=1;
} else {
if ($charset=="utf-8") $html=utf8_encode($html);
// if (strtoupper($charset)!="UTF-8") $html=utf8_decode($html);
$notice_list=$this->get_field_betwen_2sep($html,"