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) { global $charset; global $pmb_url_base; global $code; // $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($source_id!=0){ // $url = $pmb_url_base."admin.php?categ=connecteurs&sub=in&act=add_source&id=17&source_id=".$source_id; // }else{ // $url = $this->msg['dailymotion_no_source']; // } // // // $form="
//
//
//
//
//
//
//
//
 
//
//
// //
//
// ".$url." //
//
//
//
// //
//
"; // if($code != ""){ // $form.=" // ".$this->msg['dailymotion_ws_allow_in_progress']." // "; // }else if($code_saved!=""){ // $form.=" // ".$this->msg['dailymotion_ws_allowed']." // "; // }else if($api_key != ""){ // $form.=" // ".$this->msg['dailymotion_link_allow_ws'].""; // }else{ // $form.=" // ".$this->msg['dailymotion_allow_need_api_key'].""; // } // $form.=" //
//
//
 
"; return $form; } function make_serialized_source_properties($source_id) { // global $api_key,$secret_key,$code_saved; $t =array(); // $t["api_key"]=$api_key; // $t["secret_key"]=$secret_key; // $t["code_saved"]=$code_saved; $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() { global $accesskey, $secretkey; //Mise en forme des paramètres à partir de variables globales (mettre le résultat dans $this->parameters) $keys = array(); $this->parameters = serialize($keys); } function enrichment_is_allow(){ return true; } function getEnrichmentHeader(){ $header= array(); $header[]= ""; return $header; } function getTypeOfEnrichment($source_id){ $type['type'] = array( array( 'code' => "dailymotion", 'label' => $this->msg['dailymotion'] ) ); $type['source_id'] = $source_id; return $type; } function getEnrichment($notice_id,$source_id,$type="",$enrich_params=array(),$page=1){ global $lang; $this->noticeToEnrich= $notice_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; } } $enrichment= array(); $infos = $this->get_notice_infos(); //on renvoi ce qui est demandé... si on demande rien, on renvoi tout.. switch ($type){ case "dailymotion" : $api = new Dailymotion_api(); $vars = array( 'search' => utf8_encode($infos['title']." ".$infos['author']), 'language' => substr($lang,0,2), 'fields' => array( 'embed_html' ) ); $result = $api->call('/videos', $vars); if($result['has_more'] == 1){ $aff_result = sprintf($this->msg['dailymotion_partial_results'],$result['limit'],$result['total']); $aff_result.= "
".$this->msg['dailymotion_go_to_result_page'].""; }else{ $aff_result = sprintf($this->msg['dailymotion_all_results'],$result['total']); } $enrichment['dailymotion']['content']= "

".$aff_result."

"; foreach($result['list'] as $elem){ $enrichment['dailymotion']['content'].= "".$elem['embed_html'].""; } break; } $enrichment['source_label']=$this->msg['dailymotion_enrichment_source']; return $enrichment; } function get_notice_infos(){ $infos = array(); //on va chercher le titre de la notice... $query = "select tit1 from notices where notice_id = ".$this->noticeToEnrich; $result = mysql_query($query); if(mysql_num_rows($result)){ $infos['title'] = mysql_result($result,0,0); } //on va chercher l'auteur principal... $query = "select responsability_author from responsability where responsability_notice =".$this->noticeToEnrich." and responsability_type=0"; $result = mysql_query($query); if(mysql_num_rows($result)){ $author_id = mysql_result($result,0,0); $author = new auteur($author_id); $infos['author'] = $author->isbd_entry; } return $infos; } } ?>