/trunk/modules/resultat/ParametresResultats.php |
---|
New file |
0,0 → 1,11 |
<?php |
class ParametresResultats { |
public $typeResultat = 'determination'; |
public $typeNom = ''; |
public $masqueRecherche = ''; |
public $reftaxCourant = 'bdtfx'; |
public $projetImg = 'cel'; |
/** Si "null", montre tous les résultats. Sinon, ne montre que le rang spécifié, par défaut les espèces (290). */ |
public $rang = null; |
} |
?> |
/trunk/modules/resultat/formateurs/nom_vernaculaire/DeterminationVernaFormateur.php |
---|
New file |
0,0 → 1,229 |
<?php |
class DeterminationVernaFormateur implements Formateur { |
const TPL_VUE = 'determination_verna'; |
private $parametres = null; |
private $surligneur = null; |
private $trieur = null; |
private $urls = null; |
private $fusioneur = null; |
private $manipulateurDeChaine = null; |
private $imagesService = null; |
private $motsASurligner = array(); |
private $noms = array(); |
private $infosPourTpl = array(); |
private $conteneur = null; |
private $apiCartes = null; |
public function __construct(ParametresResultats $parametres, Array $resultats, |
Surligneur $surligneur = null, Trieur $trieur = null, AppUrls $urls = null, |
ChaineManipulateur $manipulateurDeChaine = null, Images $imagesService = null) { |
$this->parametres = $parametres; |
$this->noms = $resultats['resultat']; |
$this->surligneur = (is_null($surligneur)) ? new Surligneur() : $surligneur; |
$this->trieur = (is_null($trieur)) ? new Trieur() : $trieur; |
$this->urls = (is_null($urls)) ? new AppUrls() : $urls; |
$this->manipulateurDeChaine = is_null($manipulateurDeChaine) ? new ChaineManipulateur() : $manipulateurDeChaine; |
$this->imagesService = is_null($imagesService) ? new Images($this->parametres->projetImg) : $imagesService; |
$this->conteneur = new Conteneur(); |
$this->apiCartes = $this->conteneur->getApiCartes(); |
} |
public function getTplInfos() { |
return $this->infosPourTpl; |
} |
public function getTplNom() { |
return self::TPL_VUE; |
} |
public function formater() { |
$this->obtenirUrlsDessins(); |
$this->obtenirUrlsPhotos(); |
$this->chargerRepartition(); |
$this->extraireInfosNomsPourTplDetermination(); |
$this->infosPourTpl['urlWidget'] = Config::get('base_url_widget_saisie')."?referentiel=".Registre::get('parametres.referentiel'); |
} |
private function obtenirUrlsDessins() { |
if (Config::get(Registre::get('parametres.referentiel').'.baseDessins') != "") { |
$this->extraireInfosTaxons(); |
$this->imagesService->setProjet(Config::get(Registre::get('parametres.referentiel').'.baseDessins')); |
$tax = implode(',', $this->infosPourTpl['taxons']); |
$this->imagesService->setNnTaxon($tax); |
$costeImg = $this->imagesService->setApi(Eflore::API_EFLORE)->getInfosImagesTaxons(); |
if (!empty($costeImg)) { |
foreach ($costeImg as $infos) { |
$num_taxon = $infos['num_taxonomique']; |
$images[$num_taxon][] = $infos['binaire.href']; |
$this->infosPourTpl['imagesCoste'] = $images; |
} |
} |
} |
} |
private function extraireInfosTaxons() { |
foreach ($this->noms as $id => $nom ) { |
if (array_key_exists('num_taxon', $nom) |
&& array_key_exists('taxon', $nom)) { |
$this->infosPourTpl['taxons'][$nom['taxon']] = $nom['num_taxon']; |
} |
} |
} |
private function obtenirUrlsPhotos() { |
if (Config::get(Registre::get('parametres.referentiel').'.baseImages') != "") { |
$this->imagesService->setProjet(Config::get(Registre::get('parametres.referentiel').'.baseImages')); |
$nns = $this->extraireNnDesNoms(); |
$urls = $this->imagesService->setApi(Eflore::API_EFLORE)->getUrlsImagesParIdsNoms($nns); |
$this->infosPourTpl['imagesUrls'] = $this->supprimerCodeReferentielDesUrls($urls); |
} |
} |
private function extraireNnDesNoms() { |
$nns = array(); |
foreach ($this->noms as $id => $nom) { |
if (array_key_exists('nom_retenu.code', $nom)) { |
if (in_array($nom['nom_retenu.code'], $nns) == false) { |
$idAAjouter = $this->supprimerCodeReferentielAvecNn($nom['nom_retenu.code']); |
if (is_numeric($idAAjouter)) { |
$nns[] = $idAAjouter; |
} |
} |
} |
} |
return $nns; |
} |
private function supprimerCodeReferentielDesUrls($urls) { |
$urlsNettoyees = array(); |
foreach ($urls as $id => $url) { |
$id = $this->supprimerCodeReferentiel($id); |
$urlsNettoyees[$id] = $url; |
} |
return $urlsNettoyees; |
} |
private function supprimerCodeReferentiel($chaine) { |
$codeReferentiel = $this->parametres->referentielCourant.'.'; |
$chaine = str_replace($codeReferentiel, '', $chaine); |
return $chaine; |
} |
private function chargerRepartition() { |
// $numsNomsASynonymes = $this->extraireNumerosNomSynonymes(); |
if (Config::get(Registre::get('parametres.referentiel').'.baseRepartition') == "") { |
return; |
} |
$this->apiCartes->setProjet(Config::get(Registre::get('parametres.referentiel').'.baseRepartition')); |
$this->apiCartes->setLargeur('108x101'); |
$urls = array(); |
foreach ($this->noms as $nom) { |
if (array_key_exists('nom_retenu.code', $nom)) { |
$id = $this->supprimerCodeReferentielAvecNn($nom['nom_retenu.code']); |
$this->apiCartes->setId("nn:" . $id); // . ',' . implode(',', array_keys($numsNomsASynonymes[$id]))); |
if (array_key_exists($id, $urls) == false) { |
$urls[$id] = $this->apiCartes->getUrlPng(); |
} |
} |
} |
$this->infosPourTpl['repartition']['urls'] = $urls; |
} |
private function extraireNumerosNomSynonymes() { |
$numNomsASynonyme = array(); |
foreach ($this->noms as $id => $nom) { |
$num_nom_retenu = $this->supprimerCodeReferentielAvecNn($nom['nom_retenu.code']); |
// faux |
$numNomsASynonyme[$num_nom_retenu][$id] = TRUE; |
} |
return $numNomsASynonyme; |
} |
private function extraireInfosNomsPourTplDetermination() { |
$taxons = array(); |
foreach ($this->noms as $idNomCourant => $nom) { |
$nn = intval($this->supprimerCodeReferentielAvecNn($nom['nom_retenu.code'])); |
$nomV = iconv('UTF-8', 'ASCII//TRANSLIT', strtolower($nom['nom_vernaculaire'])); |
if (preg_match('/^'.strtolower($this->parametres->masqueRecherche).'(?: |$)/', $nomV)) { |
// au moins un debute par la requête |
if (isset($taxons) && array_key_exists($nn, $taxons[0]) == false) { |
$taxons[0][$nn] = $this->renvoyerInfosTaxon($nom['taxon'], $nn); |
} |
$taxons[0][$nn]['nomVerna'][] = $this->renvoyerInfosNomVerna($nom); |
} else { |
// contient |
if (isset($taxons) && (!isset($taxons[1]) || array_key_exists($nn, $taxons[1]) == false)) { |
$taxons[1][$nn] = $this->renvoyerInfosTaxon($nom['taxon'], $nn); |
} |
$taxons[1][$nn]['nomVerna'][] = $this->renvoyerInfosNomVerna($nom); |
} |
} |
$this->infosPourTpl['noms'] = isset($taxons) ? $taxons : false; |
} |
private function renvoyerInfosNomVerna($valeurs) { |
$nom_verna = array(); |
$nom_verna['nn'] = $valeurs['id']; |
$nom_verna['nom_vernaculaire'] = $valeurs['nom_vernaculaire']; |
return $nom_verna; |
} |
private function renvoyerInfosTaxon($nomSci, $nn) { |
$taxon = array(); |
$taxon['nomSci'] = $nomSci; |
$taxon['urlFiche'] = $this->urls->obtenirUrlFiche($nn, $this->parametres->typeNom, $this->parametres->masqueRecherche); |
$this->chargerRepartition($nn); |
$taxon['repartition_vignette'] = $this->infosPourTpl['repartition']['urls']; |
return $taxon; |
} |
private function supprimerCodeReferentielAvecNn($nn) { |
return str_replace($this->parametres->referentielCourant.'.nn:', '', $nn); |
} |
//tri alphabétique des noms scientifiques par catégorie (débute par , contient ) |
public function trier() { |
$verna = array(); |
foreach ($this->infosPourTpl['noms'] as $categorie => $valeurs) { |
$verna += $this->classerAlphabetiquement('nomSci', $valeurs); |
} |
$this->infosPourTpl['noms'] = $verna; |
} |
private function classerAlphabetiquement($champs, $valeurs) { |
$this->trieur->setTableau($valeurs); |
$this->trieur->setChampsEtOrdres(array($champs => 'nat')); |
return $this->trieur->trier(); |
} |
public function surligner() { |
$this->definirMotsASurligner(); |
foreach ($this->infosPourTpl['noms'] as $idNom => $nom) { |
foreach ($nom['nomVerna'] as $idVerna => $nomVerna) { |
$nom['nomVerna'][$idVerna]['nom_vernaculaire'] = $this->surlignerMotsMasqueRecherche($nomVerna['nom_vernaculaire']); |
} |
$this->infosPourTpl['noms'][$idNom] = $nom; |
} |
} |
private function definirMotsASurligner() { |
$this->motsASurligner = explode(' ', $this->parametres->masqueRecherche); |
} |
private function surlignerMotsMasqueRecherche($nom) { |
$this->surligneur->setTexte($nom); |
$nom = $this->surligneur->surlignerMots($this->motsASurligner); |
return $nom; |
} |
} |
?> |
/trunk/modules/resultat/formateurs/nom_vernaculaire/AlphabVernaFormateur.php |
---|
New file |
0,0 → 1,113 |
<?php |
class AlphabVernaFormateur implements Formateur { |
const TPL_VUE = 'liste_noms_verna'; |
private $parametres = null; |
private $surligneur = null; |
private $trieur = null; |
private $urls = null; |
private $fusioneur = null; |
private $manipulateurDeChaine = null; |
private $imagesService = null; |
private $motsASurligner = array(); |
private $noms = array(); |
private $infosPourTpl = array(); |
public function __construct(ParametresResultats $parametres, Array $resultats, |
Surligneur $surligneur = null, Trieur $trieur = null, AppUrls $urls = null, |
ChaineManipulateur $manipulateurDeChaine = null, Images $imagesService = null) { |
$this->parametres = $parametres; |
$this->noms = $resultats['resultat']; |
$this->surligneur = (is_null($surligneur)) ? new Surligneur() : $surligneur; |
$this->trieur = (is_null($trieur)) ? new Trieur() : $trieur; |
$this->urls = (is_null($urls)) ? new AppUrls() : $urls; |
$this->manipulateurDeChaine = is_null($manipulateurDeChaine) ? new ChaineManipulateur() : $manipulateurDeChaine; |
$this->imagesService = is_null($imagesService) ? new Images($this->parametres->projetImg) : $imagesService; |
} |
public function getTplInfos() { |
return $this->infosPourTpl; |
} |
public function getTplNom() { |
return self::TPL_VUE; |
} |
private function supprimerCodeReftaxAvecNn($nn) { |
$codeReftax = Registre::get('parametres.referentiel').'.nn:'; |
return str_replace($codeReftax, '', $nn); |
} |
private function renvoyerInfoVerna($nn, $valeurs) { |
$infosDuNom = array(); |
$infosDuNom['nomSci'] = $valeurs['taxon']; |
$infosDuNom['nomVerna'] = $valeurs['nom_vernaculaire']; |
$infosDuNom['langue'] = $valeurs['code_langue']; |
$infosDuNom['urlFiche'] = $this->urls->obtenirUrlFiche($nn, $this->parametres->typeNom, $this->parametres->masqueRecherche); |
return $infosDuNom ; |
} |
function supprimerAccents($chaine){ |
return strtr($chaine,array('à' => 'a','á' => 'a','â' => 'a','ã' => 'a','ä' => 'a', |
'ç' => 'c', |
'è' => 'e','é' => 'e','ê' => 'e','ë' => 'e', |
'ì' => 'i','í' => 'i','î' => 'i','ï' => 'i', |
'ñ' => 'n', |
'ò' => 'o', 'ó' => 'o' , 'ô' => 'o', 'õ' => 'o', 'ö' => 'o', |
'ù' => 'u', 'ú' => 'u', 'û' => 'u', 'ü' => 'u', |
'ý' => 'y', 'ÿ' => 'y')); |
} |
public function formater() { |
$nomVerna = array(); |
foreach ($this->noms as $id => $nom) { |
$nn = $this->supprimerCodeReftaxAvecNn($nom['nom_retenu.code']); |
$nom_min = strtolower($nom['nom_vernaculaire']); |
$nom_ss_accent = $this->supprimerAccents($nom_min); |
if (preg_match('/^'.strtolower($this->parametres->masqueRecherche).' |^'.strtolower($this->parametres->masqueRecherche).'$/', $nom_ss_accent)) { |
$nomVerna[0][$id] = $this->renvoyerInfoVerna($nn, $nom); |
} else { |
$nomVerna[1][$id] = $this->renvoyerInfoVerna($nn, $nom); |
} |
} |
ksort($nomVerna); |
$this->infosPourTpl['noms'] = isset($nomVerna) ? $nomVerna : false; |
} |
public function trier() { |
$verna = array(); |
foreach ($this->infosPourTpl['noms'] as $categorie => $valeurs) { |
$verna += $this->classerAlphabetiquement('nomVerna', $valeurs); |
} |
$this->infosPourTpl['noms'] = $verna; |
} |
private function classerAlphabetiquement($champs, $valeurs) { |
$this->trieur->setTableau($valeurs); |
$this->trieur->setChampsEtOrdres(array($champs => 'nat')); |
return $this->trieur->trier(); |
} |
public function surligner() { |
$this->definirMotsASurligner(); |
foreach ($this->infosPourTpl['noms'] as $idNom => $nom) { |
$this->infosPourTpl['noms'][$idNom]['nomVerna'] = $this->surlignerMotsMasqueRecherche($nom['nomVerna']); |
} |
} |
private function definirMotsASurligner() { |
$this->motsASurligner = explode(' ', $this->parametres->masqueRecherche); |
} |
private function surlignerMotsMasqueRecherche($nom) { |
$this->surligneur->setTexte($nom); |
$nom = $this->surligneur->surlignerMots($this->motsASurligner); |
return $nom; |
} |
} |
?> |
/trunk/modules/resultat/formateurs/Formateur.php |
---|
New file |
0,0 → 1,10 |
<?php |
interface Formateur { |
public function __construct(ParametresResultats $parametres, Array $resultats, Surligneur $surligneur = null, Trieur $trieur = null, AppUrls $urls = null); |
public function getTplInfos(); |
public function getTplNom(); |
public function formater(); |
public function trier(); |
public function surligner(); |
} |
?> |
/trunk/modules/resultat/formateurs/ResultatFormateurFabrique.php |
---|
New file |
0,0 → 1,16 |
<?php |
class ResultatFormateurFabrique { |
public static function creer(ParametresResultats $parametres, Array $resultats){ |
$typeResultat = ucwords($parametres->typeResultat); |
$typeNom = ($parametres->typeNom == 'nom_vernaculaire') ? 'Verna' : ''; |
$Classe = $typeResultat.$typeNom.'Formateur'; |
$ResultatFormateur = null; |
if (class_exists($Classe)) { |
return new $Classe($parametres, $resultats); |
} else { |
throw new Exception("La classe '$Classe' est introuvable."); |
} |
} |
} |
?> |
/trunk/modules/resultat/formateurs/nom_scientifique/DeterminationFormateur.php |
---|
New file |
0,0 → 1,258 |
<?php |
class DeterminationFormateur implements Formateur { |
const TPL_VUE = 'determination'; |
private $parametres = null; |
private $surligneur = null; |
private $trieur = null; |
private $urls = null; |
private $fusioneur = null; |
private $manipulateurDeChaine = null; |
private $imagesService = null; |
private $motsASurligner = array(); |
private $noms = array(); |
private $infosPourTpl = array(); |
public function __construct(ParametresResultats $parametres, Array $resultats, |
Surligneur $surligneur = null, Trieur $trieur = null, AppUrls $urls = null, |
ChaineManipulateur $manipulateurDeChaine = null, Images $imagesService = null) { |
$this->parametres = $parametres; |
$this->noms = $resultats['resultat']; |
$this->surligneur = (is_null($surligneur)) ? new Surligneur() : $surligneur; |
$this->trieur = (is_null($trieur)) ? new Trieur() : $trieur; |
$this->urls = (is_null($urls)) ? new AppUrls() : $urls; |
$this->manipulateurDeChaine = is_null($manipulateurDeChaine) ? new ChaineManipulateur() : $manipulateurDeChaine; |
$this->imagesService = is_null($imagesService) ? new Images($this->parametres->projetImg) : $imagesService; |
} |
public function getTplInfos() { |
return $this->infosPourTpl; |
} |
public function getTplNom() { |
return self::TPL_VUE; |
} |
public function formater() { |
$this->extraireInfosTaxons(); |
$this->obtenirUrlsDessins(); |
$this->obtenirUrlsPhotos(); |
$this->chargerRepartition(); |
$this->extraireInfosNomsPourTplDetermination(); |
$this->infosPourTpl['urlWidget'] = Config::get('base_url_widget_saisie')."?referentiel=".Registre::get('parametres.referentiel'); |
} |
private function obtenirUrlsDessins() { |
if (Config::get(Registre::get('parametres.referentiel').'.baseDessins') != "") { |
$this->imagesService->setProjet(Config::get(Registre::get('parametres.referentiel').'.baseDessins')); |
$tax = implode(',', $this->infosPourTpl['taxons']); |
$this->imagesService->setNnTaxon($tax); |
$costeImg = $this->imagesService->setApi(Eflore::API_EFLORE)->getInfosImagesTaxons(); |
if (!empty($costeImg)) { |
foreach ($costeImg as $infos) { |
$num_taxon = $infos['num_taxonomique']; |
$images[$num_taxon][] = $infos['binaire.href']; |
$this->infosPourTpl['dessins'] = $images; |
} |
} |
} |
} |
private function extraireInfosTaxons() { |
foreach ($this->noms as $id => $nom ) { |
if (array_key_exists('num_taxonomique', $nom)) { |
$this->infosPourTpl['taxons'][$id] = $nom['num_taxonomique']; |
} |
} |
} |
private function obtenirUrlsPhotos() { |
if (Config::get(Registre::get('parametres.referentiel').'.baseImages') != "") { |
$this->imagesService->setProjet(Config::get(Registre::get('parametres.referentiel').'.baseImages')); |
$ids = $this->extraireIdDesNoms(); |
$urls = $this->imagesService->setApi(Eflore::API_EFLORE)->getUrlsImagesParIdsNoms($ids); |
$this->infosPourTpl['imagesUrls'] = $this->supprimerCodeReferentielDesIds($urls); |
} |
} |
private function extraireIdDesNoms() { |
$ids = array(); |
foreach ($this->noms as $id => $nom) { |
$idAAjouter = $id; |
if (is_numeric($idAAjouter)) { |
$ids[] = $idAAjouter; |
} |
if (array_key_exists('nom_retenu.id', $nom)) { |
if (in_array($nom['nom_retenu.id'], $ids) == false) { |
$idAAjouter = $nom['nom_retenu.id']; |
if (is_numeric($idAAjouter)) { |
$ids[] = $idAAjouter; |
} |
} |
} |
} |
return $ids; |
} |
private function supprimerCodeReferentielDesIds($urls) { |
$urlsNettoyees = array(); |
foreach ($urls as $id => $url) { |
$id = $this->supprimerCodeReferentiel($id); |
$urlsNettoyees[$id] = $url; |
} |
return $urlsNettoyees; |
} |
private function supprimerCodeReferentiel($chaine) { |
$codeReferentiel = Registre::get('parametres.referentiel').'.'; |
$chaine = str_replace($codeReferentiel, '', $chaine); |
return $chaine; |
} |
// TODO : utiliser le conteneur pour charger tous les objets de cette classe |
private function chargerRepartition() { |
$referentiel = Registre::get('parametres.referentiel'); |
if (Config::get("$referentiel.baseRepartition") != '') { |
$conteneur = new Conteneur(); |
$cartesWs = $conteneur->getApiCartes(); |
$cartesWs->setProjet(Config::get(Registre::get('parametres.referentiel').'.baseRepartition')); |
$cartesWs->setLargeur('108x101'); |
$urls = array(); |
foreach ($this->noms as $id => $nom) { |
if (array_key_exists('num_taxonomique', $nom)) { |
$nt = $nom['num_taxonomique']; |
$cartesWs->setId("$referentiel.nt:$nt"); |
if (array_key_exists($id, $urls) == false) { |
$urls[$id] = $cartesWs->getUrlPng(); |
} |
} |
} |
$this->infosPourTpl['repartition']['urls'] = $urls; |
} |
} |
private function extraireInfosNomsPourTplDetermination() { |
$tri = $this->diviserResultats(); |
$this->infosPourTpl['nomsSansCorrespondance'] = isset($tri['sansCorres']) ? $tri['sansCorres'] : false; |
$this->infosPourTpl['noms'] = isset($tri['retenus']) ? $tri['retenus'] : false; |
$this->infosPourTpl['synonymes'] = isset($tri['synonymes'] ) ? $tri['synonymes'] : false; |
} |
/** |
* division ordonnée par |
* 1 - noms retenus qui commencent par la requete |
* 2 - requete contenue dans un synonyme dont le nom retenu ne contient pas la requete |
* 3 - requete contenue dans un hybride retenu |
* 4 - requete contenue dans un nom retenu mais pas au début |
* 5 - requete contenue dans un nom sans correspondance |
* |
*/ |
private function diviserResultats() { |
$tri = array(); |
$sansCorres = array(); |
$synonymes = array(); |
$retenus = array(); |
foreach ($this->noms as $cle => $valeurs) { |
if ($valeurs['nom_retenu.libelle'] == null) {//sans correspondances |
$sansCorres[$cle] = $valeurs['nom_sci_complet']; |
} elseif ($valeurs['retenu'] == 'true') { // retenus |
if (preg_match('/ x |^x /',$valeurs['nom_sci'] ) ) { |
//hybrides |
$retenus[2][$cle] = $this->retournerInfosNomRetenu($cle,$valeurs['nom_sci_complet'], $valeurs['rang.libelle']); |
} elseif (strripos($valeurs['nom_sci_complet'], $this->parametres->masqueRecherche) === 0) {//preg_match('/^'.strtolower($this->parametres->masqueRecherche).' |^'.strtolower($this->parametres->masqueRecherche).'$/', strtolower($valeurs['nom_sci']) ) ) { |
//commence par |
$retenus[0][$cle] = $this->retournerInfosNomRetenu($cle,$valeurs['nom_sci_complet'], $valeurs['rang.libelle']); |
} else { |
//contient |
$retenus[3][$cle] = $this->retournerInfosNomRetenu($cle,$valeurs['nom_sci_complet'], $valeurs['rang.libelle']); |
} |
} else {//synonymes |
$idNomRetenu = $valeurs['nom_retenu.id']; |
if (in_array($valeurs['nom_retenu.id'], array_keys($this->noms)) == false) { |
//synonymes dont le nom retenu n'est pas un résultat de recherche |
$retenus[1][$idNomRetenu] = $this->retournerInfosNomRetenu($idNomRetenu,$valeurs['nom_retenu.libelle'], $valeurs['rang.libelle']); |
$this->infosPourTpl['taxons'][$idNomRetenu] = $valeurs['num_taxonomique']; //num taxon pour images coste |
} |
$synonymes[$idNomRetenu][] = $this->retournerInfosSynonyme($cle, $valeurs); |
} |
} |
ksort($retenus); |
$tri['retenus'] = $retenus; |
$tri['synonymes'] = $synonymes; |
$tri['sansCorres'] = $sansCorres; |
return $tri; |
} |
private function retournerInfosNomRetenu($cle, $nom_sci, $rang) { |
$infos = array(); |
$infos['nomSciRetenu'] = $nom_sci; |
$infos['urlFiche'] = $this->urls->obtenirUrlFiche($cle, $this->parametres->typeNom, strtolower($this->parametres->masqueRecherche), $nom_sci); |
$infos['rang'] = $rang; |
return $infos; |
} |
private function retournerInfosSynonyme($cle, $valeurs) { |
$infos = array(); |
$infos['nn'] = $cle; |
$infos['nomSci'] = $valeurs['nom_sci_complet']; |
$infos['urlFiche'] = $this->urls->obtenirUrlFiche($cle, $this->parametres->typeNom, $this->parametres->masqueRecherche, $valeurs['nom_retenu.libelle']); |
return $infos; |
} |
public function trier() { |
$nomsRetenus = array(); |
foreach ($this->infosPourTpl['noms'] as $categorie => $valeurs ) { //classement alpha par groupes |
$nomsRetenus += $this->classerAlphabetiquement('nomSciRetenu', $valeurs); |
} |
$this->infosPourTpl['noms'] = $nomsRetenus; |
$this->infosPourTpl['nomsSansCorrespondance'] = |
$this->classerAlphabetiquement('nomSciRetenu', $this->infosPourTpl['nomsSansCorrespondance'] ); |
} |
private function ajouterAuxNomsScoreSimilariteAvec($masque) { |
$nom_demande_ss = strtolower($this->manipulateurDeChaine->supprimerAccents($masque)); |
foreach ($this->infosPourTpl['noms'] as $id => $nom) { |
$nom_flou_ss = strtolower($this->manipulateurDeChaine->supprimerAccents($nom['nomSciRetenu'])); |
$stat = array(); |
// Prime pour la ressemblance globale : |
$score = 500 - levenshtein($nom_flou_ss, $nom_demande_ss); |
// On affine |
$score = $score + (similar_text($nom_demande_ss, $nom_flou_ss) * 3); |
$nom['score'] = $score; |
$this->infosPourTpl['noms'][$id] = $nom; |
} |
} |
private function classerAlphabetiquement($champs, $valeurs) { |
$this->trieur->setTableau($valeurs); |
$this->trieur->setChampsEtOrdres(array($champs => 'nat')); |
return $this->trieur->trier(); |
} |
public function surligner() { |
$this->definirMotsASurligner(); |
foreach ($this->infosPourTpl['noms'] as $idNom => $nom) { |
$this->infosPourTpl['noms'][$idNom]['nomSciRetenuSurligne'] = $this->surlignerMotsMasqueRecherche($nom['nomSciRetenu']); |
if (isset($this->infosPourTpl['synonymes'][$idNom])) { |
foreach ($this->infosPourTpl['synonymes'][$idNom] as $idSyn => $synonyme) { |
$this->infosPourTpl['synonymes'][$idNom][$idSyn]['nomSci'] = $this->surlignerMotsMasqueRecherche($synonyme['nomSci']); |
} |
} |
} |
} |
private function definirMotsASurligner() { |
$this->motsASurligner = explode(' ', $this->parametres->masqueRecherche); |
} |
private function surlignerMotsMasqueRecherche($nom) { |
$this->surligneur->setTexte($nom); |
$nom = $this->surligneur->surlignerMots($this->motsASurligner); |
return $nom; |
} |
} |
?> |
Property changes: |
Added: svnkit:entry:sha1-checksum |
+b308b575b63824443e3ba51a065e27a97843a2d9 |
\ No newline at end of property |
/trunk/modules/resultat/formateurs/nom_scientifique/RetenuFormateur.php |
---|
New file |
0,0 → 1,88 |
<?php |
class RetenuFormateur implements Formateur { |
const TPL_VUE = 'liste_noms'; |
private $parametres = null; |
private $surligneur = null; |
private $trieur = null; |
private $urls = null; |
private $fusioneur = null; |
private $motsASurligner = array(); |
private $noms = array(); |
private $infosPourTpl = array(); |
public function __construct(ParametresResultats $parametres, Array $resultats, Surligneur $surligneur = null, |
Trieur $trieur = null, AppUrls $urls = null, TableauManipulateur $tableau = null) { |
$this->parametres = $parametres; |
$this->noms = $resultats['resultat']; |
$this->surligneur = (is_null($surligneur)) ? new Surligneur() : $surligneur; |
$this->trieur = (is_null($trieur)) ? new Trieur() : $trieur; |
$this->urls = (is_null($urls)) ? new AppUrls() : $urls; |
$this->fusioneur = (is_null($tableau)) ? new TableauManipulateur() : $tableau; |
} |
public function getTplInfos() { |
return $this->infosPourTpl; |
} |
public function getTplNom() { |
return self::TPL_VUE; |
} |
public function formater() { |
foreach ($this->noms as $id => $nom) { |
$infosDuNom = array(); |
$infosDuNom['nomSci'] = $nom['nom_sci_complet']; |
$infosDuNom['retenu'] = $nom['retenu']; |
$nom_retenu = $nom['retenu'] == 'true' ? $nom['nom_sci'] : ''; |
$infosDuNom['urlFiche'] = $this->urls->obtenirUrlFiche($id, $this->parametres->typeNom, $this->parametres->masqueRecherche); |
$this->infosPourTpl['noms'][$id] = $infosDuNom; |
} |
} |
public function trier() { |
$nomsRetenus = array(); |
$nomsSynonymes = array(); |
foreach ($this->infosPourTpl['noms'] as $id => $nom) { |
if ($nom['retenu'] == 'true') { |
$nomsRetenus[$id] = $nom; |
} else { |
$nomsSynonymes[$id] = $nom; |
} |
} |
$this->trieur->setTableau($nomsRetenus); |
$this->trieur->setChampsEtOrdres(array('nomSci' => SORT_ASC)); |
$nomsRetenus = $this->trieur->trier(); |
$this->trieur->setTableau($nomsSynonymes); |
$this->trieur->setChampsEtOrdres(array('nomSci' => SORT_ASC)); |
$nomsSynonymes = $this->trieur->trier(); |
$this->fusioneur->setTableau($nomsRetenus); |
$this->fusioneur->etendreAvec($nomsSynonymes); |
$this->infosPourTpl['noms'] = $this->fusioneur->getTableau(); |
} |
public function surligner() { |
$this->definirMotsASurligner(); |
foreach ($this->infosPourTpl['noms'] as $id => $nom) { |
$this->infosPourTpl['noms'][$id]['nomSci'] = $this->surlignerMotsMasqueRecherche($nom['nomSci']); |
} |
} |
private function definirMotsASurligner() { |
$this->motsASurligner = explode(' ', $this->parametres->masqueRecherche); |
} |
private function surlignerMotsMasqueRecherche($nom) { |
$this->surligneur->setTexte($nom); |
$nom = $this->surligneur->surlignerMots($this->motsASurligner); |
return $nom; |
} |
} |
?> |
/trunk/modules/resultat/formateurs/nom_scientifique/DecompoFormateur.php |
---|
New file |
0,0 → 1,72 |
<?php |
class DecompoFormateur implements Formateur { |
const TPL_VUE = 'decomposition'; |
private $parametres = null; |
private $surligneur = null; |
private $trieur = null; |
private $urls = null; |
private $motsASurligner = array(); |
private $noms = array(); |
private $infosPourTpl = array(); |
public function __construct(ParametresResultats $parametres, Array $resultats, Surligneur $surligneur = null, Trieur $trieur = null, AppUrls $urls = null) { |
$this->parametres = $parametres; |
$this->noms = $resultats['resultat']; |
$this->surligneur = (is_null($surligneur)) ? new Surligneur() : $surligneur; |
$this->trieur = (is_null($trieur)) ? new Trieur() : $trieur; |
$this->urls = (is_null($urls)) ? new AppUrls() : $urls; |
} |
public function getTplInfos() { |
return $this->infosPourTpl; |
} |
public function getTplNom() { |
return self::TPL_VUE; |
} |
public function formater() { |
$this->infosPourTpl['masqueRecherche'] = rawurlencode($this->parametres->masqueRecherche); |
$this->infosPourTpl['baseUrlIco'] = $this->urls->obtenirUrlBaseDossier(); |
foreach ($this->noms as $id => $nom) { |
$infosDuNom = array(); |
$infosDuNom['nomSci'] = $nom['nom_sci']; |
$infosDuNom['retenu'] = $nom['retenu']; |
$infosDuNom['auteur'] = is_null($nom['auteur']) ? '' : $nom['auteur']; |
$infosDuNom['annee'] = is_null($nom['annee']) ? '' : $nom['annee']; |
$infosDuNom['biblio'] = is_null($nom['biblio_origine']) ? '' : $nom['biblio_origine']; |
$infosDuNom['addendum'] = is_null($nom['nom_addendum']) ? '' : $nom['nom_addendum']; |
$infosDuNom['nn'] = $id; |
$nom_retenu = $nom['retenu'] == 'true' ? $nom['nom_sci'] : ''; |
$infosDuNom['urlFiche'] = $this->urls->obtenirUrlFiche($id, $this->parametres->typeNom, $this->parametres->masqueRecherche); |
$this->infosPourTpl['noms'][$id] = $infosDuNom; |
} |
} |
public function trier() { |
$this->trieur->setTableau($this->infosPourTpl['noms']); |
$this->trieur->setChampsEtOrdres(array('nomSci' => SORT_ASC)); |
$this->infosPourTpl['noms'] = $this->trieur->trier(); |
} |
public function surligner() { |
$this->definirMotsASurligner(); |
foreach ($this->infosPourTpl['noms'] as $id => $nom) { |
$this->infosPourTpl['noms'][$id]['nomSci'] = $this->surlignerMotsMasqueRecherche($nom['nomSci']); |
} |
} |
private function definirMotsASurligner() { |
$this->motsASurligner = explode(' ', $this->parametres->masqueRecherche); |
} |
private function surlignerMotsMasqueRecherche($nom) { |
$this->surligneur->setTexte($nom); |
$nom = $this->surligneur->surlignerMots($this->motsASurligner); |
return $nom; |
} |
} |
?> |
/trunk/modules/resultat/formateurs/nom_scientifique/AlphabFormateur.php |
---|
New file |
0,0 → 1,65 |
<?php |
class AlphabFormateur implements Formateur { |
const TPL_VUE = 'liste_noms'; |
private $parametres = null; |
private $surligneur = null; |
private $trieur = null; |
private $urls = null; |
private $motsASurligner = array(); |
private $noms = array(); |
private $infosPourTpl = array(); |
public function __construct(ParametresResultats $parametres, Array $resultats, Surligneur $surligneur = null, Trieur $trieur = null, AppUrls $urls = null) { |
$this->parametres = $parametres; |
$this->noms = $resultats['resultat']; |
$this->surligneur = (is_null($surligneur)) ? new Surligneur() : $surligneur; |
$this->trieur = (is_null($trieur)) ? new Trieur() : $trieur; |
$this->urls = (is_null($urls)) ? new AppUrls() : $urls; |
} |
public function getTplInfos() { |
return $this->infosPourTpl; |
} |
public function getTplNom() { |
return self::TPL_VUE; |
} |
public function formater() { |
foreach ($this->noms as $id => $nom) { |
$infosDuNom = array(); |
$infosDuNom['nomSci'] = $nom['nom_sci_complet']; |
$infosDuNom['retenu'] = $nom['retenu']; |
$nom_retenu = $nom['retenu'] == 'true' ? $nom['nom_sci'] : ''; |
$infosDuNom['urlFiche'] = $this->urls->obtenirUrlFiche($id, $this->parametres->typeNom, $this->parametres->masqueRecherche); |
$this->infosPourTpl['noms'][$id] = $infosDuNom; |
} |
} |
public function trier() { |
$this->trieur->setTableau($this->infosPourTpl['noms']); |
$this->trieur->setChampsEtOrdres(array('nomSci' => SORT_ASC)); |
$this->infosPourTpl['noms'] = $this->trieur->trier(); |
} |
public function surligner() { |
$this->definirMotsASurligner(); |
foreach ($this->infosPourTpl['noms'] as $id => $nom) { |
$this->infosPourTpl['noms'][$id]['nomSci'] = $this->surlignerMotsMasqueRecherche($nom['nomSci']); |
} |
} |
private function definirMotsASurligner() { |
$this->motsASurligner = explode(' ', $this->parametres->masqueRecherche); |
} |
private function surlignerMotsMasqueRecherche($nom) { |
$this->surligneur->setTexte($nom); |
$nom = $this->surligneur->surlignerMots($this->motsASurligner); |
return $nom; |
} |
} |
?> |
/trunk/modules/resultat/Resultat.php |
---|
New file |
0,0 → 1,265 |
<?php |
// declare(encoding='UTF-8'); |
/** |
* Classe mère du module Liste. |
* |
* @category PHP 5.2 |
* @package eflore-consultation |
* @author Jean-Pascal MILCENT <jpm@tela-botanica.org> |
* @author Delphine CAUQUIL <delphine@tela-botanica.org> |
* @copyright 2011 Tela-Botanica |
* @license http://www.gnu.org/licenses/gpl.html Licence GNU-GPL-v3 |
* @license http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL-v2 |
* @version $Id$ |
*/ |
class Resultat extends aControleur { |
private $parametres = null; |
private $resultats = null; |
private $donneesTpl = array(); |
private $i18n = array(); |
private $parametresAvancesGeneriques = array('gen','fam','nn','nt','sp','ssp','type','sto','sti','stc'); |
public function initialiser() { |
spl_autoload_register(array($this, 'chargerClassesResultat')); |
$this->parametres = new ParametresResultats(); |
$this->capturerParametres(); |
$this->capturerParametresAvances(); |
//if (Registre::get('parametres.referentiel') == "bdtfxr") Registre::set('parametres.referentiel', 'bdtfx') ; |
$this->parametres->referentielCourant = Registre::get('parametres.referentiel') ; |
$this->parametres->projetImg = Config::get($this->parametres->referentielCourant.'.baseImages'); |
$this->resultats = Registre::get('resultats'); |
$this->i18n = I18n::get('Recherche-form-avancee'); |
} |
private function chargerClassesResultat($classe) { |
$base = dirname(__FILE__).DS; |
$cheminFormateurs = $base.'formateurs'.DS; |
$cheminFormateursNs = $cheminFormateurs.'nom_scientifique'.DS; |
$cheminFormateursNv = $cheminFormateurs.'nom_vernaculaire'.DS; |
$dossiers = array($base, $cheminFormateurs, $cheminFormateursNs, $cheminFormateursNv); |
foreach ($dossiers as $chemin) { |
$fichierATester = $chemin.$classe.'.php'; |
if (file_exists($fichierATester)) { |
include_once $fichierATester; |
return null; |
} |
} |
} |
private function capturerParametres() { |
$this->parametres->masqueRecherche = ""; |
if (isset($_GET['resultat'])) { |
$this->parametres->typeResultat = $_GET['resultat']; |
} |
if (isset($_GET['nom'])) { |
$this->parametres->masqueRecherche = trim($_GET['nom']); |
} |
//recherche avancee type |
if (isset($_GET['fam'])) { |
$this->parametres->masqueRecherche .= trim($_GET['fam']); |
} |
if (isset($_GET['gen'])) { |
$this->parametres->masqueRecherche .= trim($_GET['gen']); |
} |
if (isset($_GET['sp'])) { |
$this->parametres->masqueRecherche .= trim($_GET['sp']); |
} |
if (isset($_GET['ssp'])) { |
$this->parametres->masqueRecherche .= trim($_GET['ssp']); |
} |
if (isset($_GET['and'])) { |
$this->parametres->masqueRecherche .= trim($_GET['and']); |
} |
if (isset($_GET['anf'])) { |
$this->parametres->masqueRecherche .= trim($_GET['anf']); |
} |
if (isset($_GET['au'])) { |
$this->parametres->masqueRecherche .= trim($_GET['au']); |
} |
if (isset($_GET['bib'])) { |
$this->parametres->masqueRecherche .= trim($_GET['bib']); |
} |
// Si spécifié, seuls les résultats du niveau spécifié sont affichés. |
// Passer "*" pour annuler le filtre par rang (le paramètre est mis à "null"). |
// Par défaut, seules les espèces sont affichées (paramètre par défaut). |
if (isset($_GET['rang'])) { |
$this->parametres->rang = ($_GET['rang'] == '*' ? null : $_GET['rang']); |
} |
if (isset($_GET['type_nom'])) { |
$this->parametres->typeNom = $_GET['type_nom']; |
} |
if (isset($_GET['niveau'])) { |
Registre::set('parametres.niveau', $_GET['niveau']); |
} |
} |
private function capturerParametresAvances() { |
$this->capturerParametresAvancesGeneriques(); |
$this->capturerParametresAvancesDependantsLangage(); |
$this->capturerParametresAvancesPresenceSpecifiques(); |
$this->capturerParametresAvancesRang(); |
} |
private function capturerParametresAvancesRang() { |
// rang à afficher |
$this->param['rang'] = $this->parametres->rang; |
if ($this->param['rang'] === null) { |
$this->param['rang'] = '*'; |
} |
} |
private function capturerParametresAvancesGeneriques() { |
foreach($this->parametresAvancesGeneriques as $param) { |
if (isset($_GET[$param]) && $_GET[$param] != '') { |
$this->param[$param] = urldecode($_GET[$param]); |
} |
} |
} |
private function capturerParametresAvancesDependantsLangage() { |
if (isset($_GET['au']) && $_GET['au'] != '' |
&& $_GET['au'] != urlencode($this->i18n['valeur-form-auteur'])) { |
$this->param['au'] = urldecode($_GET['au']); |
} |
if (isset($_GET['bib']) && $_GET['bib'] != '' |
&& $_GET['bib'] != urlencode($this->i18n['valeur-form-bib'])) { |
$this->param['bib'] = urldecode($_GET['bib']); |
} |
if (isset($_GET['and']) && $_GET['and'] != '' |
&& $_GET['and'] != urlencode($this->i18n['valeur-form-date'])) { |
$this->param['and'] = urldecode($_GET['and']); |
} |
if (isset($_GET['anf']) && $_GET['anf'] != '' |
&& $_GET['anf'] != urlencode($this->i18n['valeur-form-date'])) { |
$this->param['anf'] = urldecode($_GET['anf']); |
} |
} |
private function capturerParametresAvancesPresenceSpecifiques() { |
$champs_presence = $this->obtenirChampsPresence(); |
foreach($champs_presence as $champ) { |
$param = $champ['param']; |
if (isset($_GET[$param]) && $_GET[$param] != '') { |
$this->param[$param] = urldecode($_GET[$param]); |
} |
} |
} |
private function obtenirChampsPresence() { |
$tableau_champs_presence = array(); |
$referentiel = Registre::get('parametres.referentiel'); |
$champs_presence = Config::get($referentiel.'.champsPresence'); |
$champs_presence_spl = explode('|', $champs_presence); |
foreach($champs_presence_spl as $champ) { |
$label_param_champ = explode(':', $champ); |
if(count($label_param_champ) >= 2) { |
$tableau_champs_presence[] = array('param' => $label_param_champ[1], |
'label' => $label_param_champ[0]); |
} |
} |
return $tableau_champs_presence; |
} |
public function executerActionParDefaut() { |
$this->executerResultat(); |
} |
public function executerResultat() { |
$this->chargerOnglets(); |
$this->chargerNbreDeTaxons(); |
$this->chargerNomsFormates(); |
$this->setSortie(self::RENDU_CORPS, $this->getVue('resultat', $this->donneesTpl)); |
} |
private function chargerOnglets() { |
$donnees = array(); |
$donnees['typeResultat'] = $this->parametres->typeResultat; |
$donnees['typeNom'] = $this->parametres->typeNom; |
$donnees['ongletsNs'] = array('determination', 'retenu', 'decompo'); |
$donnees['ongletsNv'] = array('determination', 'alphab'); |
if (@$_GET['action'] == 'rechercheAvancee') { |
$donnees['urls']['alphab'] = $this->urls->obtenirUrlResultatAvanceOnglets('alphab', $this->param); |
$donnees['urls']['retenu'] = $this->urls->obtenirUrlResultatAvanceOnglets('retenu', $this->param); |
$donnees['urls']['determination'] = $this->urls->obtenirUrlResultatAvanceOnglets('determination',$this->param); |
$donnees['urls']['decompo'] = $this->urls->obtenirUrlResultatAvanceOnglets('decompo',$this->param); |
} else { |
$donnees['urls']['alphab'] = $this->urls->obtenirUrlResultat('alphab', $this->param); |
$donnees['urls']['retenu'] = $this->urls->obtenirUrlResultat('retenu', $this->param); |
$donnees['urls']['determination'] = $this->urls->obtenirUrlResultat('determination', $this->param); |
$donnees['urls']['decompo'] = $this->urls->obtenirUrlResultat('decompo', $this->param); |
} |
// Inversion du critère de filtrage de rang : espèces seulement VS tout (pas d'autre choix pour l'instant) |
//echo "PARAMS: <pre>" . print_r($this->param, true) . "</pre><br/>"; |
$paramsAvecRangInverse = $this->param; |
if (array_key_exists('rang', $paramsAvecRangInverse)) { |
if ($paramsAvecRangInverse['rang'] == '*') { |
$paramsAvecRangInverse['rang'] = 290; |
} else { |
unset ($paramsAvecRangInverse['rang']); |
} |
} |
//echo "PARAMS INV: <pre>" . print_r($paramsAvecRangInverse, true) . "</pre><br/>"; |
$this->donneesTpl['urlInverse'] = $this->urls->obtenirUrlResultat($donnees['typeResultat'], $paramsAvecRangInverse); |
//echo "URL INV: " . $this->donneesTpl['urlInverse'] . "<br/>"; |
$donnees['i18n']['nv'] = I18n::get('Resultat-onglets-nv'); |
$donnees['i18n']['ns'] = I18n::get('Resultat-onglets-ns'); |
$this->donneesTpl['ongletsHtml'] = $this->getVue('onglets', $donnees); |
} |
private function chargerNbreDeTaxons() { |
$this->donneesTpl['nbreTaxons'] = $this->resultats['entete']['total']; |
} |
// Filtre selon le rang à afficher (espèce, genre... tout) |
// et renvoie le nombre de taxons réellement affichés |
private function filtrer() { |
$nbTaxAff = 0; |
if ($this->parametres->rang != null) { |
foreach ($this->resultats['resultat'] as $c => $v) { |
$numRang = substr($v['rang.code'], strrpos($v['rang.code'], ':') +1); |
if ($numRang != $this->parametres->rang) { |
unset($this->resultats['resultat'][$c]); |
} else { |
$nbTaxAff++; |
} |
} |
} else { |
$nbTaxAff = $this->resultats['entete']['total']; |
} |
return $nbTaxAff; |
} |
private function chargerNomsFormates() { |
if (Config::get('benchmark_chrono')) Chronometre::chrono("Avt mise en forme des noms"); |
// Filtre selon $this->parametres['rang'] pour afficher seulement un rang, ou bien tous |
// Valable uniquement pour la recherche par nom scientifique |
//echo "<pre>".print_r($this->parametres, true)."</pre>"; |
if ($this->parametres->typeNom == 'nom_scientifique') { |
$this->donneesTpl['nombreTaxonsAffiches'] = $this->filtrer(); |
$this->donneesTpl['rang'] = $this->parametres->rang; |
} else { |
$this->donneesTpl['nombreTaxonsAffiches'] = $this->donneesTpl['nbreTaxons']; |
} |
$this->donneesTpl['typeNom'] = $this->parametres->typeNom; |
$formateur = ResultatFormateurFabrique::creer($this->parametres, $this->resultats); |
if (Config::get('benchmark_chrono')) Chronometre::chrono("Avt formatage des noms"); |
$formateur->formater(); |
if (Config::get('benchmark_chrono')) Chronometre::chrono("Avt triage des noms"); |
$formateur->trier(); |
if (Config::get('benchmark_chrono')) Chronometre::chrono("Avt surlignage des noms"); |
$formateur->surligner(); |
if (Config::get('benchmark_chrono')) Chronometre::chrono("Avt création de la vue"); |
$this->donneesTpl['nomsHtml'] = $this->getVue($formateur->getTplNom(), $formateur->getTplInfos()); |
if (Config::get('benchmark_chrono')) Chronometre::chrono("Après mise en forme des noms"); |
} |
} |
?> |
/trunk/modules/resultat/squelettes/liste_noms_verna.tpl.html |
---|
New file |
0,0 → 1,19 |
<!-- onglet "Tableau multilingue" --> |
<? if ($noms) : ?> |
<table> |
<tr> |
<th>n°</th> |
<th>langue</th> |
<th>nom commun</th> |
<th>nom latin</th> |
</tr> |
<? $i = 1; foreach ($noms as $id => $valeurs) : ?> |
<tr> |
<td><?=$i++?></td> |
<td><?= $valeurs['langue']?></td> |
<td><?= $valeurs['nomVerna']?></td> |
<td><a href="<?= $valeurs['urlFiche']?>"><?= $valeurs['nomSci']?></a></td> |
</tr> |
<? endforeach; ?> |
</table> |
<? endif; ?> |
/trunk/modules/resultat/squelettes/onglets.tpl.html |
---|
New file |
0,0 → 1,15 |
<ul class="onglets"> |
<?php if ($typeNom == 'nom_scientifique') : ?> |
<?php foreach ($ongletsNs as $onglet) : ?> |
<li <?=($typeResultat == $onglet ? 'class="menu_actif sci"': 'class="sci"')?> > |
<a href="<?=$urls[$onglet]?>"><?=$i18n['ns'][$onglet]?></a> |
</li> |
<?php endforeach; ?> |
<?php elseif ($typeNom == 'nom_vernaculaire') : ?> |
<?php foreach ($ongletsNv as $onglet) : ?> |
<li <?=($typeResultat == $onglet ? 'class="menu_actif verna"': 'class="verna"')?> > |
<a href="<?=$urls[$onglet]?>"><?=$i18n['nv'][$onglet]?></a> |
</li> |
<?php endforeach; ?> |
<?php endif; ?> |
</ul> |
/trunk/modules/resultat/squelettes/decomposition.tpl.html |
---|
New file |
0,0 → 1,67 |
<!-- onglet "Tableau" --> |
<p> |
Rechercher sur |
<a href="http://www.theplantlist.org/tpl/search?q=<?=htmlentities($masqueRecherche)?>"> |
<img src="<?=$baseUrlIco?>presentations/images/sites/tpl.png" alt="The Plant List" |
title="Rechercher dans The Plant List"/> |
</a> |
<a href="http://www.ipni.org/ipni/simplePlantNameSearch.do?find_wholeName=<?=htmlentities($masqueRecherche)?>&output_format=normal&query_type=by_query&back_page=query_ipni.html"> |
<img src="<?=$baseUrlIco?>presentations/images/sites/ipni.png" alt="IPNI" title="Rechercher dans IPNI"/> |
</a> |
<a href="http://plants.jstor.org/search?plantName=%22<?=htmlentities($masqueRecherche)?>%22&syn=1"> |
<img src="<?=$baseUrlIco?>presentations/images/sites/jstor.png" alt="JSTOR Plant Science" title="Rechercher dans JSTOR Plant Science" /> |
</a> |
<a href="http://coldb.mnhn.fr/Consultation?filtre=motif&motif=<?=htmlentities($masqueRecherche)?>"> |
<img src="<?=$baseUrlIco?>presentations/images/sites/mnhn.png" alt="Muséum national d'Histoire naturelle" title="Rechercher dans Muséum national d'Histoire naturelle" /> |
</a> |
<a href="http://www.anbg.gov.au/cgi-bin/apni?TAXON_NAME=<?=htmlentities($masqueRecherche)?>"> |
<img src="<?=$baseUrlIco?>presentations/images/sites/anbg.png" alt="Australian Plant Name Index" title="Rechercher dans Australian Plant Name Index" /> |
</a> |
<a href="http://sweetgum.nybg.org/vh/specimen_list.php?QueryName=BasicQuery&QueryPage=http%3A%2F%2Fsciweb.nybg.org%2Fscience2%2Fvii2.asp&Restriction=NybRecordType+%3D+%27Specimen%27&StartAt=1&any=SummaryData%7CAdmWebMetadata&QueryOption=any&Submit=Search&QueryTerms=<?=htmlentities($masqueRecherche)?>"> |
<img src="<?=$baseUrlIco?>presentations/images/sites/nybg.png" alt="NYBG Virtual Herbarium" title="Rechercher dans NYBG Virtual Herbarium" /> |
</a> |
<a href="http://collections.mnh.si.edu/search/botany/?qt=<?=htmlentities($masqueRecherche)?>"> |
<img src="<?=$baseUrlIco?>presentations/images/sites/si.png" alt="Type Specimen Register of the U.S. National Herbarium" title="Rechercher dans Type Specimen Register of the U.S. National Herbarium" /> |
</a> |
<a href="http://herbarium.univie.ac.at/database/search.php?taxon=<?=htmlentities($masqueRecherche)?>&search=1"> |
<img src="<?=$baseUrlIco?>presentations/images/sites/vha.png" alt="Virtual Herbaria Austria" title="Rechercher dans Virtual Herbaria Austria" /> |
</a> |
<a href="http://swbiodiversity.org/seinet/taxa/index.php?taxon=<?=htmlentities($masqueRecherche)?>"> |
<img src="<?=$baseUrlIco?>presentations/images/sites/seinet.png" alt="SEINet" title="Rechercher dans SEINet" /> |
</a> |
<a href="http://www.ville-ge.ch/musinfo/bd/cjb/africa/resultat.php?efFamille=&projet%5B%5D=FSA&projet%5B%5D=FTA&projet%5B%5D=FNA&projet%5B%5D=BDM&langue=en&pbRecherche=Rechercher&efNom=<?=htmlentities($masqueRecherche)?>"> |
<img src="<?=$baseUrlIco?>presentations/images/sites/cjb.png" alt="African Plants Database" title="Rechercher dans African Plants Database du Jardin Botanique de Genève" /> |
</a> |
</p> |
<table id="ef-resultats-decomposition"> |
<thead> |
<tr> |
<th id="col-ns">Nom scientifique</th> |
<th>Auteur</th> |
<th>Année</th> |
<th>Référence bibliographique</th> |
<th title="Commentaires nomenclaturaux ou taxonomiques concernant le nom scientifique">Nom addendum</th> |
<th title="Identifiant numérique du nom scientifique">N° nom</th> |
</tr> |
</thead> |
<tbody> |
<? $i = 1 ?> |
<? foreach ($noms as $nom) : ?> |
<tr |
class="<?=$nom['retenu'] === 'true' ? 'retenu' : 'synonyme' ?>" |
title="Ligne #<?=$i++?>"> |
<td> |
<? if ($nom['retenu'] !== 'absent') : ?> |
<a href="<?=$nom['urlFiche']?>"><?=$nom['nomSci']?></a> |
<? else : ?><?=$nom['nomSci']?> |
<? endif; ?> |
</td> |
<td><?=$nom['auteur']?></td> |
<td><?=$nom['annee']?></td> |
<td><?=$nom['biblio']?></td> |
<td><?=$nom['addendum']?></td> |
<td><?=$nom['nn']?></td> |
</tr> |
<? endforeach; ?> |
</tbody> |
</table> |
/trunk/modules/resultat/squelettes/liste_noms.tpl.html |
---|
New file |
0,0 → 1,18 |
<!-- onglet "Liste" --> |
<ol> |
<? foreach ($noms as $id => $nom) : ?> |
<li> |
<?php if ($nom['retenu'] == 'absent') : ?> |
<?=$nom['nomSci']?> |
<?php else : ?> |
<a href="<?=$nom['urlFiche']?>"> |
<?php if ($nom['retenu'] == 'true') : ?> |
<strong class="nom-sci-retenu"><?=$nom['nomSci']?></strong> |
<?php else : ?> |
<?=$nom['nomSci']?> |
<?php endif; ?> |
</a> |
<?php endif; ?> |
</li> |
<? endforeach; ?> |
</ol> |
/trunk/modules/resultat/squelettes/determination_verna.tpl.html |
---|
New file |
0,0 → 1,88 |
<!-- onglet "Vignettes noms français" --> |
<?php if ($noms) : ?> |
<ul id="ef-resultats-nv-determination"> |
<? foreach ($noms as $nnTaxon => $nom) : ?> |
<li class="zone-resultat"> |
<table > |
<tbody > |
<tr><td class="nom"> |
<?php if (isset($nom['nomVerna'])) : ?> |
<?php $nbrNomVerna = count($nom['nomVerna']) ?> |
<ul class="synonymes" style="width:100%;"> |
<?php for ($i = 0; ($i < 3); $i++) : ?> |
<?php if (isset($nom['nomVerna'][$i])) : ?> |
<li><?=$nom['nomVerna'][$i]['nom_vernaculaire']?></li> |
<?php endif; ?> |
<? endfor; ?> |
<?php if ($nbrNomVerna === 4) : ?> |
<?php if (isset($nom['nomVerna'][3])) : ?> |
<li><?=$nom['nomVerna'][3]['nom_vernaculaire']?></li> |
<?php endif; ?> |
<?php endif; ?> |
<?php if ($nbrNomVerna > 3 && $nbrNomVerna != 4) : ?> |
<li class="synonymes-autres"> |
<ul> |
<?php for ($i = 3; $i < $nbrNomVerna; $i++) : ?> |
<li><?=$nom['nomVerna'][$i]['nom_vernaculaire']?></li> |
<? endfor; ?> |
</ul> |
</li> |
<?php endif; ?> |
</ul> |
<?php endif; ?> |
</td><td class="nom"> |
<a class="lien_fiche_eflore" href="<?=$nom['urlFiche']?>" ><?=$nom['nomSci']?></a> |
</td> |
<td> |
<?php if (isset($imagesCoste[$taxons[$nom['nomSci']]][0])) : ?> |
<img class="illustration_resultat_coste" src="<?=htmlentities($imagesCoste[$taxons[$nom['nomSci']]][0])?>" alt="illustration de Coste" /> |
<?php else : ?> |
<div class="vide"></div> |
<?php endif; ?> |
</td> |
<td> |
<?php if (isset($imagesUrls[$nnTaxon])) : ?> |
<img class="illustration_resultat_cel" src="<?=htmlentities($imagesUrls[$nnTaxon][0])?>" data-num-nom="<?= $nnTaxon; ?>" title="<?= $nnTaxon; ?>" alt="Images issues du CEL" style="width:100px;height:100px;display:block;float:right;"/> |
<?php else : ?> |
<p class="absent"> |
Pas de photo<br /> |
<a href="<?=$urlWidget.'&num_nom='.$nnTaxon?>" |
title="Ajouter une photographie au moyen du Carnet en Ligne" |
onclick="window.open(this.href); return false;" class="contribuer"> |
Contribuer |
</a> |
</p> |
<?php endif; ?> |
</td> |
<td > |
<?php if (isset($repartition['urls'][$nnTaxon])) : ?> |
<img src="<?=htmlentities($repartition['urls'][$nnTaxon])?>" alt="Carte de répartition" class="repartition_vignette illustration_resultat_choro"/> |
<?php else : ?> |
<div class="absent">Pas de carte</div> |
<?php endif; ?> |
</td></tr> |
</tbody> |
</table> |
</li> |
<? endforeach; ?> |
</ul> |
<?php endif; ?> |
<script type="text/javascript"> |
//<![CDATA[ |
$(document).ready(function() { |
ajouterToggleSynonymesAutres(); |
}); |
function ajouterToggleSynonymesAutres() { |
$("ul#ef-resultats-nv-determination li").each(function(index) { |
$(this).find('.synonymes-autres').prepend('<a id="bascule-'+index+'" href="#">et plus...</a>'); |
$(this).find('.synonymes-autres ul').css('display', 'none'); |
$(this).find('.synonymes-autres ul').attr('id', 'sa-'+index); |
$('#bascule-'+index).on('click', function() { |
$('#sa-'+index).toggle('blind', {}, 500); |
return false; |
}); |
}); |
} |
//]]> |
</script> |
/trunk/modules/resultat/squelettes/determination.tpl.html |
---|
New file |
0,0 → 1,94 |
<!-- onglet "Vignettes" --> |
<ul id="ef-resultats-determination"> |
<?php if ($noms) : ?> |
<? foreach ($noms as $nnTaxon => $nom) : ?> |
<li class="zone-resultat"> |
<div class="nom-sci"> |
<a class="lien_fiche_eflore" href="<?=$nom['urlFiche']?>" > |
<strong class="nom-sci-retenu"><?=$nom['nomSciRetenuSurligne']?></strong> |
</a> |
</div> |
<?php if (isset($repartition)) : ?> |
<?php if (isset($repartition['urls'][$nnTaxon]) ) : ?> |
<img class="illustration_resultat_choro" src="<?=htmlentities($repartition['urls'][$nnTaxon])?>" alt="<?= $nom['nomSciRetenu'] ?> - Carte de répartition" /> |
<?php else : ?> |
<div class="absent">Pas de carte</div> |
<?php endif;endif; ?> |
<?php if ($nom['rang'] != 'Famille' && $nom['rang'] != 'Genre' && $nom['rang'] != 'Ordre') : ?> |
<?php if (isset($imagesUrls[$nnTaxon])) : ?> |
<img class="illustration_resultat_cel" src="<?=htmlentities($imagesUrls[$nnTaxon][0])?>" data-num-nom="<?= $nnTaxon; ?>" title="<?= $nnTaxon; ?>" alt="<?= $nom['nomSciRetenu'] ?> (image CeL)" style="width:100px;height:100px;display:block;float:right;"/> |
<?php else : ?> |
<p class="absent">Pas de photo<br /> |
<a href="<?=$urlWidget.'&num_nom='.$nnTaxon?>" |
title="Ajouter une photographie au moyen du Carnet en Ligne" |
onclick="window.open(this.href); return false;" class="contribuer"> |
Contribuer |
</a> |
</p> |
<?php endif; ?> |
<?php if (isset($dessins) && isset($dessins[$taxons[$nnTaxon]][0])) : ?> |
<img class="illustration_resultat_coste" src="<?=htmlentities($dessins[$taxons[$nnTaxon]][0])?>" alt="<?= $nom['nomSciRetenu'] ?> (illustration de Coste)" /> |
<?php endif; ?> |
<?php endif; ?> |
<?php if (isset($synonymes[$nnTaxon])) : ?> |
<?php $nbrSynonymes = count($synonymes[$nnTaxon]) ?> |
<ul class="synonymes" style="width:100%;"> |
<?php for ($i = 0; ($i < 3); $i++) : ?> |
<?php if (isset($synonymes[$nnTaxon][$i])) : ?> |
<li><b>syn.</b> <?=$synonymes[$nnTaxon][$i]['nomSci']?></li> |
<?php endif; ?> |
<? endfor; ?> |
<?php if ($nbrSynonymes === 4) : ?> |
<?php if (isset($synonymes[$nnTaxon][3])) : ?> |
<li><b>syn.</b> <?=$synonymes[$nnTaxon][3]['nomSci']?></li> |
<?php endif; ?> |
<?php endif; ?> |
<?php if ($nbrSynonymes > 3 && $nbrSynonymes != 4) : ?> |
<li class="synonymes-autres"> |
<ul> |
<?php for ($i = 3; $i < $nbrSynonymes; $i++) : ?> |
<li><b>syn.</b> <?=$synonymes[$nnTaxon][$i]['nomSci']?></li> |
<? endfor; ?> |
</ul> |
</li> |
<?php endif; ?> |
</ul> |
<?php endif; ?> |
</li> |
<? endforeach; ?> |
<?php endif; ?> |
<?php if ($nomsSansCorrespondance) : ?> |
<li class="zone-resultat" title="Aucun nom retenu n'a été trouvé pour ces noms scientifiques"> |
<strong>Noms sans correspondance</strong> |
<ul class="noms-ss-correspondance"> |
<?php foreach ($nomsSansCorrespondance as $nomSC) : ?> |
<li><?=$nomSC?></li> |
<?php endforeach; ?> |
</ul> |
</li> |
<?php endif; ?> |
</ul> |
<script type="text/javascript"> |
//<![CDATA[ |
$(document).ready(function() { |
ajouterToggleSynonymesAutres(); |
}); |
function ajouterToggleSynonymesAutres() { |
$("ul#ef-resultats-determination li").each(function(index) { |
$(this).find('.synonymes-autres').prepend('<a id="bascule-'+index+'" href="#">et plus...</a>'); |
$(this).find('.synonymes-autres ul').css('display', 'none'); |
$(this).find('.synonymes-autres ul').attr('id', 'sa-'+index); |
$('#bascule-'+index).on('click', function() { |
$('#sa-'+index).toggle('blind', {}, 500); |
return false; |
}); |
}); |
} |
//]]> |
</script> |
/trunk/modules/resultat/squelettes/resultat.tpl.html |
---|
New file |
0,0 → 1,28 |
<div class="layout-col-gauche"> |
<div class="layout-wrapper"> |
<aside class="layout-colonne"> |
</aside> |
<div class="layout-contenu"> |
<?php if($typeNom == "nom_scientifique"): ?> |
<?php if ($rang == null): ?> |
Cet affichage montre tous les résultats. |
<a href="<?php echo $urlInverse; ?>">Cliquez ici pour afficher seulement les espèces</a> |
<?php else: ?> |
<!-- Cet affichage ne montre que le rang "<?php echo $rang; ?>".--> |
Cet affichage ne montre que les espèces. |
<a href="<?php echo $urlInverse; ?>">Cliquez ici pour afficher tous les taxons</a> |
<?php endif; ?> |
<br/><br/> |
<?php endif; ?> |
<?=$ongletsHtml?> |
<p style="float:right;"> |
<?php if($typeNom == "nom_scientifique"): ?> |
<?= $nombreTaxonsAffiches ?> nom<?php echo $nombreTaxonsAffiches > 1 ? 's' : ''; ?> affiché<?php echo $nombreTaxonsAffiches > 1 ? 's' : ''; ?> / |
<?php endif; ?> |
<?=$nbreTaxons?> nom<?php echo $nbreTaxons > 1 ? 's' : ''; ?> trouvé<?php echo $nbreTaxons > 1 ? 's' : ''; ?>. |
</p> |
<?=$nomsHtml?> |
</div></div></div> |
/trunk/modules/recherche/Recherche.php |
---|
New file |
0,0 → 1,335 |
<?php |
class Recherche extends aControleur { |
//+----------------------------------------------------------------------------------------------------------------+ |
// Méthodes |
protected $nom = null; |
protected $type_nom = 'nom_scientifique'; |
protected $type_resultat = ''; |
protected $submit = ''; |
protected $acces_fiche = false; |
private $recherche_avancee; |
private $param; |
private $i18n = array(); |
private $parametresAvancesGeneriques = array('gen','fam','nn','nt','sp','ssp','type','sto','sti','stc'); |
public function initialiser() { |
$this->capturerParametres(); |
$this->capturerParametresAvances(); |
$this->i18n = I18n::get('Recherche-form-avancee'); |
} |
/** |
* Fonction d'affichage par défaut |
*/ |
public function executerActionParDefaut() { |
$this->executerAccueil(); |
} |
public function executerAccueil($donneesMoteur = array()) { |
$meta = new MetaDonnees(); |
$meta->setProjet(Registre::get('parametres.referentiel')); |
$metadonnees = $meta->getMetaDonnees(); |
$donneesMoteur['metadonnees_referentiel'] = $metadonnees[0]; |
$niveau = new Niveau(); |
$donnees['form_niveau'] = $niveau->afficherNiveau(); |
$recherchesimple = new RechercheSimple(); |
$donnees['form_nom'] = $recherchesimple->executerFormulaireNom($donneesMoteur); |
if (Registre::get('parametres.niveau') != 1) { |
$recherche_avancee = new RechercheAvancee(); |
$donnees['form_recherche_av'] = $recherche_avancee->executerFormulaireRechercheAv($donneesMoteur); |
} |
$donnees['description'] = ""; |
// le descriptif du référentiel est affiché lorsque seul le moteur est affiché (donc ni résultats, ni fiche) |
if(Registre::get('parametres.module') == 'recherche' && |
Registre::get('parametres.action') == 'action-par-defaut' && |
!Registre::get('resultats')) { |
$referentiel = Registre::get('parametres.referentiel'); |
$wiki = new Wikini(); |
$description = $wiki->getDescriptionReferentielFormate($referentiel); |
$donnees['description'] = $description; |
} |
$this->afficherAccueil($donnees); |
} |
private function afficherAccueil($donnees) { |
$donnees['i18n'] = I18n::get('Recherche-accueil'); |
$this->setSortie(self::RENDU_CORPS, $this->getVue('recherche_accueil', $donnees), true); |
} |
//+---------------------------------------------recherche avancee-------------------------------------+ |
public function executerRechercheAvancee() { |
$this->param = $this->nettoyerParametresDefautRechercheAvancee($this->param); |
$donnees['param'] = $this->param; |
$presence = $this->rechercherCriteresDemandes(); |
if (empty($presence) && !empty($this->param)) { |
$donnees['message_av']['attention'] = 'info_res_vide'; |
} |
$this->executerAccueil($donnees); |
if (Registre::get('resultats')) { |
$_GET['resultat'] = $this->type_resultat; |
$this->executerAction('Resultat', 'executerResultat'); |
} |
} |
private function nettoyerParametresDefautRechercheAvancee($params) { |
$params_nettoyes = array(); |
foreach ($params as $cle => $param) { |
if(!preg_match("#^\(.*\)$#", $param)) { |
$params_nettoyes[$cle] = $param; |
} |
} |
return $params_nettoyes; |
} |
public function rechercherCriteresDemandes() { |
$noms = new Noms(Registre::get('parametres.referentiel')); |
$res = $noms->getRechercheAvancee($this->param); |
if ($res != false || $res['entete']['total'] != 0) { |
if ($res['entete']['total'] == 1 ) { |
$ids = array_keys($res['resultat']); |
$nom = $res['resultat'][$ids[0]]['nom_sci']; |
$url = $this->urls->obtenirUrlFiche($ids[0], 'nom_scientifique', $nom); |
$this->redirigerVers($url); |
} else { |
$res['type'] = $this->type_nom; |
Registre::set('resultats', $res); |
} |
} else { |
$res = ''; |
} |
return $res; |
} |
//+---------------------------------------------recherche simple-------------------------------------+ |
/* |
grep-friendly: ICI->executerRechercheSimple() |
En effet, cette méthode n'est jamais invoquée explicitement. |
Le processus est le suivant: |
* URL = index.php?type_nom=...&referentiel=..&module=recherche&action=rechercheSimple |
* AppControleur::initialiser() |
* `-> AppControleur::$parametres['action'] = $_GET['action'] |
* `-> AppControleur::executerModule() |
* `-> effecture $module->$action() |
* qui nous appelle ici |
*/ |
public function executerRechercheSimple() { |
$donnees['type_nom'] = $this->type_nom; |
$donnees['nom'] = $this->nom; |
if (strlen($donnees['nom']) < 3) { |
$donnees['message']['attention'] = 'info_nb_lettres'; |
} else { |
$presence = $this->rechercherNom(); |
if ($presence == '') { // s'il n'y a pas de nom |
$donnees['message']['attention'] = 'info_sp_abs'; |
} elseif ($presence == 'sans_correspondance') { |
$res = Registre::get('resultats'); |
$id = array_keys($res['resultat']); |
$donnees['message']['nom_ss_corresp']['id'] = $id[0]; |
$nom = array_shift($res['resultat']); |
$donnees['message']['nom_ss_corresp']['nom'] = $nom['nom_sci']; |
} elseif ($presence != 'ok') { // s'il y a des noms approchés |
if (!Registre::get('resultats')) { // s'il n'y a aucun nom exact |
$donnees['message']['attention'] = 'info_sp_abs'; |
} |
$donnees['message']['nom_approche'] = $presence; |
} |
} |
$this->executerAccueil($donnees); |
if (Registre::get('resultats')) { |
$_GET['resultat'] = $this->type_resultat; |
$this->executerAction('Resultat', 'executerResultat'); |
} |
} |
// regarde si il y a des résultats correspondant au nom recherché sinon recherche un nom approché |
// $noms classe métier nom ou nom |
private function rechercherNom() { |
$noms = ($this->type_nom == 'nom_vernaculaire') |
? new NomsVernaculaires(Config::get(Registre::get('parametres.referentiel').'.referentielVerna')) |
: new Noms(Registre::get('parametres.referentiel')); |
$approche = ''; |
$res = $noms->getRechercheEtendue($this->nom, $this->type_resultat); |
$form = I18n::get('Recherche-form-nom'); |
if ($res == false || $res['entete']['total'] === 0) { // recherche nom approché |
$approche = $this->rechercherNomApproche($noms); |
} elseif ($res['entete']['total'] == 1 || $this->acces_fiche) { // renvoie à la fiche |
$approche = $this->traiterAccesFiche($res); |
} else { // affiche les résultats |
$res['type'] = $this->type_nom; |
Registre::set('resultats', $res); |
$approche = 'ok'; |
if ($res['entete']['total'] < 3) { // si moins de 16 noms affiche en plus un nom approché |
$approche = $this->rechercherNomApproche($noms); |
} |
} |
// suppression des nomps en doublons + du nom déjà dans le moteur de recherche |
// TODO: comprendre d'ou viennent les noms en doublons. Peut-être une histoire de noms similaires avec un nom d'auteur |
// différent, qui une fois supprimé se retrouvent à être les même ? |
if(is_array($approche)) { |
$approche_sans_doublons = array(); |
foreach($approche as $element) { |
if(!in_array($element, $approche_sans_doublons) && $element['nom'] != $this->nom) { |
$approche_sans_doublons[] = $element; |
} |
} |
$approche = $approche_sans_doublons; |
} |
return $approche; |
} |
private function traiterAccesFiche($res) { |
$ids = array_keys($res['resultat']); |
if ($this->type_nom == 'nom_vernaculaire') { |
$id = explode(':',$res['resultat'][$ids[0]]['nom_retenu.code']); |
$id = $id[1]; |
} else { |
if ($res['resultat'][$ids[0]]['retenu'] == 'absent') { // dans le cas d'un nom sans correspondance |
$res['type'] = $this->type_nom; |
Registre::set('resultats', $res); |
$approche = 'sans_correspondance'; |
return $approche; |
} else { |
$id = $ids[0]; |
} |
} |
$url = $this->urls->obtenirUrlFiche($id, $this->type_nom, $this->nom); |
$this->redirigerVers($url); |
} |
private function rechercherNomApproche($noms) { |
$approche = ''; |
$res = $noms->getRechercheFloue($this->nom); |
if (!($res == false || $res['entete']['total'] === 0)) { |
for ($i = 0; $i < 3; $i++) { |
$nom_proche = array_shift($res['resultat']); |
$approche[$i]['nom'] = ($this->type_nom == 'nom_vernaculaire') ? $nom_proche['nom'] : $nom_proche['nom_sci']; |
$approche[$i]['url_nom_approche'] = $this->urls->obtenirUrlRechercheSimple($approche[$i]['nom'], $this->type_nom); |
} |
} |
return $approche; |
} |
//+-----------------------------------------------méthodes utiles---------------------------------+ |
private function capturerParametres() { |
if (isset($_REQUEST['nom'])) { |
$this->nom = $this->convertirEncodageEntree(urldecode($_REQUEST['nom'])); |
} |
if (isset($_GET['type_nom'])) { |
$this->type_nom = $this->convertirEncodageEntree(urldecode($_GET['type_nom'])); |
} |
if (isset($_GET['submit'])) { |
$this->submit = $this->convertirEncodageEntree(urldecode($_GET['submit'])); |
} |
if(isset($_GET['acces_fiche'])) { |
$this->acces_fiche = true; |
} |
if (isset($_GET['niveau'])) { |
Registre::set('parametres.niveau', $this->convertirEncodageEntree($_GET['niveau'])); |
} |
if (isset($_GET['resultat'])) { |
$this->type_resultat = $this->convertirEncodageEntree(urldecode($_GET['resultat'])); |
} else { |
$onglet_resultat = $this->recupererTableauConfig('affich_resultats'); |
$this->type_resultat = $onglet_resultat[Registre::get('parametres.niveau').'_'.$this->type_nom]; |
} |
} |
private function capturerParametresAvances() { |
$this->capturerParametresAvancesGeneriques(); |
$this->capturerParametresAvancesDependantsLangage(); |
$this->capturerParametresAvancesPresenceSpecifiques(); |
} |
private function capturerParametresAvancesGeneriques() { |
foreach($this->parametresAvancesGeneriques as $param) { |
if (isset($_GET[$param]) && $_GET[$param] != '') { |
$this->param[$param] = $this->convertirEncodageEntree(urldecode($_GET[$param])); |
} |
} |
} |
private function capturerParametresAvancesDependantsLangage() { |
if (isset($_GET['au']) && $_GET['au'] != '' |
&& $_GET['au'] != $this->convertirEncodageEntree(urlencode($this->i18n['valeur-form-auteur']))) { |
$this->param['au'] = $this->convertirEncodageEntree(urldecode($_GET['au'])); |
} |
if (isset($_GET['bib']) && $_GET['bib'] != '' |
&& $_GET['bib'] != $this->convertirEncodageEntree(urlencode($this->i18n['valeur-form-bib']))) { |
$this->param['bib'] = $this->convertirEncodageEntree(urldecode($_GET['bib'])); |
} |
if (isset($_GET['and']) && $_GET['and'] != '' |
&& $_GET['and'] != $this->convertirEncodageEntree(urlencode($this->i18n['valeur-form-date']))) { |
$this->param['and'] = $this->convertirEncodageEntree(urldecode($_GET['and'])); |
} |
if (isset($_GET['anf']) && $_GET['anf'] != '' |
&& $_GET['anf'] != urlencode($this->i18n['valeur-form-date'])) { |
$this->param['anf'] = $this->convertirEncodageEntree(urldecode($_GET['anf'])); |
} |
} |
private function capturerParametresAvancesPresenceSpecifiques() { |
$champs_presence = $this->obtenirChampsPresence(); |
foreach($champs_presence as $champ) { |
$param = $champ['param']; |
if (isset($_GET[$param]) && $_GET[$param] != '') { |
$this->param[$param] = $this->convertirEncodageEntree(urldecode($_GET[$param])); |
} |
} |
} |
private function obtenirChampsPresence() { |
$tableau_champs_presence = array(); |
$referentiel = Registre::get('parametres.referentiel'); |
$champs_presence_spl = explode('|', Config::get($referentiel.'.champsPresence')); |
foreach($champs_presence_spl as $champ) { |
$label_param_champ = explode(':', $champ); |
if(count($label_param_champ) >= 2) { |
$tableau_champs_presence[] = array('param' => $label_param_champ[1], |
'label' => $label_param_champ[0]); |
} |
} |
return $tableau_champs_presence; |
} |
protected function recupererTableauConfig($param) { |
$tableau = array(); |
$tableauPartiel = explode(',', Config::get($param)); |
$tableauPartiel = array_map('trim', $tableauPartiel); |
foreach ($tableauPartiel as $champ) { |
if (strpos($champ, '=') === false) { |
$tableau[] = $champ; |
} else { |
list($cle, $val) = explode('=', $champ); |
$tableau[$cle] = $val; |
} |
} |
return $tableau; |
} |
/** |
* Convertion des valeurs de requête dans l'encodage de l'application (voir fichier config.ini : appli_encodage), |
* A cause d'un bug en cours d'investigation, celle ci utilise des paramètres différents de la fonction de conversion |
* D'encodage de sortie |
* Cette convertion a lieu seulement si les formats sont différents. |
*/ |
private function convertirEncodageEntree($contenu) { |
if (Config::get('sortie_encodage') != Config::get('appli_encodage')) { |
$contenu = mb_convert_encoding($contenu, Config::get('appli_encodage'), Config::get('sortie_encodage')); |
} |
return $contenu; |
} |
} |
?> |
/trunk/modules/recherche/squelettes/recherche_accueil.tpl.html |
---|
New file |
0,0 → 1,31 |
<div id="primary" class="content-area"> |
<main id="main" class="site-main" role="main"> |
<div id="bloc-recherche" class="cover importance1" style="background-image: url();"> |
<div class="layout-wrapper cover-content"> |
<h1 class="title"><?=$i18n['titre-nom'];?></h1> |
<div class="subtitle"><?=$form_nom;?> |
<div id="conteneur_activation_definition"> |
<a href="#"> </a> |
</div> |
<!-- niveau expert : recherche avancée --> |
<?= isset($form_recherche_av) ? $form_recherche_av : '' ;?></div> |
</div> |
</div> |
</div> |
<div class="layout-col-gauche"> |
<div class="layout-wrapper"> |
<aside class="layout-colonne"> |
</aside> |
<div class="layout-contenu"> |
<div class="description-referentiel"> |
<span class="description-referentiel-texte"> |
<?=$description;?> |
</span> |
</div> |
</div> |
</div> |
</div> |
</main> |
</div> |
/trunk/modules/recherche_avancee/squelettes/form_recherche_av.tpl.html |
---|
New file |
0,0 → 1,285 |
<!-- DEBUT FORM_AVANCE --> |
<script> |
<!-- |
var AUTOCOMPLETION_ELEMENTS_NBRE = 50; |
var URL_SERVICE_AUTOCOMPLETION_NOM_SCI = "<?=$url_base_completion_noms_sci?>"; |
var REFERENTIEL = "<?= Registre::get('parametres.referentiel');?>"; |
$(document).ready(function(){ |
$('#bloc_recherche_av').hide(); |
$('#recherche_av').click(function(event) { |
$('#bloc_recherche_av').slideToggle(); |
event.preventDefault(); |
return false; |
}); |
}); |
--> |
</script> |
<a href="" id="recherche_av" name="recherche_av"> Recherche avancée dans la base de données <?= strtoupper(Registre::get('parametres.referentiel')); ?> version <?= $metadonnees_referentiel['version'] ?>. </a> |
<hr class="nettoyage"/> |
<div id="bloc_recherche_av"> |
<form id="recherche_av_form" method="get" action="<?=$lien?>" > |
<fieldset class="numero_form"> |
<label for="nn">Numéro nomenclatural </label> |
<input id="nn" type="text" name="nn" class="largeur-01" value="<?=isset($param['nn'])? $param['nn'] : ''?>"/> |
<label for="nt">Numéro taxonomique </label> |
<input type="text" id="nt" name="nt" class="largeur-01" value="<?=isset($param['nt'])? $param['nt'] : ''?>"/> |
</fieldset> |
<fieldset class="classification_form"> |
<legend> Classification </legend> |
<br/> |
<label for="fam"> Famille </label> |
<input type="text" id="fam" name="fam" class="champ_autocomplete" value="<?=isset($param['fam'])? $param['fam'] : ''?>" /> |
<label for="gen"> Genre </label> |
<input type="text" id="gen" name="gen" class="champ_autocomplete" value="<?=isset($param['gen'])? $param['gen'] : ''?>" /> |
<label for="sp">Epithète sp.</label> |
<input type="text" id="sp" name="sp" class="champ_autocomplete" value="<?=isset($param['sp'])? $param['sp'] : ''?>" /> |
<br/><br/> |
<? $type = ''; if (isset($param['type'])){ $type = $param['type']; } ?> |
<label for="type">Type épithète infra </label> |
<select name="type"> |
<option value="" <?=($type == '') ? 'selected="selected"' : '' ?> > |
</option> |
<option value="subsp." <?=($type == 'subsp.') ? 'selected="selected"' : '' ?> > |
sous-espèce |
</option> |
<option value="infra-sp." <?=($type == 'infra-sp.') ? 'selected="selected"' : '' ?> > |
infra-espèce |
</option> |
<option value="var." <?=($type == 'var.') ? 'selected="selected"' : '' ?> > |
variété |
</option> |
<option value="subvar." <?=($type == 'subvar.') ? 'selected="selected"' : '' ?> > |
sous-variété |
</option> |
<option value="f." <?=($type == 'f.') ? 'selected="selected"' : '' ?> > |
forme |
</option> |
<option value="subf." <?=($type == 'subf.') ? 'selected="selected"' : '' ?> > |
sous-forme |
</option> |
<option value="f. sp." <?=($type == 'f. sp.') ? 'selected="selected"' : '' ?> > |
forma species |
</option> |
<option value="race" <?=($type == 'race') ? 'selected="selected"' : '' ?> > |
race |
</option> |
<option value="proles" <?=($type == 'proles') ? 'selected="selected"' : '' ?> > |
proles |
</option> |
</select> |
<label for="ssp">Epithète infra spé.</label> |
<input class="champ_autocomplete" type="text" id="ssp" name="ssp" value="<?=isset($param['ssp'])? $param['ssp'] : ''?>" /> |
</fieldset> |
<br/> |
<fieldset class="publication_form"> |
<legend> Publication </legend> |
<br/> |
<label> décrit entre </label> |
<input placeholder="<?=$i18n['valeur-form-date']?>" type="text" name="and" id="and" value="<? if (isset($param['and'])){echo $param['and'] ;}?>" class="largeur-01"/> |
<label style="width:20px;"> et </label> |
<input placeholder="<?=$i18n['valeur-form-date']?>" type="text" id="anf" name="anf" value="<? if (isset($param['anf'])){echo $param['anf'] ;}?>" class="largeur-01"/> |
<label style="width:50px;"> par </label> |
<input placeholder="<?=$i18n['valeur-form-auteur']?>" class="champ_autocomplete" style="width:150px;" id="au" type="text" name="au" value="<? if (isset($param['au'])){ echo $param['au']; } ?>"/> <br/><br/> |
<label> dans </label> |
<input placeholder="<?=$i18n['valeur-form-bib']?>" class="champ_autocomplete largeur-06" id="bib" type="text" name="bib" value="<? if(isset($param['bib'])){echo $param['bib'] ;}?>" "/> |
</fieldset> |
<? if(count($champs_presence) > 0) { ?> |
<fieldset class="presence_form"> |
<legend> Présence </legend> |
<br/> |
<? foreach($champs_presence as $presence) : ?> |
<? $nom_param_presence = $presence['param'] ?> |
<? $param_presence = ''; if (isset($param[$nom_param_presence])){ $param_presence = $param[$nom_param_presence]; }?> |
<label for="<?= $nom_param_presence ?>"><?= $presence['label'] ?></label> |
<select name="<?= $nom_param_presence ?>"> |
<option value="" <?=($param_presence == '') ? 'selected="selected"' : '' ?> > |
</option> |
<option value="0" <?=($param_presence == '0') ? 'selected="selected"' : '' ?> > |
pas d'information |
</option> |
<option value="P" <?=($param_presence == 'P') ? 'selected="selected"' : '' ?> > |
présent |
</option> |
<option value="S" <?=($param_presence == 'S') ? 'selected="selected"' : '' ?> > |
supposé présent |
</option> |
<option value="D" <?=($param_presence == 'D') ? 'selected="selected"' : '' ?>> |
présence douteuse |
</option> |
<option value="E" <?=($param_presence == 'E') ? 'selected="selected"' : '' ?>> |
éteint </option> |
<option value="F" <?=($param_presence == 'F') ? 'selected="selected"' : '' ?>> |
cité par erreur comme présent |
</option> |
<option value="A" <?=($param_presence == 'A') ? 'selected="selected"' : '' ?>> |
absent |
</option> |
<option value="-" <?=($param_presence == '-') ? 'selected="selected"' : '' ?>> |
autre statut de présence |
</option> |
<option value="E-W" <?=($param_presence == 'E-W') ? 'selected="selected"' : '' ?>> |
disparu |
</option> |
<option value="P-B" <?=($param_presence == 'P-B') ? 'selected="selected"' : '' ?>> |
présence accidentelle |
</option> |
<option value="E-F" <?=($param_presence == 'E-F') ? 'selected="selected"' : '' ?>> |
trouvé en fouille |
</option> |
</select> |
<br/> <br/> |
<? endforeach; ?> |
</fieldset> |
<?php } ?> |
<fieldset class="statuts_form"> |
<legend> Statuts </legend> |
<br/> |
<? $sto = ''; if (isset($param['sto'])){ $sto = $param['sto']; }?> |
<label for="sto"> statut d'origine </label> |
<select name="sto"> |
<option value="" <?=($sto == '') ? 'selected="selected"' : '' ?>> |
</option> |
<option value="0" <?=($sto == '0') ? 'selected="selected"' : '' ?>> |
pas d'information |
</option> |
<option value="N" <?=($sto == 'N') ? 'selected="selected"' : '' ?>> |
natif (=indigène) |
</option> |
<option value="S" <?=($sto == 'S') ? 'selected="selected"' : '' ?>> |
supposé natif |
</option> |
<option value="D" <?=($sto == 'D') ? 'selected="selected"' : '' ?>> |
origine douteuse |
</option> |
<option value="E" <?=($sto == 'E') ? 'selected="selected"' : '' ?>> |
anciennement natif (éteint) |
</option> |
<option value="F" <?=($sto == 'F') ? 'selected="selected"' : '' ?>> |
cité par erreur comme natif |
</option> |
<option value="A" <?=($sto == 'A') ? 'selected="selected"' : '' ?>> |
non natif |
</option> |
<option value="X" <?=($sto == 'X') ? 'selected="selected"' : '' ?>> |
inapplicable |
</option> |
<option value="-" <?=($sto == '-') ? 'selected="selected"' : '' ?>> |
autre statut d'origine |
</option> |
<option value="N-E" <?=($sto == 'N-E') ? 'selected="selected"' : '' ?>> |
endémique |
</option> |
<option value="N-S" <?=($sto == 'N-S') ? 'selected="selected"' : '' ?>> |
sub-endémique |
</option> |
<option value="S-C" <?=($sto == 'S-C') ? 'selected="selected"' : '' ?>> |
supposé natif cryptogène |
</option> |
</select> |
<br/> <br/> |
<? $sti = ''; if (isset($param['sti'])){ $sti = $param['sti']; }?> |
<label for="sti"> statut d'introduction </label> |
<select name="sti"> |
<option value="" <?=($sti == '') ? 'selected="selected"' : '' ?>> |
</option> |
<option value="0" <?=($sti == '0') ? 'selected="selected"' : '' ?> > |
pas d'information |
</option> |
<option value="I" <?=($sti == 'I') ? 'selected="selected"' : '' ?>> |
introduit |
</option> |
<option value="S" <?=($sti == 'S') ? 'selected="selected"' : '' ?>> |
supposé introduit |
</option> |
<option value="D" <?=($sti == 'D') ? 'selected="selected"' : '' ?>> |
introduction douteuse |
</option> |
<option value="E" <?=($sti == 'E') ? 'selected="selected"' : '' ?>> |
anciennement introduit (éteint) |
</option> |
<option value="F" <?=($sti == 'F') ? 'selected="selected"' : '' ?>> |
cité par erreur comme introduit |
</option> |
<option value="A" <?=($sti == 'A') ? 'selected="selected"' : '' ?>> |
non introduit |
</option> |
<option value="X" <?=($sti == 'X') ? 'selected="selected"' : '' ?>> |
inapplicable |
</option> |
<option value="-" <?=($sti == '-') ? 'selected="selected"' : '' ?>> |
autre statut d'introduction |
</option> |
<option value="I-J" <?=($sti == 'I-J') ? 'selected="selected"' : '' ?>> |
introduit envahissant |
</option> |
<option value="I-M" <?=($sti == 'I-M') ? 'selected="selected"' : '' ?>> |
domestique, introduit non-établi |
</option> |
<option value="S-C" <?=($sti == 'S-C') ? 'selected="selected"' : '' ?>> |
supposé introduit cryptogène |
</option> |
</select> |
<br/> <br/> |
<label for="stc"> statut de culture </label> |
<? $stc = ''; if (isset($param['stc'])){ $stc = $param['stc']; }?> |
<select name="stc"> |
<option value="" <?=($stc == '') ? 'selected="selected"' : '' ?>> |
</option> |
<option value="0" <?=($stc == '0') ? 'selected="selected"' : '' ?>> |
pas d'information |
</option> |
<option value="C" <?=($stc == 'C') ? 'selected="selected"' : '' ?>> |
cultivé en extérieur |
</option> |
<option value="I" <?=($stc == 'I') ? 'selected="selected"' : '' ?>> |
cultivé en intérieur |
</option> |
<option value="S" <?=($stc == 'S') ? 'selected="selected"' : '' ?>> |
supposé cultivé |
</option> |
<option value="D" <?=($stc == 'D') ? 'selected="selected"' : '' ?>> |
culture douteuse |
</option> |
<option value="E" <?=($stc == 'E') ? 'selected="selected"' : '' ?>> |
anciennement cultivé (éteint) |
</option> |
<option value="F" <?=($stc == 'F') ? 'selected="selected"' : '' ?>> |
cité par erreur comme cultivé |
</option> |
<option value="X" <?=($stc == 'X') ? 'selected="selected"' : '' ?>> |
inapplicable |
</option> |
<option value="-" <?=($stc == '-') ? 'selected="selected"' : '' ?>> |
autre statut de culture |
</option> |
<option value="A" <?=($stc == 'A') ? 'selected="selected"' : '' ?>> |
non cultivé |
</option> |
</select> |
</fieldset> |
<input id="eflore_nomenclature_referentiel" name="referentiel" type="hidden" value="<?=Registre::get('parametres.referentiel')?>" /> |
<input id="eflore_nomenclature_niveau" name="niveau" type="hidden" value="<?=Registre::get('parametres.niveau')?>" /> |
<input id="eflore_nomenclature_module" name="module" type="hidden" value="recherche" /> |
<input id="eflore_nomenclature_action" name="action" type="hidden" value="rechercheAvancee" /> |
<input type="hidden" name="type_nom" value="nom_scientifique" /> |
<input type="submit" class="rech" value="Lancer la recherche avancée"/> |
</form> |
<hr class="nettoyage"/> |
</div> |
<? if (isset($message_av)) : ?> |
<p class="attention"> |
<?= $i18n[$message_av['attention']] ?> |
</p> |
<? endif; ?> |
<!-- FIN FORM_AVANCE --> |
/trunk/modules/recherche_avancee/RechercheAvancee.php |
---|
New file |
0,0 → 1,30 |
<?php |
class RechercheAvancee extends aControleur { |
public function executerFormulaireRechercheAv($donnees= array()) { |
$donnees['lien'] = (isset($donnees['params'])) ? $this->urls->obtenirUrlRechercheAvancee($donnees['params']) |
: $this->urls->obtenirUrlRechercheAvancee(); |
$donnees['i18n'] = I18n::get('Recherche-form-avancee'); |
$donnees['referentiel'] = Registre::get('parametres.referentiel'); |
$donnees['url_base_completion_noms_sci'] = str_replace('{projet}', $donnees['referentiel'], Config::get('nomsTpl')); |
$donnees['champs_presence'] = $this->obtenirChampsPresence(); |
$donnees['url_form'] = $this->urls->obtenirUrlBase(); |
return $this->getVue('form_recherche_av', $donnees); |
} |
private function obtenirChampsPresence() { |
$tableau_champs_presence = array(); |
$referentiel = Registre::get('parametres.referentiel'); |
$champs_presence = Config::get($referentiel.'.champsPresence'); |
$champs_presence_spl = explode('|', $champs_presence); |
foreach($champs_presence_spl as $champ) { |
$label_param_champ = explode(':', $champ); |
if(count($label_param_champ) >= 2) { |
$tableau_champs_presence[] = array('param' => $label_param_champ[1], |
'label' => $label_param_champ[0]); |
} |
} |
return $tableau_champs_presence; |
} |
} |
?> |
/trunk/modules/recherche_simple/squelettes/form_nom.tpl.html |
---|
New file |
0,0 → 1,63 |
<!-- DEBUT FORM_NOM --> |
<script type="text/javascript"> |
<!-- |
var AUTOCOMPLETION_ELEMENTS_NBRE = 50; |
var URL_SERVICE_AUTOCOMPLETION_NOM_SCI = "<?=$url_base_completion_noms_sci?>"; |
var URL_SERVICE_AUTOCOMPLETION_NOM_VERNA = "<?=$url_base_completion_noms_verna?>"; |
var VALEUR_DEFAUT_NOM_SCI = "<?= $i18n['valeur-form-nom-sci']; ?>"; |
var VALEUR_DEFAUT_NOM_VERNA = "<?= $i18n['valeur-form-nom-verna']; ?>"; |
var VALEUR_DEFAUT_AU = "<?=$i18n['valeur-form-auteur']?>"; |
var VALEUR_DEFAUT_BIB = "<?=$i18n['valeur-form-bib']?>"; |
var VALEUR_DEFAUT_DATE = "<?=$i18n['valeur-form-date']?>"; |
var URL_BASE_FICHE_TAXON = "<?=$url_base_fiche_taxon?>"; |
var URL_BASE_POPUP = "<?=Config::get('base_url_application_popup');?>"; |
var REFERENTIEL = "<?= Registre::get('parametres.referentiel');?>"; |
// --> |
</script> |
<form id="ef-form-nomenclature" name="ef-form-nomenclature" action="<?=$url_form;?>" method="get"> |
<fieldset> |
<span class="zone-choix-type-nom"> |
<?php if (isset($nom_verna)) { ?> |
<span class="type-nom"> |
<input id="type_nom_scientifique" name="type_nom" value="nom_scientifique" type="radio" <?=($type_nom == 'nom_scientifique') ? 'checked="checked"': '';?> /> |
<label for="type_nom_scientifique"><?=$i18n['ns'];?></label> |
</span> |
<span class="type-nom"> |
<input id="type_nom_vernaculaire" name="type_nom" value="nom_vernaculaire" type="radio" <?=($type_nom == 'nom_vernaculaire') ? 'checked="checked"': '';?> /> |
<label for="type_nom_vernaculaire" title="(en français, allemand, anglais, catalan, espagnol, italien ou néerlandais)"><?=$i18n['nv'];?></label> |
</span> |
<?php } else {?> |
<input id="type-nom-scientifique" name="type_nom" type="hidden" value="nom_scientifique" /> |
<?=$i18n['ns'];?> |
<?php } ?> |
</span> |
<input id="nom" name="nom" class="champ" size="30" maxlength="255" type="text" <?php if(isset($nom)) echo 'value="'.$nom.'"';?> /> |
<span id="zone-liens-recherche"> |
<input id="eflore_nomenclature_referentiel" name="referentiel" type="hidden" value="<?=Registre::get('parametres.referentiel')?>" /> |
<input id="eflore_nomenclature_niveau" name="niveau" type="hidden" value="<?=Registre::get('parametres.niveau')?>" /> |
<input id="eflore_nomenclature_module" name="module" type="hidden" value="recherche" /> |
<input id="eflore_nomenclature_action" name="action" type="hidden" value="rechercheSimple" /> |
<input id="eflore_nomenclature_submit" name="submit" type="submit" value="<?=$i18n['recherche'];?>" class="ok"/> |
<input id="eflore_nomenclature_fiche" name="acces_fiche" type="submit" value="<?=$i18n['fiche'];?>" /> |
</span> |
</fieldset> |
</form> |
<?php if (isset($message)) : ?> |
<p class="<?= (isset($message['attention'])) ? 'attention' : 'information'; ?>"> |
<?= (isset($message['attention'])) ? $i18n[$message['attention']] : ''; ?> |
<?= (isset($message['nom_ss_corresp'])) ? $message['nom_ss_corresp']['nom'].$i18n['nom_ss_corresp']. |
'<a href="http://referentiels.tela-botanica.org/referentiel/index.php?ref=bdtfx&module=FicheTaxon&num_nom='.$message['nom_ss_corresp']['id'].'">'. |
$i18n['reftax'].'</a>' : ''; ?> |
<?php if (isset($message['nom_approche'])) : ?> |
<?=$i18n['orthographe'];?> |
<?php foreach ($message['nom_approche'] as $cle => $nom) :?> |
<a href="<?=$nom['url_nom_approche']?>"><?=$nom['nom'];?></a> |
<?= (isset($message['nom_approche'][$cle+1]['nom'])) ? ' ou ' : ''; ?> |
<?php endforeach; ?> |
<?php endif; ?> |
</p> |
<?php endif; ?> |
<!-- FIN FORM_NOM --> |
/trunk/modules/recherche_simple/RechercheSimple.php |
---|
New file |
0,0 → 1,40 |
<?php |
class RechercheSimple extends aControleur { |
//+----------------------------------------------------------------------------------------------------------------+ |
// Méthodes |
/** |
* Fonction d'affichage par défaut |
*/ |
public function executerActionParDefaut() { |
$this->afficherMoteurSimple(); |
} |
private function afficherMoteurSimple() { |
$donnees['form_nom'] = $this->executerFormulaireNom(); |
$this->setSortie(self::RENDU_CORPS, $donnees['form_nom']); |
} |
public function executerFormulaireNom($donnees = array()) { |
$donnees['url_base_completion_noms_verna'] = ""; |
if (Config::get(Registre::get('parametres.referentiel').'.referentielVerna')) { |
if (!isset($donnees['type_nom'])) { |
$donnees['type_nom'] = (Registre::get('parametres.niveau') == 1) ? 'nom_vernaculaire' : 'nom_scientifique'; |
} |
$donnees['nom_verna'] = true; |
$donnees['referentielVerna'] = Config::get(Registre::get('parametres.referentiel').'.referentielVerna'); |
$donnees['url_base_completion_noms_verna'] = str_replace('{projet}', $donnees['referentielVerna'], Config::get('nomsVernaTpl')); |
} |
$donnees['referentiel'] = Registre::get('parametres.referentiel'); |
// nécessaire pour une autocomplétion indépendante, pour ne pas avoir à modifier le javascript |
$donnees['url_base_completion_noms_sci'] = str_replace('{projet}', $donnees['referentiel'], Config::get('nomsTpl')); |
$donnees['url_base_fiche_taxon'] = str_replace('&', '&', $this->urls->obtenirUrlFiche('{num_taxon}', 'nom_scientifique')); |
$donnees['url_form'] = $this->urls->obtenirUrlBase(); |
$donnees['i18n'] = I18n::get('Recherche-form-nom'); |
return $this->getVue('form_nom', $donnees); |
} |
} |
?> |
/trunk/eflore_papyrus.php |
---|
New file |
0,0 → 1,95 |
<?php |
// declare(encoding='UTF-8'); |
/** |
* Mon exemple d'application. |
* Fichier contenant les fonctions nécessaire pour l'insertion de l'application dans Papyrus. |
* |
* @category PHP 5.2 |
* @package eflore-consultation |
* @author Jean-Pascal MILCENT <jpm@tela-botanica.org> |
* @author Delphine CAUQUIL <delphine@tela-botanica.org> |
* @copyright 2011 Tela-Botanica |
* @license http://www.gnu.org/licenses/gpl.html Licence GNU-GPL-v3 |
* @license http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL-v2 |
* @version $Id$ |
*/ |
// Gestion des paramêtres passés par Papyrus |
if (isset($GLOBALS['_GEN_commun']['info_application']->referentiel)) { |
$_GET['referentiel'] = $GLOBALS['_GEN_commun']['info_application']->referentiel; |
} |
if (isset($GLOBALS['_GEN_commun']['info_application']->module) && !isset($_GET['module'])) { |
$_GET['module'] = $GLOBALS['_GEN_commun']['info_application']->module; |
} |
/** Inclusion du fichier principal de l'application*/ |
require_once dirname(__FILE__).DIRECTORY_SEPARATOR.'eflore.php'; |
$chemin = '/eflore/consultation/'; |
$chemin_commun = 'http://www.tela-botanica.org/commun/'; |
// Définition des feuilles de style de l'application pour Papyrus |
// TODO: il y a surement mieux à faire pour obtenir l'url des fichiers |
GEN_stockerStyleExterne('jquery-ui', $chemin_commun.'jquery/jquery-ui/1.10.2/css/ui-lightness/jquery-ui-1.10.2.custom.css'); |
GEN_stockerStyleExterne('fancybox', $chemin_commun.'jquery/fancybox/1.3.4/jquery.fancybox-1.3.4.css'); |
GEN_stockerStyleExterne('eflore', $chemin.'/presentations/styles/eflore.css'); |
// OpenSearch dynamique |
$referentiel = 'bdtfx'; |
if (isset($_GET['referentiel'])) $referentiel = $_GET['referentiel']; |
$titreOpenSearch = 'eFlore ' . strtoupper($referentiel) . ' : noms scientifiques'; |
$cheminOpenSearch = Config::get('base_url_application') . 'configurations/RechercheOpenSearch/OpenSearch' . ucfirst($referentiel) . '.xml'; |
GEN_stockerStyleExterne('opensearch-description', $cheminOpenSearch, $titreOpenSearch, 'search', 'application/opensearchdescription+xml', ''); |
// Définition des fichiers JS de l'application pour Papyrus |
GEN_stockerFichierScript('jquery-1.7', $chemin_commun.'jquery/1.7.1'.DS.'jquery-1.7.1.js'); |
GEN_stockerFichierScript('jquery-ui-1.10.2', $chemin_commun.'jquery/jquery-ui/1.10.2/js'.DS.'jquery-ui-1.10.2.custom.min.js'); |
GEN_stockerFichierScript('fancybox', $chemin_commun.'/jquery/fancybox/1.3.4'.DS.'jquery.fancybox-1.3.4.pack.js'); |
GEN_stockerFichierScript('cookie', $chemin_commun.'jquery/cookie/1.0/jquery.cookie.min.js'); |
GEN_stockerFichierScript('eflore-general', $chemin.'presentations/scripts'.DS.'eflore.js'); |
GEN_stockerFichierScript('autocompletion', $chemin.'presentations/scripts'.DS.'recherche.js'); |
GEN_stockerFichierScript('eflore-synthese', $chemin.'presentations/scripts'.DS.'fiche-synthese.js'); |
// +--------------------------------------------------------------------------------------------------+ |
// Remplacement de méta tags fournit par Papyrus par ceux créés dans l'appli |
if (AppControleur::getMetaTitre() != '') { |
$GLOBALS['_PAPYRUS_']['rendu']['TITRE_PAGE'] = AppControleur::getMetaTitre(); |
} |
if (AppControleur::getMetaDescription() != '') { |
GEN_modifierMetaName('description', AppControleur::getMetaDescription()); |
} |
if (AppControleur::getMetaTags() != '') { |
GEN_modifierMetaName('keywords', AppControleur::getMetaTags()); |
} |
// Meta OpenGraph pour les réseaux sociaux |
GEN_modifierMetaProperty('og:title', 'eFlore'); |
GEN_modifierMetaProperty('og:description', 'eFlore, la flore électronique collaborative en ligne'); |
// +--------------------------------------------------------------------------------------------------+ |
// Fonctions d'affichage dans Papyrus |
/** |
* Fonction d'affichage de Papyrus, pour le corps de page. |
*/ |
function afficherContenuCorps() { |
return AppControleur::getContenuCorps(); |
} |
function afficherContenuTete() { |
return AppControleur::getContenuTete(); |
} |
function afficherContenuPied() { |
return AppControleur::getContenuPied(); |
} |
function afficherContenuNavigation() { |
return AppControleur::getContenuNavigation(); |
} |
function afficherContenuMenu() { |
//Retour du menu vide dans le cas de l'affichage dans Papyrus |
// AppControleur::getContenuMenu() |
return ''; |
} |
?> |
/trunk/presentations/images/16px/warning16orange.png |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/trunk/presentations/images/16px/mail16.png |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/trunk/presentations/images/16px/information16.png |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/trunk/presentations/images/16px/cloud16.png |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/trunk/presentations/images/16px/download16.png |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/trunk/presentations/images/infos_image_sauv.png |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/trunk/presentations/images/contact_sauv.png |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/trunk/presentations/images/sauver_sauv.png |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/trunk/presentations/images/mauvaise_idn.png |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/trunk/presentations/images/mauvaise_idr.png |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/trunk/presentations/scripts/fiche-synthese.js |
---|
32,8 → 32,67 |
this.htmlResume; |
this.statique = statique; |
// Les objets Portlet et Onglet que l'ont garde en mémoire pour pouvoir y accéder facilement |
this.portlet = module; |
this.onglet; |
// creerPortlet |
// Créer l'objet Portlet HTML à afficher et le stocker dans les variables de classe |
this.creerPortlet = function() { |
var objet = this; |
var titre = $(module).children('.titre'); |
titre.className = 'titre ui-widget-header ui-corner-all'; |
titre.id = 'titre-' + this.id; |
var contenu = $(module).children('.contenu'); |
contenu.id = 'contenu-' + this.id; |
contenu.className ='contenu'; |
var lienToggle = document.createElement('span'); |
lienToggle.className = 'lienToggle ui-icon ui-icon-minusthick'; |
$(titre).append(lienToggle); |
$(lienToggle).click(function() { |
objet.afficherCacherModule(); |
}); |
this.portlet = module; |
return module; |
} |
this.ongletEstAffiche = function() { |
return $(this.onglet.selector).is(':visible'); |
} |
// Crée l'objet Onglet HTML |
this.creerOnglet = function() { |
var objet = this; |
this.onglet = onglet; |
} |
// Initialisation de l'objet |
this.creerPortlet(); |
this.creerOnglet(); |
// Accesseurs de la classe |
this.getOnglet = function() { |
return this.onglet; |
} |
this.getPortlet = function() { |
return this.portlet; |
} |
// fonctions d'affichage et cachage (je sais pas si on dit ça comme ça) des onglets |
this.afficherCacherModule = function() { |
$(this.portlet).find(".lienToggle").toggleClass("ui-icon-plusthick"); |
$(this.portlet).find(".lienToggle").toggleClass("ui-icon-minusthick"); |
$(this.portlet).find(".titreOnglet").toggleClass("pasDeCurseur"); |
$(this.portlet).find(".contenu").toggle(); |
} |
} |
function getUrlVars() { |
var vars = [], hash; |
var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&'); |
45,7 → 104,62 |
return vars; |
} |
function afficherOngletsPourNiveau() { |
/* affiche les onglets par default selon niveau*/ |
for (indice in tableauOnglets) { |
var ongletEnCours = tableauOnglets[indice]; |
titre_onglet = ongletEnCours.titre; |
titre_onglet = $.trim(titre_onglet); |
if (!Array.indexOf) { |
Array.prototype.indexOf = function (obj, start) { |
for (var i = (start || 0); i < this.length; i++) { |
if (this[i] == obj) { |
return i; |
} |
} |
return -1; |
} |
} |
if (ongletsDefaut.indexOf(titre_onglet) == -1) { |
ongletEnCours.afficherCacherModule(); |
nbOngletsInvisibles++; |
} |
} |
} |
function obtenirOngletCookiePourPage() { |
var urlVars = getUrlVars(); |
var id_cookie = 'onglet_eflore'; |
if (urlVars['num_nom']) { |
id_cookie += '_'+urlVars['num_nom']; |
} |
return $.cookie(id_cookie) ? $.cookie(id_cookie) : null; |
} |
function enregistrerOngletCookiePourPage(valeur) { |
var urlVars = getUrlVars(); |
var id_cookie = 'onglet_eflore'; |
if(urlVars['num_nom'] && urlVars['num_nom'] != undefined) { |
id_cookie += '_'+urlVars['num_nom']; |
} |
$.cookie(id_cookie, valeur); |
} |
function lierModulesEtOnglets() { |
var i = 1; |
//Parcourir la totalité des modules générés et les lier grâce à la classe Module |
$(".module").each(function () { |
i++; |
identifiantOnglet = "#zone_onglets>ul>li:nth-child(" + i +")"; |
var module = new Module(i, this, $(identifiantOnglet)); |
var titre = $(this).children('h3').text(); |
module.titre = titre; |
tableauOnglets[identifiantOnglet] = module; |
}); |
} |
// remplace des liens directs vers les onglets par des liens permettant de ne charger |
// que le contenu de l'onglet (pour le plugin tab) |
function remplacerUrlsOnglets() { |
58,8 → 172,92 |
}); |
} |
ongletsInitialises = false; |
numOngletEnCours = null; |
nePasEmpilerUrl = false; |
popStateOriginal = true; |
function initialiserOnglets() { |
// replacement du chargement de toute la page par un lien vers uniquement le contenu de l'onglet |
// pour le module tab qui charge les url désignée dans les liens des tabs |
//remplacerUrlsOnglets(); |
// analyse de l'onglet désigné comme selectionné par défaut |
// (on peut accéder directement à un onglet précis à travers un param url) |
var tabSelectionneDefaut = $('#onglets li.ui-state-active'); |
var indexTabSelectionneDefaut = $("#onglets li").index($(tabSelectionneDefaut)); |
$('#zone_onglets').tabs({ |
create: function( event, ui ) { |
// par défaut, le contenu déjà chargé est dans une autre zone |
// on le déplace donc comme s'il avait été chargé par le plugin tab |
var contenuZoneFiche = $("#zone_contenu_fiche > div").detach(); |
contenuZoneFiche.appendTo('#ui-tabs-'+(indexTabSelectionneDefaut+1)); |
$("#zone_contenu_fiche").hide(); |
$('#ui-tabs-'+(indexTabSelectionneDefaut+1)).show(); |
ongletNomCode = $('#ui-tabs-'+(indexTabSelectionneDefaut+1)).children(".onglet_contenu").attr("id"); |
$(".lien_retour_synthese").toggle((ongletNomCode != "synthese")); |
}, |
active: indexTabSelectionneDefaut , |
beforeLoad: function( event, ui ) { |
// il est inutile de recharger un onglet déjà chargé (les onglets déjà chargé sont l'onglet par défaut |
// et (lors du chargement de la fiche), l'onglet déjà chargé par php |
// +1 car les tabs sont zéros indexées |
var idPanelCharge = ui.tab.index()+1; |
var panelCharge = $('#ui-tabs-'+idPanelCharge); |
numOngletEnCours = idPanelCharge; |
if(!panelCharge.is(':empty') || indexTabSelectionneDefaut+1 == idPanelCharge) { |
// si le panneau est déjà chargé on peut mettre à jour l'url immédiatement |
var ongletNomCode = panelCharge.children(".onglet_contenu").attr("id"); |
if(!nePasEmpilerUrl) { |
mettreAJourUrl(permalienNumNom+"-"+ongletNomCode, ongletNomCode); |
nePasEmpilerUrl = false; |
} |
$(".lien_retour_synthese").toggle((ongletNomCode != "synthese")); |
panelCharge.show(); |
return false; |
} else { |
// si l'onglet n'est pas chargé alors on affiche le message de chargement |
// pendant que le plugin s'occupe du reste |
fancyboxinitialise = false; |
var panel = $('#ui-tabs-'+idPanelCharge); |
panel.append("<div class='tab-chargement'>Chargement des informations...</div>"); |
return true; |
} |
}, |
load: function(event, ui) { |
// sur les panneaux qui ne sont pas encore chargés, on doit attendre la fin |
// du chargement pour mettre à jour l'url (à cause de la récupération de l'id sur les enfants) |
var ongletNomCode = ui.panel.children(".onglet_contenu").attr("id"); |
// stats |
if (prod) { |
var ga_json = '{"nn": "' + ga_current_nn + '", "nom_sci": "' + ga_current_ns + '"}'; |
ga('eFloreTracker.send', 'event', 'fiche', 'consultation-' + ongletNomCode, ga_json, 1); |
} |
$(".lien_retour_synthese").toggle((ongletNomCode != "synthese")); |
mettreAJourUrl(permalienNumNom+"-"+ongletNomCode, ongletNomCode); |
$(document).trigger('dictionnaireRechercherDefinitions', '#'+ongletNomCode); |
} |
}); |
$(window).bind('popstate', function(event) { |
if(!!event.originalEvent.state) { |
nePasEmpilerUrl = true; |
$("#onglets > li > a[rel='"+event.originalEvent.state+"']").click(); |
} else { |
// chrome fait un popstate au chargement de la page, ce qui la fait recharger |
// indéfiniment, ce comportement étant compréhensible, il vaut mieux s'en prévenir |
if(!popStateOriginal) { |
window.location = window.location.href; |
} |
popStateOriginal = false; |
} |
}); |
} |
//+----------------------------------------------------------------------------------------------------------+ |
// Wikini Flora |
var htmlWikiOriginal = ''; |
340,6 → 538,23 |
}); |
}); |
$(document).one('ongletSyntheseCharge', function() { |
lierModulesEtOnglets(); |
/* mouvement des blocs */ |
$(".colonne").sortable({ |
connectWith: ".colonne", |
handle: $(".module").children('h3') // mouvement seulement sur les titres |
}); |
$('.lien_ouverture_onglet_parent').live('click', function(event) { |
event.preventDefault(); |
$(this).parents(".module").find("a.titreOnglet").click(); |
}); |
gererClicIllustrationsFiche(); |
gererEvenementsPliage(); |
}); |
// À la fin du chargement de l'onglet Illustrations |
$(document).one('ongletIllustrationsCharge', function() { |
483,6 → 698,30 |
return amj[2] + ' ' + mois[parseInt(amj[1]) - 1] + ' ' + amj[0]; |
} |
function redimensionnerOnglets() { |
var largeurTotale = $('#zone_onglets').width(); |
var largeurOnglets = 0; |
var largeurDernierOnglet = 0; |
$('#onglets li').each(function() { |
largeurDernierOnglet = $(this).outerWidth(); |
largeurOnglets += $(this).outerWidth(); |
}); |
var espaceRestant = largeurTotale - largeurOnglets; |
if(espaceRestant < largeurDernierOnglet) { |
var pxALiberer = (largeurDernierOnglet - espaceRestant)/ $('#onglets li').size(); |
$('#onglets li').each(function() { |
$(this).width($(this).width() - (pxALiberer - 4)); |
$(this).css("font-size", "0.9em"); |
}); |
} else { |
$('#onglets li').each(function() { |
$(this).css("width", "auto"); |
$(this).css("font-size", "1em"); |
}); |
} |
} |
// ouvre le popup de galerie lors d'un clic sur l'illustration dans la fiche synthèse |
function gererClicIllustrationsFiche() { |
/trunk/presentations/scripts/recherche.js |
---|
New file |
0,0 → 1,397 |
/**-------------------------- Objets globaux -----------------------------------*/ |
/* |
* Les variables suivantes sont ajoutée automatiquement dans le squelette du moteur de |
* recherche par php, elles sont commentées ici pour qu'elles n'aient pas l'air |
* de sortir de la cuisse de Jupiter |
* |
* var AUTOCOMPLETION_ELEMENTS_NBRE : indique le nombre d'éléments à afficher dans la liste d'autocomplétion. |
* |
* var URL_SERVICE_AUTOCOMPLETION_NOM_SCI : url de base du service de complétion de noms scientifiques |
* pour le projet en cours de consultation. |
* Exemple : http://localhost/service:eflore:0.1/bdtfx/noms?recherche=etendue&retour.format=min&masque=Ace%mo |
* |
* var URL_SERVICE_AUTOCOMPLETION_NOM_VERNA : url de base du service de complétion de noms vernaculaires |
* pour le projet en cours de consultation. |
* Exemple : http://localhost/service:eflore:0.1/nvjfl/noms-vernaculaires?recherche=etendue&retour.format=oss&masque=aca&masque.lg=fra |
* |
* var VALEUR_DEFAUT_NOM_SCI : Contient la valeur par défaut affichée dans le formulaire en mode sci |
* Exemple: Rechercher un nom scientifique |
* |
* var VALEUR_DEFAUT_NOM_VERNA : Contient la valeur par défaut affichée dans le formulaire en mode verna |
* Exemple: Recherche un nom commun |
* |
* var URL_BASE_POPUP : url de base pour les popup contenant du code un peu complexe |
*/ |
var champs_ts = ["#au","#and","#anf","#nom","#bib"]; |
var autocompletionFicheOuverte = false; |
var elementAutocompletionSelectionne = null; |
var nomRechercheEnCours = null; |
$(document).ready(function() { |
initialiserMoteur(); |
}); |
function initialiserMoteur() { |
ajouterAutocompletion(); |
gererAffichageValeursParDefaut(); |
gererAccesFicheFlecheDroite(); |
gererClicIllustrationsResultats(); |
gererAccesFicheBouton(); |
} |
/**------------------- Fonctions de gestion de l'autocompletion ---------------------------------*/ |
function ajouterAutocompletion(){ |
ajouterAutocompletionNoms(); |
$('.champ_autocomplete').each(function(index) { |
ajouterAutocompletionAvancee($(this)); |
}); |
} |
function ajouterAutocompletionAvancee(champs){ |
champs.autocomplete({ |
source: function(requete, add){ |
// la variable de requête doit être vidée car sinon le parametre "term" est ajouté |
requete = ""; |
var id = champs.attr('id'); |
var url = encodeURI(getUrlAutocompletionAvancee(id)); |
$.getJSON(url, requete, function(data) { |
var suggestions = []; |
suggestions = traiterRetourAvance(data,champs); |
add(suggestions); |
}); |
}, |
html: true |
}); |
} |
function ajouterAutocompletionNoms() { |
$('#nom').autocomplete({ |
source: function(requete, add){ |
// la variable de requête doit être vidée car sinon le parametre "term" est ajouté |
requete = ""; |
var url = encodeURI(getUrlAppelCompletion()); |
$.getJSON(url, requete, function(data) { |
var suggestions = []; |
if (nomVernaculaireEstDemande()) { |
suggestions = traiterRetourNomsVerna(data); |
} else if (nomSciEstDemande()) { |
suggestions = traiterRetourNomsSci(data); |
} |
add(suggestions); |
}); |
}, |
search: function(event, ui) { |
nomRechercheEnCours = 'nom_sci'; |
}, |
focus: function(event, ui) { |
elementAutocompletionSelectionne = ui.item; |
}, |
open: function(event, ui) { |
autocompletionFicheOuverte = true; |
var parent = $('.autocompletion_nom.ui-menu-item').parent(); |
parent.width(parent.width() + 10); |
}, |
close: function(event, ui) { |
autocompletionFicheFermee = false; |
nomRechercheEnCours = null; |
}, |
html: true |
}); |
$("#nom").bind("autocompleteselect", function(event, ui) { |
if (ui.item.retenu == true) { |
$("#nom").addClass('ns-retenu'); |
} else { |
$("#nom").removeClass('ns-retenu'); |
} |
}); |
} |
// gére l'acces direct à une fiche par l'appui sur droite |
// dans la liste d'autocompletion des noms scientifiques |
function gererAccesFicheFlecheDroite() { |
$(document).keypress(function(event) { |
// flèche droite |
if(event.keyCode == 39) { |
if(autocompletionFicheOuverte && elementAutocompletionSelectionne != null && nomSciEstDemande()) { |
$('#nom').val(elementAutocompletionSelectionne.value); |
if(elementAutocompletionSelectionne.nn != undefined && elementAutocompletionSelectionne.nn != null) { |
var url_fiche_taxon = URL_BASE_FICHE_TAXON.replace('{num_taxon}',elementAutocompletionSelectionne.nn); |
window.location.href = url_fiche_taxon; |
} |
$('#nom').autocomplete( "disable" ); |
//TODO : ajout d'un message de chargement ? |
} |
} |
if(event.keyCode == 13) { |
if(autocompletionFicheOuverte && elementAutocompletionSelectionne == null && $('#nom').is(":focus")) { |
$('#eflore_nomenclature_submit').click(); |
} |
} |
}); |
} |
function gererAccesFicheBouton() { |
$('#eflore_nomenclature_fiche').click(function(event) { |
if(elementAutocompletionSelectionne != null && nomSciEstDemande()) { |
$('#nom').val(elementAutocompletionSelectionne.value); |
if(elementAutocompletionSelectionne.nn != undefined && elementAutocompletionSelectionne.nn != null) { |
var url_fiche_taxon = URL_BASE_FICHE_TAXON.replace('{num_taxon}',elementAutocompletionSelectionne.nn); |
window.location.href = url_fiche_taxon; |
} |
event.preventDefault(); |
} |
}); |
} |
function traiterRetourNomsSci(data) { |
var suggestions = []; |
if (data.resultat != undefined) { |
$.each(data.resultat, function(i, val) { |
var nom = {label : '', value : '', retenu : false}; |
if (suggestions.length >= AUTOCOMPLETION_ELEMENTS_NBRE) { |
nom.label = "..."; |
nom.value = $('#nom').val(); |
suggestions.push(nom); |
return false; |
} else { |
nom.label = val.nom_sci_complet; |
nom.value = val.nom_sci; |
nom.nn = val.num_nom; |
if(val.retenu != "absent") { |
nom.retenu = (val.retenu == 'true') ? true : false; |
suggestions.push(nom); |
} |
} |
}); |
} |
return suggestions; |
} |
function traiterRetourAvance(data, champs) { |
var suggestions = []; |
if (jQuery.type(data) == "array") { |
$.each(data[1], function(i, val) { |
var ch = {label : '', value : ''}; |
if (suggestions.length >= AUTOCOMPLETION_ELEMENTS_NBRE) { |
ch.label = "..."; |
ch.value = champs.val(); |
suggestions.push(ch); |
return false; |
} else { |
ch.label = val; |
ch.value = val; |
suggestions.push(ch); |
} |
}); |
} |
return suggestions; |
} |
function traiterRetourNomsVerna(data) { |
var suggestions = []; |
if (jQuery.type(data) == "array") { |
$.each(data[1], function(i, val){ |
var nom = {label : '', value : ''}; |
if (suggestions.length >= AUTOCOMPLETION_ELEMENTS_NBRE) { |
nom.label = "..."; |
nom.value = $('#nom').val(); |
suggestions.push(nom); |
return false; |
} else { |
nom.label = val; |
nom.value = val; |
suggestions.push(val); |
} |
}); |
} |
return suggestions; |
} |
/**------------ Fonctions de gestion des urls d'autocompletion et des fiches ------------------*/ |
function getUrlAutocompletionAvancee(parametre) { |
var valeur = getValeurMasque(parametre); |
var ns_str = getValeurNsStructure(parametre); |
var url = URL_SERVICE_AUTOCOMPLETION_NOM_SCI+"?recherche=etendue&"+ |
"navigation.limite="+AUTOCOMPLETION_ELEMENTS_NBRE +'&masque.'+parametre+'='+valeur+ |
'&retour.format=oss&distinct=1&ns.structure='+ns_str; |
return url; |
} |
function getValeurMasque(parametre) { |
var valeur = $('#'+parametre).val(); |
if (parametre == 'au' ){ |
valeur = valeur +',(' + valeur + ')'; |
} else if (parametre == 'bib' ){ |
valeur = valeur +', %; ' + valeur ; |
} |
return valeur; |
} |
function getValeurNsStructure(parametre) { |
var ns = ''; |
if (parametre == 'au' || parametre == 'bib'){ |
ns = parametre +'_ss'; |
} else { |
ns = parametre; |
} |
return ns; |
} |
function getUrlAppelCompletion() { |
var url = ''; |
var mots = $('#nom').val(); |
if (nomSciEstDemande()) { |
url = getUrlAutocompletionNomsSci(mots); |
} else if (nomVernaculaireEstDemande()) { |
mots = mots.replace(' ',' '); |
mots = mots.replace(' ','_'); |
url = getUrlAutocompletionNomsVerna(mots); |
} |
return url; |
} |
function getUrlAutocompletionNomsSci(requete) { |
var url = getUrlAutocompletion(URL_SERVICE_AUTOCOMPLETION_NOM_SCI, requete, 'min')+ |
"&ns.structure=au,an"+ |
// tri "à la mode du CeL" |
"&retour.tri=alpharet"+ |
'&retour.structure=liste'; |
return url; |
} |
function getUrlAutocompletionNomsVerna(requete) { |
var url = getUrlAutocompletion(URL_SERVICE_AUTOCOMPLETION_NOM_VERNA, requete, 'oss'); |
return url; |
} |
function getUrlAutocompletion(baseUrl, requete, format) { |
var url = baseUrl+"?"+ |
"masque="+requete+"&"+ |
"recherche=etendue&"+ |
"retour.format="+format+"&"+ |
"navigation.limite="+AUTOCOMPLETION_ELEMENTS_NBRE; |
return url; |
} |
/**------------ Fonctions de détection de l'état du formulaire ------------------*/ |
function nomSciEstDemande() { |
var boutonRadioNomSci = $('#type_nom_scientifique'); |
return (($('#type_nom_vernaculaire').length <= 0) || (boutonRadioNomSci != null && boutonRadioNomSci.attr("checked") != "undefined" && boutonRadioNomSci.attr("checked") == "checked")); |
} |
function nomVernaculaireEstDemande() { |
var boutonRadioNomSci = $('#type_nom_vernaculaire'); |
return (boutonRadioNomSci.length > 0 && boutonRadioNomSci.attr("checked") != "undefined" && boutonRadioNomSci.attr("checked") == "checked"); |
} |
/**------------ Fonctions de gestion de l'affichage des valeurs par defaut ----------------------*/ |
function gererAffichageValeursParDefaut() { |
$('input[name="type_nom"]').click(function() { |
changerPlaceHolderNom(); |
}); |
changerPlaceHolderNom(); |
$('input').click(function() { |
$(this).attr('placeholder', ''); |
}); |
} |
function changerPlaceHolderNom() { |
if(nomSciEstDemande()) { |
$('#nom').attr('placeholder',VALEUR_DEFAUT_NOM_SCI); |
} else { |
$('#nom').attr('placeholder',VALEUR_DEFAUT_NOM_VERNA); |
} |
} |
/**------------ Fonctions de gestion du zoom sur les images affichées dans les résultats de recherche ----------------------*/ |
function gererClicIllustrationsResultats() { |
$('.illustration_resultat_cel').click(function() { |
var url = $(this).attr('src'); |
var titre = trouverNomTaxon($(this)); |
var url = URL_BASE_POPUP+"?module=popup-galerie&action=fiche&num_nom="+$(this).attr('data-num-nom')+"&titre="+titre+"&referentiel="+REFERENTIEL; |
window.open(url, '', 'directories=no,titlebar=no,toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=no, width='+(700)+', height='+(650)); |
}); |
$('.illustration_resultat_choro').click(function() { |
var url = $(this).attr('src').replace('108x101','432x404'); |
var titre = 'Chorologie du taxon '+trouverNomTaxon($(this)); |
ouvrirFenetreIllustrationResultat(url, titre, 432, 404); |
}); |
$('.illustration_resultat_coste').click(function() { |
var url = $(this).attr('src'); |
var titre = 'Illustration de Coste du taxon '+trouverNomTaxon($(this)); |
ouvrirFenetreIllustrationResultat(url, titre, 400, 400); |
}); |
} |
function trouverNomTaxon(objet) { |
nom = ""; |
if(nomVernaculaireEstDemande()) { |
nom = objet.parent().parent().find('a.lien_fiche_eflore').text(); |
} else { |
nom = objet.parent().find('.nom-sci a.lien_fiche_eflore').text(); |
} |
return nom; |
} |
function ouvrirFenetreIllustrationResultat(url, titre, hauteur, largeur) { |
var fenetre = window.open('_blank', '','directories=no,titlebar=no,toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=no, width='+(largeur+17)+', height='+(hauteur+17)); |
var tmp = fenetre.document; |
tmp.write('<html><head><title>'+titre+'</title>'); |
tmp.write('</head><body>'); |
tmp.write('<p style="height='+hauteur+'px;text-align:center;line-height='+hauteur+'px;"><img id="image_agrandie" height="'+hauteur+'" width="'+largeur+'" style="vertical-align:middle;" src="'+url+'" /></p>'); |
tmp.write('</body></html>'); |
tmp.close(); |
} |
/* |
* jQuery UI Autocomplete HTML Extension |
* |
* Copyright 2010, Scott González (http://scottgonzalez.com) |
* Dual licensed under the MIT or GPL Version 2 licenses. |
* |
* http://github.com/scottgonzalez/jquery-ui-extensions |
* |
* Adaptation par Aurélien Peronnet pour la mise en gras des noms de taxons valides |
*/ |
(function( $ ) { |
var proto = $.ui.autocomplete.prototype, |
initSource = proto._initSource; |
function filter( array, term ) { |
var matcher = new RegExp( $.ui.autocomplete.escapeRegex(term), "i" ); |
return $.grep( array, function(value) { |
return matcher.test( $( "<div>" ).html( value.label || value.value || value ).text() ); |
}); |
} |
$.extend( proto, { |
_initSource: function() { |
if (this.options.html && $.isArray(this.options.source) ) { |
this.source = function( request, response ) { |
response( filter( this.options.source, request.term ) ); |
}; |
} else { |
initSource.call( this ); |
} |
}, |
_renderItem: function( ul, item) { |
if (item.retenu == true) { |
item.label = "<strong>"+item.label+"</strong>"; |
} |
var classe = (nomRechercheEnCours == 'nom_sci' && nomSciEstDemande()) ? 'class="autocompletion_nom"' : ''; |
return $("<li "+classe+"></li>") |
.data("item.autocomplete", item) |
.append( $("<a></a>")[ this.options.html ? "html" : "text" ](item.label)) |
.appendTo(ul); |
} |
}); |
})( jQuery ); |
Property changes: |
Added: svn:executable |
+* |
\ No newline at end of property |