/trunk/metier/api_0.1/Noms.php |
---|
32,5 → 32,24 |
$url = $this->formaterUrl($tpl, $params); |
return $url; |
} |
public function getRechercheEtendue($nom) { |
$url = $this->getUrlRecherche($nom, 'etendue'); |
return $this->chargerDonnees($url); |
} |
public function getRechercheFloue($nom) { |
$url = $this->getUrlRecherche($nom, 'floue'); |
return $this->chargerDonnees($url); |
} |
private function getUrlRecherche($nom, $typeRech) { |
$tpl = Config::get('nomsRechercheTpl'); |
$projet = Registre::get('parametres.referentiel'); |
Debug::printr($projet); |
$params = array('projet' => $projet, 'valeur' => $nom, 'type' => $typeRech); |
$url = $this->formaterUrl($tpl, $params); |
return $url; |
} |
} |
?> |
/trunk/metier/api_0.1/NomsVernaculaires.php |
---|
New file |
0,0 → 1,37 |
<?php |
// declare(encoding='UTF-8'); |
/** |
* Classe gérant les noms scientifiques. |
* |
* @category PHP 5.2 |
* @package eflore-consultation |
* @author Jean-Pascal MILCENT <jpm@tela-botanica.org> |
* @author Delphine CAUQUIL <delphine@tela-botanica.org> |
* @copyright 2011 Tela-Botanica |
* @license http://www.gnu.org/licenses/gpl.html Licence GNU-GPL-v3 |
* @license http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL-v2 |
* @version $Id$ |
*/ |
class NomsVernaculaires extends Eflore { |
public function getRechercheEtendue($nom) { |
$url = $this->getUrlRecherche($nom, 'etendue'); |
return $this->chargerDonnees($url); |
} |
public function getRechercheFloue($nom) { |
$url = $this->getUrlRecherche($nom, 'floue'); |
return $this->chargerDonnees($url); |
} |
private function getUrlRecherche($nom, $typeRech) { |
$tpl = Config::get('nomsVernaRechercheTpl'); |
$projet = Config::get('referentielVerna'); |
Debug::printr($projet); |
$params = array('projet' => $projet, 'valeur' => $nom, 'type' => $typeRech); |
$url = $this->formaterUrl($tpl, $params); |
return $url; |
} |
} |
?> |
/trunk/modules/recherche_simple/RechercheSimple.php |
---|
6,7 → 6,12 |
/** |
* Fonction d'affichage par défaut |
*/ |
public function executerActionParDefaut() { |
if (isset($_GET['referentiel'])) { |
Registre::set('parametres.referentiel', $_GET['referentiel']); |
} |
$this->executerAccueil(); |
} |
33,9 → 38,11 |
if ($_GET['eflore_nom'] == '') { |
$donnees['information'] = 'Veuillez saisir un radical contenant au moins 3 caractères alphabétiques !'; |
} elseif ($_GET['eflore_type_nom'] == 'nom_vernaculaire') { |
$donnees['nom_approche'] = $_GET['eflore_nom'];//$this->getNomVerna(); |
$noms = new NomsVernaculaires(Config::get('referentielVerna')); |
$donnees['nom_approche'] = $this->rechercherNom($noms); |
} else { |
$donnees['nom_approche'] = $_GET['eflore_nom']; |
$noms = new Noms(Registre::get('parametres.referentiel')); |
$donnees['nom_approche'] = $this->rechercherNom($noms); |
} |
if (isset($donnees)) { |
$donnees['eflore_type_nom'] = $_GET['eflore_type_nom']; |
51,5 → 58,22 |
// envoyerResultat; |
} |
} |
public function rechercherNom($noms) { |
$noms_approches = ''; |
$res = $noms->getRechercheEtendue($_GET['eflore_nom']); //print_r($res); |
if ($res == false || $res->entete->total == 0) { |
$res = $noms->getRechercheFloue($_GET['eflore_nom']); |
if (!($res == false || $res->entete->total == 0)) { |
$res = (array) $res->resultat; |
$noms_appr = array_shift($res); //print_r($noms_appr); |
/*foreach ($res->resultat as $id=>$nom) { |
$noms_approches[$id]['nom'] = ($_GET['eflore_type_nom'] == 'nom_vernaculaire') ? $nom->nom : $nom->nom_sci; |
$noms_approches[$id]['url'] = $nom->href; |
}*/ |
} |
} |
return $noms_approches; |
} |
} |
?> |
/trunk/modules/recherche_simple/squelettes/form_nom.tpl.html |
---|
21,6 → 21,7 |
</ul> |
</td> |
<td> |
<input id="referentiel" name="referentiel" type="hidden" value="<?=Registre::get('parametres.referentiel')?>" /> |
<input id="module" name="module" type="hidden" value="recherche-simple" /> |
<input id="action" name="action" type="hidden" value="rechercheNom" /> |
<input id="eflore_nomenclature_submit" type="submit" value="<?=$i18n['recherche'];?>" /> |
31,7 → 32,7 |
</form> |
<?php if (isset($nom_approche)) : ?> |
<p id="efr-ortho-approche"> <span class="erreur"><?=$i18n['orthographe'];?></span><a href="<?=$nom_approche_url;?>"><?=$nom_approche;?></a></p> |
<p id="efr-ortho-approche"> <span class="erreur"><?=$i18n['orthographe'];?></span><a href="<?=$nom_approche_url;?>"><?php print_r($nom_approche);?></a></p> |
<?php endif; ?> |
<?php if (isset($information)) : ?> |
<p id="information"><?=$information?></p> |
/trunk/configurations/config.defaut.ini |
---|
82,4 → 82,7 |
; Paramètres spécifiques à l'API 0.1 d'eFlore |
baseUrlApiEflore = "http://162.38.234.6/{projet}/services/0.1" |
nomsTpl = "{ref:baseUrlApiEflore}/noms" |
nomsStatsInitialesRangTpl = "{ref:nomsTpl}/stats/initiales?masque.rg={rang}" |
nomsStatsInitialesRangTpl = "{ref:nomsTpl}/stats/initiales?masque.rg={rang}" |
nomsRechercheTpl = "{ref:nomsTpl}?masque={valeur}&recherche={type}" |
nomsVernaTpl = "{ref:baseUrlApiEflore}/noms-vernaculaires" |
nomsVernaRechercheTpl = "{ref:nomsVernaTpl}?masque.nv={valeur}&recherche={type}" |