config=$config; } function getElement($uid){ // Num nomenclatural $DB=$this->connectDB($this->config); $query = "SELECT DISTINCT b.esn_id_taxon FROM eflore_nom, eflore_nom_rang," . " eflore_selection_nom a, eflore_selection_nom b". " WHERE a.esn_id_nom= ".$uid[0]. " AND a.esn_id_version_projet_taxon = 25 ". " AND a.esn_id_taxon=b.esn_id_taxon ". " AND b.esn_ce_statut=3 ". " AND a.esn_id_version_projet_taxon=b.esn_id_version_projet_taxon" . " AND en_ce_rang = enrg_id_rang" . " AND en_id_nom = b.esn_id_nom" . " AND a.esn_id_version_projet_taxon=en_id_version_projet_nom "; $res =& $DB->query($query); if (DB::isError($res)) { die($res->getMessage()); } while ($row =& $res->fetchrow(DB_FETCHMODE_ASSOC)) { $nt=$row['esn_id_taxon']; } $projet_photo = 'photoflora'; $tab_retour[$projet_photo]=chercherIllustrationsServiceXml(sprintf(EF_URL_PHOTOFLORA_SERVICE, $nt)); $value=array('null','null'); foreach ($tab_retour[$projet_photo] as $cle => $illustration) { if (preg_match(EF_URL_PHOTOFLORA_REGEXP_01, $illustration['about'], $match)) { $abreviation = $match[1]; $fichier = $match[2]; } else { if (preg_match(EF_URL_PHOTOFLORA_REGEXP_02, $illustration['about'], $match)) { $abreviation = $match[1]; $fichier = $match[2]; } } if (isset($abreviation)) { $url_miniature = sprintf(EF_URL_PHOTOFLORA_IMG_MIN, $abreviation, $fichier);; $url_max = $illustration['about']; $value=array($url_miniature,$url_max); // Priorite aux images en png if (strstr($fichier, '.png')) { break; } } } $output = json_encode($value); print($output); } } function chercherIllustrationsServiceXml($url) { return analyserFichierRdf($url); } function analyserFichierRdf($chemin) { $aso_info = array(); $dom = new DOMDocument(); $dom->validateOnParse = true; if (preg_match('/^http:\/\//', $chemin)) { @$dom->loadXML(file_get_contents($chemin)); } else { @$dom->load($chemin); } $tab_infos = array(); foreach ($dom->getElementsByTagNameNS('http://www.w3.org/1999/02/22-rdf-syntax-ns#', 'Description') as $rdf_description) { $aso_info['about'] = $rdf_description->getAttribute('about'); $aso_info['dc:identifier'] = $rdf_description->getAttribute('identifier'); $aso_info['dc:title'] = utf8_decode($rdf_description->getAttribute('title')); $aso_info['dc:creator'] = utf8_decode($rdf_description->getAttribute('creator')); $aso_info['dc:contributor'] = utf8_decode($rdf_description->getAttribute('contributor')); $aso_info['dc:publisher'] = utf8_decode($rdf_description->getAttribute('publisher')); $aso_info['dc:type'] = utf8_decode($rdf_description->getAttribute('type')); $aso_info['dc:format'] = utf8_decode($rdf_description->getAttribute('format')); if (function_exists('date_default_timezone_set')) { date_default_timezone_set('Europe/Paris'); } if (preg_match('/^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}$/', $rdf_description->getAttribute('created'))) { $aso_info['dcterms:created'] = date('j-m-Y � H:i:s', strtotime($rdf_description->getAttribute('created'))); } else { $aso_info['dcterms:created'] = $rdf_description->getAttribute('created'); } $aso_info['dcterms:dateSubmitted'] = utf8_decode($rdf_description->getAttribute('dateSubmitted')); $aso_info['dcterms:spatial'] = utf8_decode($rdf_description->getAttribute('spatial')); $aso_info['dcterms:licence'] = utf8_decode($rdf_description->getAttribute('licence')); $tab_infos[$rdf_description->getAttribute('identifier')] = $aso_info; } return $tab_infos; } /* +--Fin du code ---------------------------------------------------------------------------------------+ * $Log$ * Revision 1.4 2008-11-13 11:29:12 ddelon * Reecriture gwt-ext * * Revision 1.2 2008-01-30 08:57:28 ddelon * fin mise en place mygwt * * Revision 1.1 2007-06-06 13:31:16 ddelon * v0.09 * * * * */ ?>