Subversion Repositories Applications.referentiel

Compare Revisions

Ignore whitespace Rev 294 → Rev 295

/trunk/interfaces/controleurs/AppliControleur.php
192,6 → 192,11
$menu['activite'] = ((preg_match('/^(?:Consultation|Recherche|FicheTaxon)$/', $this->getModulePrincipalCourant())) ? 'actif' : 'inactif');
$menu['title'] = "Interroger la base en cours de travail.";
$donnees['menus'][] = $menu;
$menu['nom'] = 'Arbre';
$menu['url'] = $this->obtenirUrlMenuArbre($referentiel);
$menu['activite'] = (($this->getModulePrincipalCourant() == 'Arbre') ? 'actif' : 'inactif');
$menu['title'] = "Consulter l'aborescence du référentiel";
$donnees['menus'][] = $menu;
$menu['nom'] = 'Tests';
$menu['url'] = $this->obtenirUrlMenuTest($referentiel);
$menu['activite'] = (($this->getModulePrincipalCourant() == 'Test') ? 'actif' : 'inactif securise');
288,6 → 293,10
return $this->obtenirUrlMenu('Consultation', $referentiel);
}
protected function obtenirUrlMenuArbre($referentiel) {
return $this->obtenirUrlMenu('Arbre', $referentiel);
}
private function obtenirUrlMenu($menu, $referentiel = null) {
$this->url->setRequete(false);
$this->url->setVariableRequete('module', $menu);
/trunk/interfaces/controleurs/FicheTaxon.php
61,7 → 61,6
$this->chargerChorologie();
$this->chargerComplements();
}
$this->setSortie(self::RENDU_CORPS, $this->getVue('fiche_taxon', $this->donnees));
}
}
226,7 → 225,7
}
// retourne l'url de la fiche taxon pour les liens
public static function getUrlFicheTaxon($params, $type) {
public static function getUrlFicheTaxon($params, $type = '') {
$taxon = null;
switch ($type) {
case 'bas' :
/trunk/interfaces/controleurs/Arbre.php
New file
0,0 → 1,54
<?php
// declare(encoding='UTF-8');
/**
* Classe Arbre du module Consultation.
* Permet de consultater un référentiel sous forme d'arbre
*
* @package Referentiel
* @category Php5.2
* @author Aurélien PERONNET <aurelien@tela-botanica.org>
* @copyright 2010 Tela-Botanica
* @license http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL
* @license http://www.gnu.org/licenses/gpl.html Licence GNU-GPL
* @version SVN: $Id$
*/
class Arbre extends AppliControleur {
private $referentiel = null;
public function __construct() {
parent::__construct();
// Récupération de paramêtres
if (isset($_GET['ref'])) { // code du projet courrant
$this->referentiel = strtolower($_GET['ref']);
}
}
//+----------------------------------------------------------------------------------------------------------------+
// Méthodes
/**
* Fonction d'affichage par défaut
*/
public function executerActionParDefaut() {
$this->definirCommeModulePrincipal(get_class($this));
$this->construireMenu($this->referentiel);
$this->construireFilAriane($this->referentiel);
$this->executerActionReferentiel('Arbre', 'afficherArbre', $this->referentiel, 20);
}
public function afficherArbre() {
$donnees = array();
$rechercheDao = new RechercheDao();
$parametres = array('mots' => '*',
'ref' => $this->referentiel,
'rg' => 180);
$donnees['resultats'] = $rechercheDao->chercher('ParDefaut', $parametres);
$donnees['url_service_tpl'] = Config::get('url_jrest');
$donnees['url_fiche_taxon_tpl'] = $this->obtenirUrlFicheTaxon($this->referentiel, '%s');
$donnees['referentiel'] = $this->referentiel;
$resultat = $this->getVue('arbre_taxon', $donnees);
$this->setSortie(self::RENDU_CORPS, $resultat);
}
}
?>
/trunk/interfaces/squelettes/arbre_taxon.tpl.html
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>'+
'&nbsp;<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>
&nbsp;<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>
/trunk/interfaces/squelettes/css/referentiel/referentiel.css
541,8 → 541,57
padding-left:5px;
border-left:1px dotted black;}
.imagette-plus {
background: url("images/ouvrir.png") no-repeat scroll 0 0 transparent;
display: inline;
float: left;
height: 15px;
margin-right: 3px;
width: 15px;
}
 
.imagette-moins {
background: url("images/fermer.png") no-repeat scroll 0 0 transparent;
display: inline-block;
height: 15px;
margin-right: 3px;
width: 15px;
}
 
.icone-deplier-arbre {
cursor:pointer;
}
 
.branche-arbre-taxo, .aucun-synonyme {
list-style-type:none;
}
 
.lien-voir-synonymes-taxo, .aucun-sous-taxon, .aucun-synonyme {
font-size: 0.8em;
}
 
.lien-voir-synonymes-taxo , .arbre-liste-synonymes a {
color: #666666;
}
 
#texte li.feuille-arbre-synonyme-taxo {
margin-top: 3px;
}
 
.branche-arbre-taxo {
margin-top: 2px;
border-left: 1px solid;
margin-left: 7px;
margin-top: 2px;
padding-left: 20px;
}
 
#texte .feuille-arbre-taxo {
margin-top: 3px;
}
/* Nécessaire à IE 6 et 7 pour éviter un décalage vers le bas!*/
.ref-onglets{
.ref-onglets {
margin:0;/*Pour IE*/
padding:0;/*Pour IE*/
height:auto !important;height:100%;/*Pour IE*/}
549,4 → 598,4
.droite {
float:right;
}
}