";
return $header;
}
public function getTypeOfEnrichment($notice_id,$source_id){
$type['type'] = array(
array(
'code' => "youtube",
'label' => $this->msg['youtube']
)
);
$type['source_id'] = $source_id;
return $type;
}
public function getEnrichment($notice_id,$source_id,$type="",$enrich_params=array(),$page=1){
global $lang, $charset;
$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 "youtube" :
$api = new youtube_api();
$vars ['q'] = $infos['title']." ".$infos['author'];
if($charset != 'utf-8') $vars ['q'] = utf8_encode($vars ['q']);
$result = $api->search_videos($vars);
if($result['pageInfo']['resultsPerPage'] < $result['pageInfo']['totalResults']){
$aff_result = sprintf($this->msg['youtube_partial_results'],$result['pageInfo']['resultsPerPage'],$result['pageInfo']['totalResults']);
$aff_result.= "
".$this->msg['youtube_go_to_result_page']."";
}else{
$aff_result = sprintf($this->msg['youtube_all_results'],$result['pageInfo']['totalResults']);
}
$enrichment['youtube']['content']= "
".$aff_result."
"; foreach ($result['items'] as $searchResult) { $enrichment['youtube']['content'].= " "; switch ($searchResult['id']['kind']) { case 'youtube#video': $enrichment['youtube']['content'].= sprintf('