Subversion Repositories eFlore/Applications.coel-consultation

Compare Revisions

Ignore whitespace Rev 20 → Rev 21

/trunk/modeles/RechercheDao.php
33,7 → 33,7
*/
public function chercher($parametres) {
$url = $this->construireUrlRecherche('ParDefaut', $parametres);
Debug::printr($url);
$json = file_get_contents($url);
$donnees = json_decode($json, true);
return $donnees;
45,7 → 45,7
$params_a_passer = array('mots', 'sci', 'bot', 'zg', 'p', 'pr');
foreach ($params_a_passer as $param_cle) {
if (isset($parametres[$param_cle]) && $parametres[$param_cle] != '') {
$valeur = urlencode($parametres[$param_cle]);
$valeur = urlencode(trim($parametres[$param_cle]));
$url .= '/'.$valeur;
} else {
$url .= '/*';
/trunk/squelettes/collection.css
45,8 → 45,7
font-family:monospace;
border:1px dotted #1C3C78;
padding:5px;
background-color:#EEEEEE;
width:25%;}
background-color:#EEEEEE;}
td{
font-family:sans-serif;
font-size:80%;
/trunk/squelettes/moteur.tpl.html
4,7 → 4,7
<input name="action" type="hidden" value="<?=$url_action;?>" />
<fieldset>
<legend>Rechercher</legend>
<input name="recherche" type="text" value="<?=$recherche;?>"/>
<input name="recherche" type="text" value="<?=$recherche;?>" size="75" maxlength="250"/>
<input type="submit" value="OK" />
</fieldset>
</form>
11,10 → 11,16
<div>
<h2>Options de recherche</h2>
<p>Par défaut, la recherche est insensible à la casse (majuscule / minuscule) et s'effectue
en intercalant automatiquement le joker % avant, après la chaine recherchée et entre chaque mot de celle-ci.</p>
en intercalant automatiquement le joker % avant et après la chaine recherchée et entre chaque mot de celle-ci.</p>
<p>Le moteur de recherche permet d'utiliser des opérateurs dans le texte recherché pour préciser la requête.</p>
<p>Exemples&nbsp;: mpu, "herbier de Coste", bot:he, Coste bot:he, herbier zg:France, p:coste pr:au.</p>
<table>
<p>Exemples&nbsp;: <a href="<?=sprintf($url_exemple, 'mpu')?>">mpu</a>,
<a href="<?=sprintf($url_exemple, urlencode('"herbier de Coste"'))?>">"herbier de Coste"</a>,
<a href="<?=sprintf($url_exemple, 'bot:he')?>">bot:he</a>,
<a href="<?=sprintf($url_exemple, 'Coste bot:he')?>">Coste bot:he</a>,
<a href="<?=sprintf($url_exemple, 'herbier zg:France')?>">herbier zg:France</a>,
<a href="<?=sprintf($url_exemple, 'p:coste pr:co')?>">p:coste pr:co</a>,
<a href="<?=sprintf($url_exemple, 'Ecole sci:1')?>">Ecole sci:1</a>.</p>
<table>
<thead>
<tr>
<th>Mot-clé</th>
32,7 → 38,7
<td>Limite les résultats aux institutions autorisant la consultation des collections <em>sans (=0)</em> ou
<em>avec (=1)</em> des objectifs de recherches scientifiques.</td>
</td>
<td>sci:0</td>
<td><a href="<?=sprintf($url_exemple, 'sci:0')?>">sci:0</a></td>
</tr>
<tr>
<td>bot:</td>
40,7 → 46,7
AL (Collection en alcool), XY (Xylothèque), PM (Collection de préparations microscopiques).</td>
<td>Type de collection botanique</td>
<td>Limite les résultats aux collections botaniques du type indiqué.</td>
<td>bot:he</td>
<td><a href="<?=sprintf($url_exemple, 'bot:he')?>">bot:he</a></td>
</tr>
<tr>
<td>zg:</td>
47,7 → 53,7
<td>Texte libre</td>
<td>Origine géographique du contenu de la collection</td>
<td>Limite les résultats aux collections dont le contenu correspond à la zone géographique indiquée.</td>
<td>zg:lozère</td>
<td><a href="<?=sprintf($url_exemple, 'zg:lozère')?>">zg:lozère</a></td>
</tr>
<tr>
<td>p:</td>
55,7 → 61,7
<td>Nom ou partie du nom d'une personne.</td>
<td>Limite les résultats aux institutions et collections liées a une personne dont le nom ou une partie du
nom correspond à la valeur indiquée.</td>
<td>p:coste</td>
<td><a href="<?=sprintf($url_exemple, 'p:coste')?>">p:coste</a></td>
</tr>
<tr>
<td>pr:</td>
62,13 → 68,16
<td>CT (Contributeur), AU (Auteur), CO (Collecteur), DE (Déterminateur), HE (Hébergeur - particulier possédant une collection chez lui).
<td>Rôle d'une personne.</td>
<td>Limite les résultats aux institutions et collections liées a une personne dont le rôle correspond à la valeur indiquée.</td>
<td>pr:AU</td>
<td><a href="<?=sprintf($url_exemple, 'pr:AU')?>">pr:AU</a></td>
</tr>
</tbody>
</table>
<p>Pour les opérateurs dont la valeur possible est un <em>texte libre</em>, il est possible d'utiliser des jokers.
Ces "jokers" permettent de modifier la recherche sur une chaine de caractères.</p>
<p>Exemples&nbsp;: mpu, "herbier de Coste", "herbier % Montpellier", p:"Jo_l"</p>
<p>Exemples&nbsp;: <a href="<?=sprintf($url_exemple, urlencode('"herbier de Coste"'))?>">"herbier de Coste"</a>,
<a href="<?=sprintf($url_exemple, urlencode('"herbier % Montpellier"'))?>">"herbier % Montpellier"</a>,
<a href="<?=sprintf($url_exemple, urlencode('p:"Jo_l"'))?>">p:"Jo_l"</a>.
</p>
<table>
<thead>
<tr>
81,17 → 90,17
<tr>
<td>""</td>
<td>Permet de rechercher sur une expression exacte.</td>
<td>"Archives de l'herbier Granger"</td>
<td><a href="<?=sprintf($url_exemple, urlencode('"Archives de l\'herbier Granger"'))?>">"Archives de l'herbier Granger"</a></td>
</tr>
<tr>
<td>%</td>
<td>Remplace n'importe quel nombre de caractères, y compris aucun.</td>
<td>"herbier %Abbé% Carondelet"</td>
<td><a href="<?=sprintf($url_exemple, urlencode('"herbier %Abbé% Carondelet"'))?>">"herbier %Abbé% Carondelet"</a></td>
</tr>
<tr>
<td>_</td>
<td>Remplace exactement un caractère</td>
<td>p:"Jo_l"</td>
<td><a href="<?=sprintf($url_exemple, urlencode('p:"Jo_l"'))?>">p:"Jo_l"</a></td>
</tr>
</tbody>
</table>
/trunk/controleurs/Recherche.php
33,12 → 33,15
$this->memoriserChaineRecherche($chaine);
$donnees['recherche'] = htmlspecialchars(stripslashes($chaine));
// Gestion de l'url
// Gestion des urls
$this->url->setVariableRequete('module', 'Recherche');
$this->url->setVariableRequete('action', 'rechercher');
$donnees['url_form'] = $this->url->getUrl();
$donnees['url_module'] = 'Recherche';
$donnees['url_action'] = 'rechercher';
$this->url->setVariableRequete('recherche', '%s');
$donnees['url_exemple'] = $this->url->getUrl();
$this->url->unsetVariablesRequete(array('module', 'action', 'recherche'));
// Gestion du squelette et de la sortie
$this->setSortie(self::RENDU_TETE, $this->getVue('moteur', $donnees));
89,7 → 92,7
$rechercheDao->setLimitation(($de - 1), $fragmenteur->getDonneesParPage());
$rechercheDao->setDistinction(1);
$resultats = $rechercheDao->chercher($parametres);
Debug::printr($resultats);
// Post-traitement des résultats pour l'affichage
$this->url->setVariableRequete('module', 'Fiche');
foreach ($resultats as $resultat) {
128,7 → 131,6
$chaine = stripslashes($chaine);
$mots = preg_split('/ /i', $chaine, -1, PREG_SPLIT_NO_EMPTY);
Debug::printr($mots);
$parametres = array('mots' => '');
$cle_precedente = null;
foreach ($mots as $mot) {
147,9 → 149,8
}
}
}
Debug::printr($parametres);
$this->remplacerAbreviationParId($parametres);
Debug::printr($parametres);
return $parametres;
}
160,7 → 161,6
foreach ($params_a_remplacer as $param => $id_liste) {
if (isset($parametres[$param])) {
$liste = Ontologie::getListeTrieeParAbreviation($id_liste);
Debug::printr($liste);
$cle = strtoupper($parametres[$param]);
if (isset($liste[$cle])) {
$parametres[$param] = $liste[$cle]['id'];