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;
}
public function enrichment_is_allow(){
return true;
}
public function getEnrichmentHeader(){
$header= array();
$header[]= "";
return $header;
}
public function getTypeOfEnrichment($source_id){
$type['type'] = array(
array(
'code' => "dailymotion",
'label' => $this->msg['dailymotion']
)
);
$type['source_id'] = $source_id;
return $type;
}
public 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;
}
public 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 = pmb_mysql_query($query);
if(pmb_mysql_num_rows($result)){
$infos['title'] = pmb_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 = pmb_mysql_query($query);
if(pmb_mysql_num_rows($result)){
$author_id = pmb_mysql_result($result,0,0);
$author = new auteur($author_id);
$infos['author'] = $author->get_isbd();
}
return $infos;
}
}
?>