* @copyright 2010 Tela-Botanica * @license http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL * @version SVN: * @link /doc/jrest/ */ class ImageRDF extends Cel { /** * Recherche des images associee au numero nomenclatural * @param numeric $uid [0] : numero nomenclatural obligatoire , $uid[1] (optionnel) : taille image : S , M, L (default) */ function getElement($uid){ // TODO : recherche taxon ? // Taille if (isset($uid[1])) { $taille = $uid[1]; // S , M ou L } else { $taille = 'L'; } // Recherche de toutes les observations transmises du taxon pour lesquelles une photo est associee. $requete_obs_publiques_images_taxon = 'SELECT * FROM cel_obs, cel_obs_images, cel_images '. ' WHERE cel_obs.nom_sel_nn = '.Cel::db()->proteger($uid[0]). ' AND cel_obs_images.id_observation = cel_obs.id_observation '. ' AND cel_obs.transmission = 1 '. ' AND cel_images.id_image = cel_obs_images.id_image'; $resultat_requete_obs_images_taxon = Cel::db()->requeter($requete_obs_publiques_images_taxon); $picture_path = $this->config['cel']['url_images']; // Formatage du xml $xml = ''."\n"; $xml .= ' 1) { $month = $yearMonthDay[1]; } if (count($yearMonthDay) > 2) { $day = $yearMonthDay[2]; } list($day) = explode(' ',$day); $created = $day.'/'.$month.'/'.$year; $xml .= ' dcterms:created="'.$created.'"'."\n"; } $xml .= ' dcterms:licence="CC BY-SA"/>'."\n"; } $xml .= ''."\n"; // Envoi du xml au navigateur header("Content-Type: text/xml"); echo utf8_encode(str_replace(' & ', ' & ', $xml)); } function envoyerRequete($url) { $contenu = false; $contexte = stream_context_create(array( 'http' => array( 'method' => 'GET', 'header' => "Content-type: application/x-www-form-urlencoded\r\n"))); $flux = @fopen($url, 'r', false, $contexte); $contenu = json_decode(stream_get_contents($flux)); fclose($flux); return $contenu; } } ?>