get_source_params($source_id); if ($params["PARAMETERS"]) { $vars=unserialize($params["PARAMETERS"]); $params["PARAMETERS"]=$vars; } return $params; } function source_get_property_form($source_id) { global $charset; $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; } } //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; } 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) function fetch_default_global_values() { $this->timeout=40; $this->repository=1; $this->retry=3; $this->ttl=60000; $this->parameters=""; } //Formulaire des propriétés générales function get_property_form() { $this->fetch_global_properties(); return ""; } function make_serialized_properties() { $this->parameters=""; } function progress($query,$token) { $callback_progress=$this->callback_progress; if ($token["completeListSize"]) { $percent=($this->current_set/$this->total_sets)+(($token["cursor"]/$token["completeListSize"])/$this->total_sets); $nlu=$this->n_recu; $ntotal="inconnu"; //$nlu=$token["cursor"]; //$ntotal=$token["completeListSize"]; } else { $percent=($this->current_set/$this->total_sets); $nlu=$this->n_recu; $ntotal="inconnu"; } call_user_func($callback_progress,$percent,$nlu,$ntotal); } function cancel_maj($source_id) { return true; } function break_maj($source_id) { return true; } function form_pour_maj_entrepot($source_id) { return false; } //Nécessaire pour passer les valeurs obtenues dans form_pour_maj_entrepot au javascript asynchrone function get_maj_environnement($source_id) { return array(); } function sync_custom_page($source_id) { return ''; } function maj_entrepot($source_id,$callback_progress="",$recover=false,$recover_env="") { global $base_path,$charset; $this->n_recu=0; $this->callback_progress=$callback_progress; $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; } //Recherche de la dernière date... $requete="select unix_timestamp(max(date_import)) from entrepot_source_".$source_id." where 1;"; $resultat=mysql_query($requete); if (mysql_num_rows($resultat)) { $last_date=mysql_result($resultat,0,0); if ($last_date) { $last_date+=3600*24; } } $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); $html=curl_exec($ch); if (!$html) { $sortir=1; } else { // if (strtoupper($charset)!="UTF-8") $html=utf8_decode($html); $notice_list=$this->get_field_betwen_2sep($html,"

",""); $notice_list=$this->get_field_betwen_2sep($notice_list,"