New file |
0,0 → 1,132 |
<!-- REF - DEBUT ARBRE RECHERCHE --> |
<script type="text/javascript"> |
var urlFicheTaxonTpl = '<?= $url_fiche_taxon_tpl; ?>'; |
var urlServiceTpl = '<?= $url_service_tpl; ?>'; |
var referentiel = '<?= $referentiel; ?>'; |
function chargerSousClassification(element) { |
var lienTpl = urlServiceTpl+'Recherche/Classification/'+referentiel+'/*/*/*/*/*/*/*/num_nom/*/*/*/*/*/infra/*'; |
var lien = lienTpl.replace('num_nom', element.attr('rel')); |
var parent = element.parent(); |
$.get(lien, function(data) { |
var html = ""; |
if(data.length > 0) { |
$.each(data, function() { |
var urlFicheTaxon = urlFicheTaxonTpl.replace('%s', this.num_nom); |
var htmlTpl = |
'<ul class="branche-arbre-taxo">'+ |
'<li class="feuille-arbre-taxo">'+ |
'<div rel="'+this.num_nom+'" class="icone-deplier-arbre imagette-plus branche-arbre-fermee" title="Voir les sous taxons"></div>'+ |
'<a title="Voir la fiche de ce taxon" class="lien-ouvrir-fiche-taxo" href="'+urlFicheTaxon+'">'+this.nom_sci+'</a>'+ |
' <a title="Afficher les synynomes de ce taxon" rel="'+this.num_nom+'" class="lien-voir-synonymes-taxo" href="#">(syn)</a>'+ |
'</li>'+ |
'</ul>'; |
html += htmlTpl; |
}); |
} else { |
html = '<ul class="branche-arbre-taxo">'+ |
'<li class="feuille-arbre-taxo aucun-sous-taxon">'+ |
'Aucun sous-taxon'+ |
'</li>'+ |
'</ul>'; |
} |
parent.append(html); |
}); |
} |
|
function afficherSousClassification(element) { |
element.removeClass('branche-arbre-fermee'); |
element.addClass('branche-arbre-ouverte'); |
element.removeClass('imagette-plus'); |
element.addClass('imagette-moins'); |
element.addClass('chargee'); |
element.siblings('.branche-arbre-taxo').show(); |
} |
|
function cacherSousClassification(element) { |
element.addClass('branche-arbre-fermee'); |
element.removeClass('branche-arbre-ouverte'); |
element.addClass('imagette-plus'); |
element.removeClass('imagette-moins'); |
element.siblings('.branche-arbre-taxo').hide(); |
|
} |
|
function chargerSynonymes(element) { |
|
var lienTpl = urlServiceTpl+'Recherche/ParTaxon/'+referentiel+'/*/*/*/*/*/*/*/num_nom/*/*/1/*/*/*/*'; |
var lien = lienTpl.replace('num_nom', element.attr('rel')); |
var parent = element.parent(".feuille-arbre-taxo"); |
$.get(lien, function(data) { |
// Un seul élément reçu = pas de synonymes car on a reçu le nom retenu |
if(data.length > 1) { |
var html = ""; |
$.each(data, function() { |
if(this.num_nom != this.num_nom_retenu) { |
var urlFicheTaxon = urlFicheTaxonTpl.replace('%s', this.num_nom); |
var htmlTpl = |
'<ul class="arbre-liste-synonymes">'+ |
'<li class="feuille-arbre-synonyme-taxo">'+ |
'<a "Voir la fiche de ce taxon" class="lien-ouvrir-fiche-taxo" href="'+urlFicheTaxon+'">'+this.nom_sci+'</a>'+ |
'</li>'+ |
'</ul>'; |
html += htmlTpl; |
} |
}); |
} else { |
var html = '<ul class="arbre-liste-synonymes">'+ |
'<li class="feuille-arbre-synonyme-taxo aucun-synonyme">'+ |
'Aucun synonyme'+ |
'</li>'+ |
'</ul>'; |
} |
element.after(html); |
}); |
} |
|
// Function pour cacher / afficher les options de recherche |
$(document).ready(function() { |
$(".icone-deplier-arbre").live('click', function(event) { |
event.preventDefault(); |
if($(this).hasClass('branche-arbre-fermee')) { |
if(!$(this).hasClass('chargee')) { |
chargerSousClassification($(this)); |
} |
afficherSousClassification($(this)); |
} else { |
cacherSousClassification($(this)); |
} |
}); |
|
$(".lien-voir-synonymes-taxo").live('click', function(event) { |
event.preventDefault(); |
if(!$(this).hasClass('chargee')) { |
chargerSynonymes($(this)); |
$(this).addClass('chargee'); |
} else { |
$(this).siblings('.arbre-liste-synonymes').toggle(); |
} |
}); |
}); |
</script> |
<noscript> |
<hr class="nettoyage" /> |
<div class="attention">Attention, la consultation de l'arborescence du référentiel |
nécessite l'activation de Javascript</div> |
</noscript> |
<hr class="nettoyage" /> |
<div id="ref-arbre-taxo"> |
<ul class="branche-arbre-taxo"> |
<? foreach ($resultats as $resultat) : ?> |
<? if($resultat['num_nom'] == $resultat['num_nom_retenu']) : ?> |
<li class="feuille-arbre-taxo"> |
<?php $url_fiche_taxon = str_replace('%s', $resultat['num_nom'], $url_fiche_taxon_tpl); ?> |
<div rel="<?=$resultat['num_nom']?>" class="icone-deplier-arbre imagette-plus branche-arbre-fermee" title="Voir les sous taxons"></div> |
<a title="Voir la fiche de ce taxon" title="Voir la fiche de ce taxon" class="lien-ouvrir-fiche-taxo" href="<?= $url_fiche_taxon; ?>"> |
<?= $resultat['nom_sci'] ?> |
</a> |
<a rel="<?=$resultat['num_nom']?>" title="Afficher les synynomes de ce taxon" class="lien-voir-synonymes-taxo" href="#">(syn)</a> |
</li> |
<? endif; ?> |
<? endforeach; ?> |
</ul> |
</div> |