/trunk/modules/resultat/formateurs/nom_vernaculaire/DeterminationVernaFormateur.php |
---|
114,8 → 114,7 |
} |
private function definirMotsASurligner() { |
$masqueSansAccent = $this->manipulateurDeChaine->supprimerAccents($this->parametres->masqueRecherche); |
$this->motsASurligner = explode(' ', $masqueSansAccent); |
$this->motsASurligner = explode(' ', $this->parametres->masqueRecherche); |
} |
private function surlignerMotsMasqueRecherche($nom) { |
/trunk/bibliotheque/Surligneur.php |
---|
6,7 → 6,7 |
private $nbreSurlignageMaxParMot = 1; |
private $nbreSurlignageCourant = 0; |
public function __construct($texte = null, $surlignageMaxParMot = null, ChaineManipulateur $manipulateurDeChaine = null) { |
public function __construct($texte = null, $surlignageMaxParMot = null) { |
if (is_null($texte) == false) { |
$this->setTexte($texte); |
} |
13,8 → 13,6 |
if (is_null($surlignageMaxParMot) == false) { |
$this->setNbreMaxSurlignageParMot($surlignageMaxParMot); |
} |
$this->manipulateurDeChaine = is_null($manipulateurDeChaine) ? new ChaineManipulateur() : $manipulateurDeChaine; |
} |
public function setTexte($txt) { |
28,7 → 26,6 |
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); |
60,7 → 57,7 |
} |
private function surlignerMot($mot) { |
$positionDebutMot = stripos($this->texteSansAccent, $mot); |
$positionDebutMot = stripos($this->texte, $mot); |
$longueurMot = strlen($mot); |
$surlignage = $this->texte; |
if ($positionDebutMot !== false) { |
/trunk/tests/modules/RechercheTest.php |
---|
99,29 → 99,6 |
$this->assertEquals('6', count($resultat['resultat'])); |
} |
/*public function testExecuterRechercheSimpleResDecompo() { |
$_GET['type_nom'] = 'nom_scientifique'; |
$_GET['nom'] = 'acer mons'; |
$_GET['resultat'] = 'decompo'; |
$cheminRacine = realpath(dirname(__FILE__).'/../configurations/').'/'; |
Config::charger($cheminRacine.'bdtfx.ini'); |
Registre::set('eFlore.urlBase', new Url(Config::get('base_url_application_index'))); |
Registre::set('parametres.referentiel', 'bdtfx'); |
$recherche = new Recherche(); |
$recherche->initialiser(); |
$recherche->executerRechercheSimple(); |
$donnees = Registre::get('donneesMoteur'); |
$resultat = Registre::get('resultats'); |
$sortie = implode('', $recherche->getSortie()); |
$this->assertEmpty($donnees, print_r($donnees, true)); |
$this->assertNotEmpty($resultat, print_r($resultat, true)); |
$this->assertEquals('6', $resultat['entete']['total']); |
$this->assertEquals('6', count($resultat['resultat'])); |
$this->assertArrayHasKey('auteur', $resultat['resultat']['182']); |
$this->assertNotEmpty($sortie, print_r($sortie, true)); |
$this->assertContains('<input id="nom" name="nom" class="champ" size="30" maxlength="255" type="text" autocomplete="off" value="acer mons" />', $sortie); |
}*/ |
} |
?> |