/trunk/modules/resultat/formateurs/nom_vernaculaire/DeterminationVernaFormateur.php |
---|
104,7 → 104,24 |
} |
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() { |
$masqueSansAccent = $this->manipulateurDeChaine->supprimerAccents($this->parametres->masqueRecherche); |
$this->motsASurligner = explode(' ', $masqueSansAccent); |
} |
private function surlignerMotsMasqueRecherche($nom) { |
$this->surligneur->setTexte($nom); |
$nom = $this->surligneur->surlignerMots($this->motsASurligner); |
return $nom; |
} |
} |
?> |
/trunk/modules/resultat/squelettes/determination_verna.tpl.html |
---|
2,43 → 2,62 |
<ul id="ef-resultats-nv-determination"> |
<? foreach ($noms as $nnTaxon => $nom) : ?> |
<li class="zone-resultat"> |
<?php if (isset($imagesUrls[$nnTaxon])) : ?> |
<img src="<?=$imagesUrls[$nnTaxon][0]?>" style="width:100px;height:100px;display:block;float:right;"/> |
<?php endif; ?> |
<?php if (isset($nom['nomVerna'])) : ?> |
<?php $nbrNomVerna = count($nom['nomVerna']) ?> |
<ul class="synonymes" style="width:100%;"> |
<li><span><?=$nom['nomVerna'][0]['nom_vernaculaire']?></span> |
<span class="nom-sci-gauche" > |
<a href="<?=$nom['urlFiche']?>" ><?=$nom['nomSci']?></a> |
</span> |
</li> |
<?php for ($i = 1; ($i < 3); $i++) : ?> |
<?php if (isset($nom['nomVerna'][$i])) : ?> |
<li><?=$nom['nomVerna'][$i]['nom_vernaculaire']?></li> |
<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; ?> |
<? endfor; ?> |
<?php if ($nbrNomVerna > 3) : ?> |
<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; ?> |
<?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 href="<?=$nom['urlFiche']?>" ><?=$nom['nomSci']?></a> |
</td><td > |
<?php if (isset($imagesUrls[$nnTaxon])) : ?> |
<img src="<?=$imagesUrls[$nnTaxon][0]?>" style="width:100px;height:100px;display:block;float:right;"/> |
<?php endif; ?> |
</td></tr> |
</tbody> |
</table> |
</li> |
<? endforeach; ?> |
</ul> |
<?php endif; ?> |
<?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/bibliotheque/Surligneur.php |
---|
1,11 → 1,12 |
<?php |
class Surligneur { |
private $texte = ''; |
private $texteSansAccent = ''; |
private $tags = array(); |
private $nbreSurlignageMaxParMot = 1; |
private $nbreSurlignageCourant = 0; |
public function __construct($texte = null, $surlignageMaxParMot = null) { |
public function __construct($texte = null, $surlignageMaxParMot = null, ChaineManipulateur $manipulateurDeChaine = null) { |
if (is_null($texte) == false) { |
$this->setTexte($texte); |
} |
12,6 → 13,8 |
if (is_null($surlignageMaxParMot) == false) { |
$this->setNbreMaxSurlignageParMot($surlignageMaxParMot); |
} |
$this->manipulateurDeChaine = is_null($manipulateurDeChaine) ? new ChaineManipulateur() : $manipulateurDeChaine; |
} |
public function setTexte($txt) { |
25,6 → 28,7 |
public function surlignerMots($mots) { |
$this->verifierTableauDeMots($mots); |
$this->texte = preg_replace_callback('`<[^>]+>`', array($this, 'sauverTags'), $this->texte); |
$this->texteSansAccent = $this->manipulateurDeChaine->supprimerAccents($this->texte); |
foreach ($mots as $mot) { |
$this->initialiserNbreSurlignageCourant(); |
$this->texte = $this->surlignerMot($mot); |
56,7 → 60,7 |
} |
private function surlignerMot($mot) { |
$positionDebutMot = stripos($this->texte, $mot); |
$positionDebutMot = stripos($this->texteSansAccent, $mot); |
$longueurMot = strlen($mot); |
$surlignage = $this->texte; |
if ($positionDebutMot !== false) { |
77,7 → 81,7 |
$this->tags[$i] = '<span class="surlignage">'.$motTrouve.'</span>'; |
return '<'.$i.'>'; |
} |
private function restaurerTags($match) { |
return $this->tags[$match[1]]; |
} |
/trunk/presentations/styles/eflore.css |
---|
457,7 → 457,22 |
} |
#ef-resultats-determination .synonymes li { |
background: none; |
line-height: 18px; |
list-style: none outside none; |
padding-left: 15px; |
line-height: 18px; |
list-style: none outside none; |
padding-left: 15px; |
} |
#ef-resultats-nv-determination table, table tbody, table td { |
border: none; |
background: none; |
} |
#ef-resultats-nv-determination .nom { |
width: 30%; |
vertical-align: top; |
margin-top: 5px; |
} |
#ef-resultats-nv-determination .nom ul, li{ |
margin: 0; |
margin-bottom: 5px |
} |