/branches/v5.3-cordier/metier/api_0.1/Wikini.php |
---|
New file |
0,0 → 1,56 |
<?php |
// declare(encoding='UTF-8'); |
/** |
* Classe gérant les wiki. |
* |
* @category PHP 5.2 |
* @package eflore-consultation |
* @author Aurélien Peronnet <aurelien@tela-botanica.org> |
* @copyright 2012 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 Wikini extends Eflore { |
//TODO: voir s'il est nécessaire d'ajouter des variables de classe pour en faire |
// un service à la structure similaire à celle du service wikipedia |
public function getPageWikiPourRefEtNumTax($referentiel, $numTax) { |
return strtoupper($referentiel).'nt'.$numTax; |
} |
public function getTexteFormate($page, $section) { |
$url = $this->getUrlTexteFormate($page, $section); |
$donnees = $this->chargerDonnees($url); |
return $donnees['texte']; |
} |
private function getUrlTexteFormate($page, $section = null) { |
if ($section != null) { |
$tpl = Config::get('texteFormateSectionWikiTpl'); |
$params = array('pageTag' => $page, 'sectionTitre' => $section); |
} else { |
$tpl = Config::get('texteFormateWikiTpl'); |
$params = array('pageTag' => $page); |
} |
$url = $this->formaterUrl($tpl, $params); |
return $url; |
} |
public function getUrlPageWiki($referentiel, $numTax) { |
$tpl = Config::get('pageWikiTpl'); |
$page = $this->getPageWikiPourRefEtNumTax($referentiel, $numTax); |
$params = array('pageTag' => $page); |
$url = $this->formaterUrl($tpl, $params); |
return $url; |
} |
public function getDescriptionReferentielFormate($referentiel) { |
$tpl = Config::get('texteFormateWikiTpl'); |
$params = array('pageTag' => strtoupper($referentiel).'Description'); |
$url = $this->formaterUrl($tpl, $params); |
$donnees = $this->chargerDonnees($url); |
return $donnees['texte']; |
} |
} |
?> |
/branches/v5.3-cordier/metier/api_0.1/Eflore.php |
---|
New file |
0,0 → 1,165 |
<?php |
// declare(encoding='UTF-8'); |
/** |
* Classe mère de l'API 0.1 d'eFLore. |
* |
* @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$ |
*/ |
abstract class Eflore { |
const RANG_FAMILLE = 180; |
const RANG_GENRE = 220; |
const RANG_ESPECE = 290; |
const API_EFLORE = ''; |
const API_DEL = 'del'; |
const PROTOCOLE_CARACTERES = 1; |
const PROTOCOLE_CAPITALISATION = 3; |
const PROTOCOLE_DEFI = 4; |
const PROTOCOLE_GENTIANE_AZURE = 5; |
private $entete = null; |
private $projet = null; |
private $api = null; |
public function __construct($projet = null) { |
$this->projet = Registre::get('parametres.referentiel'); |
if (!is_null($projet)) { |
$this->projet = $projet; |
} |
$this->api = self::API_EFLORE; |
} |
public function setApi($api) { |
$this->api = $api; |
return $this; |
} |
public function getApi() { |
return $this->api; |
} |
public function setProjet($projet) { |
$this->projet = $projet; |
} |
public function getProjet() { |
return $this->projet; |
} |
public function getEnteteTotal() { |
return $this->entete['total']; |
} |
/** |
* Récupère un squelette d'URL dans le fichier de configuration, en fonction de l'API spécifiée dans $this->api |
* |
* @param string $squelette squelette d'URL à chercher dans le fichier de config, sans le préfixe d'API |
* @param string $api forcer l'API, false par défaut pour utiliser l'API spécifié dans $this->api (utiliser les constantes) |
* @throws Exception si la clef générée n'est pas présente dans le fichier de configuration |
*/ |
protected function obtenirSqueletteSelonApi($squelette) { |
$api = $this->api; |
if ($api != '') { |
$squelette = ucfirst($squelette); |
} |
$clef = $api . $squelette . 'Tpl'; |
if (Config::existe($clef)) { |
return Config::get($clef); |
} else { |
throw new Exception("Squelette indisponible pour l'API spécifiée"); |
} |
} |
/** |
* Formate une url à partir d'un template contenant des paramètres à remplacer sous la forme {monParametre}. |
* Le tableau associatif de paramètres doit contenir en clé le paramêtre (monParametre) sans les accolades, |
* la valeur correspondante sera la valeur de remplacement. |
* Par défaut, les parametres suivant sont pris en compte par cette méthode : |
* - {projet} : le code du référentiel courrant ou définit dans le constructeur de l'objet métier. |
* |
* @param String $tpl le squelette d'url à formater. |
* @param Array $parametres le tableau de parametres (sans accolades pour les clés).*/ |
public function formaterUrl($tpl, Array $parametres) { |
$parametres = $this->ajouterParametreParDefaut($parametres); |
foreach($parametres as $key=> $value) { |
if(is_array($value)) { |
$value = implode(',', $value); |
} |
$tpl = str_replace('{'.$key.'}',rawurlencode($value),$tpl); |
} |
return $tpl; |
} |
public function ajouterParametreParDefaut(Array $parametres) { |
$parametres['projet'] = isset($parametres['projet']) ? $parametres['projet'] : $this->projet; |
return $parametres; |
} |
/** |
* Permet de consulter une url et retourne le résultat ou une erreur |
* |
* @param $url l'url du service à appeler pour charger les données. */ |
protected function chargerDonnees($url) { |
$resultat = false; |
$json = $this->getRestClient()->consulter($url); |
$entete = $this->getRestClient()->getReponseEntetes(); |
//Si le service meta-donnees fonctionne correctement, l'entete comprend la clé wrapper_data |
if (isset($entete['wrapper_data'])) { |
$forceTableauAssociatif = true; |
$resultat = json_decode($json, $forceTableauAssociatif); |
$this->entete = (isset($resultat['entete'])) ? $resultat['entete'] : null; |
} else { |
$m = "L'url <a href=\"$url\">$url</a> lancée via RestClient renvoie une erreur"; |
trigger_error($m, E_USER_WARNING); |
} |
return $resultat; |
} |
/** |
* Permet de consulter une url et retourne le résultat ou une erreur |
* |
* @param $url l'url du service à appeler pour charger les données. */ |
protected function chargerDonneesRecursivement($url) { |
$resultat = false; |
$resultat = $this->chargerDonnees($url); |
if (isset($resultat['entete']['href.suivant'])) { |
$resultatSuivant = $this->chargerDonneesRecursivement($resultat['entete']['href.suivant']); |
if ($resultatSuivant) { |
// utilisation de + obligatoire pour ne pas casser l'indexation par des ids |
// numériques (au lieu de array merge) |
$resultat['resultat'] = $resultat['resultat'] + $resultatSuivant['resultat']; |
} |
} |
return $resultat; |
} |
//+----------------------------------------------------------------------------------------------------------------+ |
// GESTION DES CLASSES CHARGÉES À LA DEMANDE |
private function getRestClient() { |
if (!isset($this->restClient)) { |
$this->restClient = new RestClient(); |
} |
return $this->restClient; |
} |
static function s_formaterUrl($tpl, Array $parametres, $enc = TRUE) { |
foreach($parametres as $key => $value) { |
if(is_array($value)) { |
$value = implode(',', $value); |
} |
$tpl = str_replace('{'.$key.'}',$enc ? rawurlencode($value) : $value, $tpl); |
} |
return $tpl; |
} |
} |
?> |
/branches/v5.3-cordier/metier/api_0.1/Noms.php |
---|
New file |
0,0 → 1,144 |
<?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 Noms extends Eflore { |
public function getSynonymes($nn) { |
$tpl = Config::get('nomsSynonymesTpl'); |
$params = array('id' => $nn); |
$url = $this->formaterUrl($tpl, $params); |
return $this->chargerDonnees($url); |
} |
public function getFlores($nn) { |
$tpl = Config::get('nomsFloresTpl'); |
$params = array('id' => $nn); |
$url = $this->formaterUrl($tpl, $params); |
return $this->chargerDonnees($url); |
} |
public function getNom($nn) { |
return $this->chargerDonnees($this->getUrlNom($nn)); |
} |
public function getRechercheEtendue($nom, $type_resultat = '') { |
$methode = 'getUrlRecherche'.$type_resultat; |
if (method_exists($this, $methode)) { |
$url = $this->$methode($nom, 'etendue'); |
} else { |
$url = $this->getUrlRecherche($nom, 'etendue'); |
Debug::printr("Le type de recherche demandé '$type_resultat' n'est pas disponible."); |
} |
return $this->chargerDonneesRecursivement($url); |
} |
public function getRechercheFloue($nom) { |
$url = $this->getUrlRecherche($nom, 'floue'); |
return $this->chargerDonnees($url); |
} |
public function getRechercheAvancee($parametres) { |
$url = $this->getUrlRechercheAvancee($parametres); |
return $this->chargerDonnees($url); |
} |
private function getUrlRechercheAvancee($parametres){ |
$tpl = Config::get('nomsRechercheAvanceeTpl'); |
$masques = $this->formaterMasquesRechercheAvancee($parametres); |
$url = ''; |
if($masques != ''){ |
$url = $this->formaterUrl($tpl,array('projet'=> $this->getProjet(), 'type' => 'etendue')); |
$url .= '&'.implode('&',$masques); |
} |
return $url; |
} |
private function formaterMasquesRechercheAvancee($parametres) { |
$masques = ''; |
foreach ($parametres as $masque => $valeur){ |
if ($valeur != '' && in_array($valeur, I18n::get('Recherche-form-avancee')) == false){ |
if ($masque == 'type') { |
$masques[] = 'masque='.urlencode('%'.$valeur); |
} elseif ($masque == 'au') { |
$masques[] = 'masque.au='.urlencode($valeur.',('.$valeur.'%),% '.$valeur); |
} elseif ($masque == 'bib'){ |
$masques[] = 'masque.bib='.urlencode($valeur.',%; '.$valeur); |
} else { |
$valeur = ($valeur == '0') ? '' : $valeur; |
$masques[] = 'masque.'.$masque.'='.urlencode($valeur); |
} |
} |
} |
return $masques; |
} |
private function getUrlNom($nn) { |
$tpl = Config::get('nomTpl'); |
$params = array('id' => $nn); |
$url = $this->formaterUrl($tpl, $params); |
return $url; |
} |
// retourne les champs par defaut |
private function getUrlRecherche($nom, $typeRech) { |
$tpl = Config::get('nomsRechercheTpl'); |
$params = array('valeur' => $nom, 'type' => $typeRech); |
$url = $this->formaterUrl($tpl, $params); |
return $url; |
} |
// retourne les champs par defaut |
private function getUrlRechercheAlphab($nom, $typeRech) { |
$tpl = Config::get('nomsRechercheAlphabTpl'); |
$params = array('valeur' => $nom, 'type' => $typeRech); |
$url = $this->formaterUrl($tpl, $params); |
return $url; |
} |
// retourne les champs par defaut |
private function getUrlRechercheRetenu($nom, $typeRech) { |
$tpl = Config::get('nomsRechercheRetenuTpl'); |
$params = array('valeur' => $nom, 'type' => $typeRech); |
$url = $this->formaterUrl($tpl, $params); |
return $url; |
} |
private function getUrlRechercheSynonyme($nom, $typeRech) { |
$tpl = Config::get('nomsRechercheSynonymeTpl'); |
$params = array('valeur' => $nom, 'type' => $typeRech); |
$url = $this->formaterUrl($tpl, $params); |
return $url; |
} |
// retourne les champs par defaut + nom retenu |
private function getUrlRechercheDetermination($nom, $typeRech) { |
$tpl = Config::get('nomsRechercheDeterminationTpl'); |
$params = array('valeur' => $nom, 'type' => $typeRech); |
$url = $this->formaterUrl($tpl, $params); |
return $url; |
} |
// retourne les champs par defaut + nom decompose (au, an et bib) |
private function getUrlRechercheDecompo($nom, $typeRech) { |
$tpl = Config::get('nomsRechercheDecompoTpl'); |
$params = array('valeur' => $nom, 'type' => $typeRech); |
$url = $this->formaterUrl($tpl, $params); |
return $url; |
} |
} |
?> |
/branches/v5.3-cordier/metier/api_0.1/Taxons.php |
---|
New file |
0,0 → 1,136 |
<?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 Taxons extends Eflore { |
public function getTaxon($nn) { |
$url = $this->getUrlTaxon($nn); |
return $this->chargerDonnees($url); |
} |
public function getStatsInitialesFamille() { |
$url = $this->getUrlStatsInitiales(self::RANG_FAMILLE); |
$donnees = $this->chargerDonnees($url); |
if (isset($donnees['Famille'])) { |
$initiales = $donnees['Famille']; |
} elseif (isset($donnees[self::RANG_FAMILLE])) { |
$initiales = $donnees[self::RANG_FAMILLE]; |
} |
return $initiales; |
} |
private function getUrlTaxon($nn) { |
$tpl = Config::get('taxonTpl'); |
$params = array('id' => $nn); |
$url = $this->formaterUrl($tpl, $params); |
return $url; |
} |
public function getStatsInitialesGenre() { |
$url = $this->getUrlStatsInitiales(self::RANG_GENRE); |
$donnees = $this->chargerDonnees($url); |
$initiales = $donnees['Genre']; |
if (isset($donnees['Genre'])) { |
$initiales = $donnees['Genre']; |
} elseif (isset($donnees[self::RANG_GENRE])) { |
$initiales = $donnees[self::RANG_GENRE]; |
} |
return $initiales; |
} |
private function getUrlStatsInitiales($rang) { |
$tpl = Config::get('taxonsStatsInitialesRangTpl'); |
$params = array('rang' => $rang); |
$url = $this->formaterUrl($tpl, $params); |
return $url; |
} |
public function getListeFamilleParInitiale($lettre) { |
$url = $this->getUrlInitiales(self::RANG_FAMILLE, $lettre); |
$donnees = $this->chargerDonneesRecursivement($url); |
$taxons = ($donnees === false) ? $donnees : $donnees['resultat']; |
return $taxons; |
} |
public function getListeGenreParInitiale($lettre) { |
$url = $this->getUrlInitiales(self::RANG_GENRE, $lettre); |
$donnees = $this->chargerDonneesRecursivement($url); |
$taxons = ($donnees === false) ? $donnees : $donnees['resultat']; |
return $taxons; |
} |
private function getUrlInitiales($rang, $lettre) { |
$tpl = Config::get('taxonsListeInitialesRangTpl'); |
$params = array('rang' => $rang, 'initiale' => $lettre); |
$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('taxonsRechercheTpl'); |
$params = array('valeur' => $nom, 'type' => $typeRech); |
$url = $this->formaterUrl($tpl, $params); |
return $url; |
} |
public function getTaxonsInf($num_nom) { |
$url = $this->getUrlTaxonsInf($num_nom); |
return $this->chargerDonnees($url); |
} |
private function getUrlTaxonsInf($num_nom) { |
$tpl = Config::get('taxonInfTpl'); |
$params = array('id' => $num_nom); |
$url = $this->formaterUrl($tpl, $params); |
return $url; |
} |
public function getTaxonsSup($num_nom) { |
$url = $this->getUrlTaxonsSup($num_nom); |
return $this->chargerDonnees($url); |
} |
private function getUrlTaxonsSup($num_nom) { |
$tpl = Config::get('taxonSupTpl'); |
$params = array('id' => $num_nom); |
$url = $this->formaterUrl($tpl, $params); |
return $url; |
} |
public function getUrlPermalienNumNom($referentiel, $version, $num_nom) { |
$tpl = Config::get('permalienNumNomTpl'); |
$params = array('ref_tax' => $referentiel, 'ref_version' => $version, 'id' => $num_nom); |
$url = $this->formaterUrl($tpl, $params); |
return $url; |
} |
public function getUrlPermalienTaxon($referentiel, $version, $num_tax) { |
$tpl = Config::get('permalienTaxonTpl'); |
$params = array('ref_tax' =>$referentiel, 'ref_version' =>$version, 'id' => $num_tax); |
$url = $this->formaterUrl($tpl, $params); |
return $url; |
} |
} |
?> |
/branches/v5.3-cordier/metier/api_0.1/Textes.php |
---|
New file |
0,0 → 1,54 |
<?php |
// declare(encoding='UTF-8'); |
/** |
* Classe gérant les textes. |
* |
* @category PHP 5.2 |
* @package eflore-consultation |
* @author Jean-Pascal MILCENT <jpm@tela-botanica.org> |
* @author Delphine CAUQUIL <delphine@tela-botanica.org> |
* @copyright 2012 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 Textes extends Eflore { |
private $id = ''; |
private $format = 'htm';//Valeurs possibles : htm, txt |
private $sectionTitre = ''; |
public function setId($id) { |
$this->id = $id; |
} |
public function setFormat($format) { |
$this->format = $format; |
} |
public function setSectionTitre($titre) { |
$this->sectionTitre = $titre; |
} |
public function getTexte() { |
if ($this->sectionTitre != '') { |
$tpl = Config::get('texteTitreSectionTpl'); |
$params = array('id' => $this->id, 'txtFormat' => $this->format, 'sectionTitre' => $this->sectionTitre); |
} else { |
$tpl = Config::get('texteTpl'); |
$params = array('id' => $this->id, 'txtFormat' => $this->format); |
} |
return $this->chargerDonnees($this->formaterUrl($tpl, $params)); |
} |
public function getPageUrl() { |
$url = ''; |
if(Config::get($this->getProjet().'LienPageTpl')) { |
$tpl = Config::get($this->getProjet().'LienPageTpl'); |
$params = array('id' => $this->id, 'langue' => 'fr'); |
$url = $this->formaterUrl($tpl, $params); |
} |
return $url; |
} |
} |
?> |
/branches/v5.3-cordier/metier/api_0.1/NomsVernaculaires.php |
---|
New file |
0,0 → 1,68 |
<?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 getRechercheComplete($referentiel, $num_tax) { |
$tpl = Config::get('nomsVernaRechercheCompleteTpl'); |
$params = array('valeur' => $num_tax, 'projet' => $referentiel); |
$url = $this->formaterUrl($tpl, $params); |
return $this->chargerDonnees($url); |
} |
public function getRechercheLimitee($referentiel, $num_tax) { |
$tpl = Config::get('nomsVernaRechercheLimiteeTpl'); |
$params = array('valeur' => $num_tax, 'projet' => $referentiel); |
$url = $this->formaterUrl($tpl, $params); |
return $this->chargerDonnees($url); |
} |
public function getRechercheEtendue($nom, $type_resultat = '') { |
$methode = 'getUrlRecherche'.$type_resultat; |
if (method_exists($this, $methode)) { |
$url = $this->$methode($nom, 'etendue'); |
} else { |
$url = $this->getUrlRecherche($nom, 'etendue'); |
Debug::printr("Le type de recherche demandé '$type_resultat' n'est pas disponible."); |
} |
return $this->chargerDonnees($url); |
} |
public function getRechercheFloue($nom, $type_resultat = '') { |
$url = $this->getUrlRecherche($nom, 'floue'); |
return $this->chargerDonnees($url); |
} |
private function getUrlRecherche($nom, $typeRech) { |
$tpl = Config::get('nomsVernaRechercheTpl'); |
$params = array('valeur' => $nom, 'type' => $typeRech, 'langue' => 'fra'); |
$url = $this->formaterUrl($tpl, $params); |
return $url; |
} |
private function getUrlRechercheDetermination($nom, $typeRech) { |
$tpl = Config::get('nomsVernaRechercheDeterminationTpl'); |
$params = array('valeur' => $nom, 'type' => $typeRech, 'langue' => 'fra'); |
$url = $this->formaterUrl($tpl, $params); |
return $url; |
} |
private function getUrlRechercheAlphab($nom, $typeRech) { |
$tpl = Config::get('nomsVernaRechercheAlphabTpl'); |
$params = array('valeur' => $nom, 'type' => $typeRech); |
$url = $this->formaterUrl($tpl, $params); |
return $url; |
} |
} |
?> |
/branches/v5.3-cordier/metier/api_0.1/Cartes.php |
---|
New file |
0,0 → 1,125 |
<?php |
// declare(encoding='UTF-8'); |
/** |
* Classe gérant les images. |
* |
* @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 Cartes extends Eflore { |
private $id; |
private $largeur; |
public function setId($id) { |
$this->id = $id; |
} |
public function setLargeur($largeur) { |
$this->largeur = $largeur; |
} |
public function setInfoNom($nom) { |
$this->nom = $nom; |
} |
public function setInfoReferentiel($referentiel) { |
$this->referentiel = $referentiel; |
} |
public function getUrlDataSvg() { |
$tpl = Config::get('carteTpl'); |
$params = array('id' => $this->id, 'largeur' => $this->largeur, 'mime-type' => 'image/svg+xml'); |
$url = $this->formaterUrl($tpl, $params); |
return $url; |
} |
public function getUrlPng() { |
$tpl = Config::get('carteTpl'); |
$params = array('id' => $this->id, 'largeur' => $this->largeur, 'mime-type' => 'image/png'); |
$url = $this->formaterUrl($tpl, $params); |
return $url; |
} |
public function getUrlMap() { |
$tpl = Config::get('efloreCarteTpl'); |
$params = array('num_nom' => $this->nom->get('id'), 'num_tax' => $this->nom->get('num_taxonomique') , |
'nom_sci' => $this->nom->get('nom_sci'), 'auteur' => $this->nom->get('auteur') , |
'largeur' => $this->largeur, 'mime_type' => 'text/html'); |
$url = $this->formaterUrl($tpl, $params); |
return $url; |
} |
public function getUrlMapSvg() { |
$tpl = Config::get('carteMoissonnageTpl'); |
$params = array('num_taxon' => $this->nom, 'referentiel' => $this->referentiel, |
'largeur' => $this->largeur, 'mime_type' => 'text/html', 'methode' => 'afficher'); |
$url = $this->formaterUrl($tpl, $params); |
return $url; |
} |
public function getUrlMapPng() { |
$tpl = Config::get('carteMoissonnageTpl'); |
$params = array('num_taxon' => $this->nom, 'referentiel' => $this->referentiel, |
'largeur' => $this->largeur, 'mime_type' => 'image/png', 'methode' => 'afficher'); |
$url = $this->formaterUrl($tpl, $params); |
return $url; |
} |
public function getUrlTelechargementMapPng() { |
$tpl = Config::get('carteMoissonnageTpl'); |
$params = array('num_taxon' => $this->nom, 'referentiel' => $this->referentiel, |
'largeur' => $this->largeur, 'mime_type' => 'image/png', 'methode' => 'telecharger'); |
$url = $this->formaterUrl($tpl, $params); |
return $url; |
} |
public function getUrlTelechargementMapHtml() { |
$tpl = Config::get('carteMoissonnageTpl'); |
$params = array('num_taxon' => $this->nom, 'referentiel' => $this->referentiel, |
'largeur' => $this->largeur, 'mime_type' => 'text/html', 'methode' => 'telecharger'); |
$url = $this->formaterUrl($tpl, $params); |
return $url; |
} |
public function getUrlEflorePng() { |
$tpl = Config::get('efloreCarteTpl'); |
$params = array('num_nom' => $this->nom->get('id'), 'num_tax' => $this->nom->get('num_taxonomique') , |
'nom_sci' => $this->nom->get('nom_sci'), 'auteur' => $this->nom->get('auteur') , |
'largeur' => $this->largeur, 'mime_type' => 'image/png'); |
$url = $this->formaterUrl($tpl, $params); |
return $url; |
} |
public function getLegendeId() { |
$tpl = Config::get('legendeIdCarteTpl'); |
$params = array('id' => $this->id); |
$url = $this->formaterUrl($tpl, $params); |
$donnees = $this->chargerDonnees($url); |
return $donnees; |
} |
public function getLegende() { |
$tpl = Config::get('legendeCarteTpl'); |
$url = $this->formaterUrl($tpl, array()); |
$donnees = $this->chargerDonnees($url); |
return $donnees; |
} |
// version statique de getUrlPng() ci-dessus |
static function getCarteUrlPng($projet, $id, $largeur) { |
return Eflore::s_formaterUrl(Config::get('carteTpl'), |
array('projet' => $projet, |
'id' => $id, |
'largeur' => $largeur, |
'mime-type' => 'image/png')); |
} |
} |
?> |
/branches/v5.3-cordier/metier/api_0.1/MetaDonnees.php |
---|
New file |
0,0 → 1,35 |
<?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 MetaDonnees extends Eflore { |
private $version = '+'; |
public function setVersion($version) { |
$this->version = $version; |
} |
public function getMetaDonnees() { |
$url = $this->getUrlMetaDonnees(); |
// XXX: request ontologies |
return $this->chargerDonnees($url); |
} |
private function getUrlMetaDonnees() { |
$tpl = Config::get('metaDonneesTpl'); |
$params = array('verproj' => 'version.projet', 'version' => $this->version); |
$url = $this->formaterUrl($tpl, $params); |
return $url; |
} |
} |
?> |
/branches/v5.3-cordier/metier/api_0.1/Images.php |
---|
New file |
0,0 → 1,298 |
<?php |
// declare(encoding='UTF-8'); |
/** |
* Classe gérant les images. |
* |
* @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 Images extends Eflore { |
private $nntaxon; |
private $limite; |
private $depart; |
public function setNnTaxon($nntax) { |
$this->nntaxon = $nntax; |
} |
public function setLimite($limite) { |
$this->limite = $limite; |
} |
public function setDepart($depart) { |
$this->depart = $depart; |
} |
//TODO: créer des fonctions spécifiques cel et photoflora pour plus de clarté ? |
public function getUrlsImagesParIdsNoms(Array $idsNoms) { |
$infosImages = $this->getInfosImagesParIdsNoms($idsNoms); |
$urls = array(); |
if (count($infosImages) > 0) { |
foreach ($infosImages as $img) { |
$id = $img['determination.nom_sci.code']; |
$urls[$id][] = $img['binaire.href']; |
} |
} |
return $urls; |
} |
// retourne les urls d'une série d'images tirées de del, avec en premier les |
// images d'organes les mieux votées, et ensuite toute les autres images disponibles |
public function getUrlsImagesOrganesParIdsNom($idNom) { |
$infosImages0 = $this->getInfosMeilleuresImagesParTag($idNom, array('fleur', 'feuille', 'fruit', 'ecorce', 'port', 'rameau'), Eflore::PROTOCOLE_CAPITALISATION, 6); |
$infosImages1 = $this->getInfosImagesParIdsNoms(array($idNom)); |
//echo "ORGANES <pre>" . print_r($infosImages0, true) . "</pre>"; |
//echo "TOUT <pre>" . print_r($infosImages1, true) . "</pre>"; |
$urls = array(); |
foreach ($infosImages0 as $imgs) { |
foreach ($imgs as $img) { |
$id = $img['determination.nom_sci.code']; |
$urls[$id][] = $img['binaire.href']; |
} |
} |
foreach ($infosImages1 as $img) { |
$id = $img['determination.nom_sci.code']; |
if (! in_array($img['binaire.href'], $urls[$id])) { |
$urls[$id][] = $img['binaire.href']; |
} |
} |
//echo "URLS <pre>" . print_r($urls, true) . "</pre>"; |
//exit; |
return $urls; |
} |
public function getInfosImagesParIdsNoms(Array $idsNoms) { |
$pas = 800; |
if(count($idsNoms) >= $pas) { |
$images = array(); |
$idsPartages = array_chunk($idsNoms, $pas); |
foreach ($idsPartages as $sousEnsembleIdsNoms) { |
$url = $this->getUrlImagesParIdsNoms($sousEnsembleIdsNoms); |
$donnees = $this->chargerDonnees($url); |
$resultats = (isset($donnees['resultats'])) ? $donnees['resultats'] : array(); |
$images += $resultats; |
} |
} else { |
$url = $this->getUrlImagesParIdsNoms($idsNoms); |
$donnees = $this->chargerDonnees($url); |
$images = (isset($donnees['resultats'])) ? $donnees['resultats'] : array(); |
} |
return $this->formaterResultatImages($images); |
} |
public function getInfosImageParIdImage($id_image) { |
$tpl = $this->obtenirSqueletteSelonApi('imagesPopup'); |
$url = $this->formaterUrl($tpl, array('id' => $id_image, 'referentiel' => Registre::get('parametres.referentiel'))); |
$image = $this->chargerDonnees($url); |
return $this->formaterResultatImages($image, true); |
} |
public function getInfosImages() { |
$url = $this->getUrlImages(); |
$donnees = $this->chargerDonnees($url); |
$images = (empty($donnees['resultats']) == false) ? $donnees['resultats'] : array(); |
return $this->formaterResultatImages($images); |
} |
public function getInfosImagesTaxons() { |
$pas = 800; |
$idsTaxons = explode(',', $this->nntaxon); |
if(count($idsTaxons) >= $pas) { |
$images = array(); |
$idsPartages = array_chunk($idsTaxons, $pas); |
foreach ($idsPartages as $sousEnsembleIdsTaxons) { |
$url = $this->getUrlImagesTaxons(implode(',',$sousEnsembleIdsTaxons)); |
$donnees = $this->chargerDonnees($url); |
$resultats = (empty($donnees['resultats']) == false) ? $donnees['resultats'] : array(); |
$images += $resultats; |
} |
} else { |
$url = $this->getUrlImagesTaxons($idsTaxons); |
$donnees = $this->chargerDonnees($url); |
$images = (isset($donnees['resultats'])) ? $donnees['resultats'] : array(); |
} |
return $this->formaterResultatImages($images); |
} |
public function getInfosPremiereImageParIdsNoms($idsNoms) { |
$url = $this->getUrlPremiereImageParIdsNoms($idsNoms); |
$donnees = $this->chargerDonnees($url); |
$images = (isset($donnees['resultats'])) ? $donnees['resultats'] : array(); |
return $this->formaterResultatImages($images); |
} |
public function getInfosImagesGalerieMobile($nn) { |
$url = $this->getUrlImagesGalerieMobile($nn); |
$donnees = $this->chargerDonnees($url); |
$images = (isset($donnees['resultats'])) ? $donnees['resultats'] : array(); |
return $images; |
} |
/** |
* Retourne les $limite images ayant le plus de votes pour CHAQUE tag de $tags pour le protocole $protocole |
*/ |
public function getInfosMeilleuresImagesParTag($nn, $tags, $protocole = Eflore::PROTOCOLE_CAPITALISATION, $limite = 10, $format = 'CRS') { |
if (! is_array($tags)) { |
$tags = array($tags); |
} |
$images_tag = array(); |
foreach ($tags as $tag) { |
$url = $this->getUrlMeilleuresImagesParTag($nn, $tag, $protocole, $limite, $format); |
$donnees = $this->chargerDonnees($url); |
$images = (isset($donnees['resultats'])) ? $donnees['resultats'] : array(); |
$images_tag[$tag] = $this->formaterResultatImagesDel($images); |
} |
return $images_tag; |
} |
/** |
* Retourne l'image ayant le plus de votes pour le pour capitalisation d'images, pour le premier tags de $tags. S'il |
* n'y a aucune image pour le premier tag, parcourt les autres tags jusqu'à en trouver une. |
*/ |
public function getInfosMeilleureImageParPrioriteTags($nn, $tags, $format = 'CRS') { |
if (! is_array($tags)) { |
$tags = array($tags); |
} |
$image = null; |
foreach ($tags as $tag) { |
$url = $this->getUrlMeilleuresImagesParTag($nn, $tag, Eflore::PROTOCOLE_CAPITALISATION, 1, $format); |
$donnees = $this->chargerDonnees($url); |
$image = (isset($donnees['resultats'])) ? $donnees['resultats'] : array(); |
$image = $this->formaterResultatImagesDel($image); |
if (empty($image) == false) { |
break; |
} |
} |
//echo "<pre>" . print_r($image, true) . "</pre>"; |
if (is_array($image)) { |
$image = array_pop($image); |
} |
return $image; |
} |
private function getUrlImagesParIdsNoms($idsNoms) { |
$tpl = $this->obtenirSqueletteSelonApi('imagesResultatsDetermination'); |
$params = array('idsNoms' => implode(',', $idsNoms), 'referentiel' => Registre::get('parametres.referentiel')); |
$url = $this->formaterUrl($tpl, $params); |
return $url; |
} |
public function getUrlPremiereImageParIdsNoms($idsNoms) { |
$tpl = $this->obtenirSqueletteSelonApi('imagesPremiere'); |
$params = array('idsNoms' => implode(',', $idsNoms), 'referentiel' => Registre::get('parametres.referentiel')); |
return $this->formaterUrl($tpl, $params); |
} |
private function getUrlImages($nn = false) { |
$tpl = $this->obtenirSqueletteSelonApi('images'); |
if ($this->getApi() == Eflore::API_EFLORE) { |
$params = array('projet' => $this->getProjet(), 'limite' => $this->limite, 'depart' => $this->depart, 'referentiel' => Registre::get('parametres.referentiel')); |
} |
$url = $this->formaterUrl($tpl, $params); |
return $url; |
} |
private function getUrlImagesTaxons($idsTaxons) { |
$tpl = $this->obtenirSqueletteSelonApi('imagesTaxons'); |
$params = array('projet' => $this->getProjet(),'nntaxon'=> $idsTaxons, 'referentiel' => Registre::get('parametres.referentiel')); |
$url = $this->formaterUrl($tpl, $params); |
return $url; |
} |
private function getUrlImagesGalerieMobile($nn) { |
$tpl = Config::get('delGalerieMobileTpl'); |
$params = array('nn' => $nn); |
$url = $this->formaterUrl($tpl, $params); |
return $url; |
} |
private function getUrlMeilleuresImagesParTag($nn, $tag, $protocole = Eflore::PROTOCOLE_CAPITALISATION, $limite = 10, $format = 'CRS') { |
$tpl = Config::get('delMeilleuresImagesParTagTpl'); |
$params = array('nn'=> $nn, |
'tag'=> $tag, |
'protocole' => $protocole, |
'referentiel' => Registre::get('parametres.referentiel'), |
'limite' => $limite, |
'format' => $format); |
$url = $this->formaterUrl($tpl, $params); |
return $url; |
} |
/** |
* Transforme les résultats issus des Webservices autres que eflore/cel afin de conserver un format homogène |
* @param mixed $images |
*/ |
private function formaterResultatImages($images, $seulementUne = false) { |
switch ($this->getApi()) { |
case Eflore::API_DEL: |
return $this->formaterResultatImagesDel($images, $seulementUne); |
break; |
default: |
return $images; |
} |
} |
private function formaterResultatImagesDel($images, $seulementUne = false) { |
if ($seulementUne) { |
return $this->formaterUnResultatImagesDel($images); |
} else { |
$retour = array(); |
foreach ($images as $idObsImage => $image) { |
$retour[$image['id_image']] = array_merge($images[$idObsImage], $this->formaterUnResultatImagesDel($image)); |
} |
return $retour; |
} |
} |
/** |
* Convertit un array venant d'un Webservice del vers le format retourné par eflore/cel |
* @param array $image |
* @return array |
*/ |
private function formaterUnResultatImagesDel(array $image) { |
$libelleAuteur = $image['observation']['auteur.prenom'].' '.$image['observation']['auteur.nom']; |
$codeReferentiel = substr($image['observation']['determination.referentiel'], 0, strpos($image['observation']['determination.referentiel'], ':')); |
$localiteLibelle = array($image['observation']['zone_geo'], |
$image['observation']['lieudit'], |
$image['observation']['station'], |
$image['observation']['milieu']); |
$retourImage = array( |
'date' => $image['observation']['date_observation'], |
'mime' => 'image/jpeg', |
'auteur.libelle' => $libelleAuteur, |
'auteur.id' => $image['observation']['auteur.id'], |
'binaire.href' => $image['binaire.href'], |
'observation.id' => $image['observation']['id_observation'], |
'determination.libelle' => $image['observation']['determination.ns'].'[Dét. : '.$libelleAuteur.']', |
'determination.nom_sci' => $image['observation']['determination.ns'], |
'determination.nom_sci.code' => $codeReferentiel.'.'.$image['observation']['determination.nn'], |
'station.commune' => $image['observation']['zone_geo'], |
'station.lieudit' => $image['observation']['lieudit'], |
'station.station' => $image['observation']['station'], |
'station.milieu' => $image['observation']['milieu'], |
'station.libelle' => $this->formaterLocalite($localiteLibelle) |
); |
return $retourImage; |
} |
private function formaterLocalite($infosLocalite) { |
$localiteFmt = array(); |
foreach ($infosLocalite as $localite) { |
if($localite != '') { |
$localiteFmt[] = $localite; |
} |
} |
if (empty($localiteFmt)) { |
$localiteFmt[0] = 'localité inconnue'; |
} |
return implode(" > ", $localiteFmt); |
} |
} |
?> |
/branches/v5.3-cordier/metier/api_0.1/BiblioBota.php |
---|
New file |
0,0 → 1,29 |
<?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 BiblioBota extends Eflore { |
public function getReferences($nomSelectionne) { |
$url = $this->getUrlReferences($nomSelectionne); |
return $this->chargerDonnees($url); |
} |
private function getUrlReferences($nomSelectionne) { |
$tpl = Config::get('referencesBiblioBota'); |
$params = array('nom_saisi' => $nomSelectionne); |
$url = $this->formaterUrl($tpl, $params); |
return $url; |
} |
} |
?> |
/branches/v5.3-cordier/metier/api_0.1/Syntaxons.php |
---|
New file |
0,0 → 1,59 |
<?php |
// declare(encoding='UTF-8'); |
/** |
* Classe gérant les syntaxons |
* |
* @category PHP 5.2 |
* @package eflore-consultation |
* @author Mathilde SALTHUN-LASSALLE <mathilde@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 Syntaxons extends Eflore { |
private $catminat; |
public function setCatminat($code) { |
$this->catminat = 'catminat:'.$code; |
} |
public function getSyntaxonsSuperieurs() { |
$url = $this->getUrlSyntaxonsSuperieurs(); |
return $this->chargerDonnees($url); |
} |
public function getSyntaxonsCatminat() { |
$url = $this->getUrlSyntaxonsCatminat(); |
return $this->chargerDonnees($url); |
} |
public function getSyntaxonsSynonymes() { |
$url = $this->getUrlSyntaxonsSynonymes(); |
return $this->chargerDonnees($url); |
} |
public function getUrlSyntaxonsCatminat() { |
$tpl = Config::get('syntaxonsCatminat'); |
$params = array( 'code' => urlencode($this->catminat)); |
$url = $this->formaterUrl($tpl, $params); |
return $url; |
} |
public function getUrlSyntaxonsSuperieurs() { |
$tpl = Config::get('syntaxonsSuperieurs'); |
$params = array( 'code' => $this->catminat); |
$url = $this->formaterUrl($tpl, $params); |
return $url; |
} |
public function getUrlSyntaxonsSynonymes() { |
$tpl = Config::get('syntaxonsSynonymes'); |
$params = array( 'code' => $this->catminat); |
$url = $this->formaterUrl($tpl, $params); |
return $url; |
} |
} |
?> |
/branches/v5.3-cordier/metier/api_0.1/Statuts.php |
---|
New file |
0,0 → 1,24 |
<?php |
class Statuts extends Eflore { |
public function getStatuts($projet, $nn) { |
$tpl = Config::get('statutsTpl'); |
$params = array('projet' => $projet,'id' => $nn); |
$url = $this->formaterUrl($tpl, $params); |
return $this->chargerDonnees($url); |
} |
public function getStatutsZoneGeo($projet, $nn) { |
$tpl = Config::get('statutsZoneGeoTpl'); |
$params = array('projet' => $projet,'id' => $nn); |
$url = $this->formaterUrl($tpl, $params); |
return $this->chargerDonnees($url); |
} |
public function getCategorieListeRouge($projet, $nn) { |
$tpl = Config::get('listeRougeTpl'); |
$params = array('projet' => $projet,'id' => $nn); |
$url = $this->formaterUrl($tpl, $params); |
return $this->chargerDonnees($url); |
} |
} |
/branches/v5.3-cordier/metier/api_0.1/Graphiques.php |
---|
New file |
0,0 → 1,99 |
<?php |
// declare(encoding='UTF-8'); |
/** |
* Classe gérant les graphiques et leurs légendes. |
* |
* @category PHP 5.2 |
* @package eflore-consultation |
* @author Mathilde SALTHUN-LASSALLE <mathilde@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 Graphiques extends Eflore { |
private $bdnt; |
private $num_nom; |
private $type_graph; |
private $classe; |
private $code; |
// pour chaque code, [0] est le min (départ de recherche des valeurs) |
// et [1] est le max (fin) |
static $codes = array ("VEL" => array(1,9), |
"VET" => array(1,9), |
"VEHA" => array(1,9), |
"VEC" => array(1,9), |
"VER" => array(1,9), |
"VETX" => array(1,9), |
"VEN" => array(1,9), |
"VEMO" => array(1,9), |
"VEHE" => array(1,12), |
"VES" => array(0,9) ); |
public function setType_graph($tg) { |
$this->type_graph = $tg; |
} |
public function setCode($code) { |
$this->code = $code; |
} |
public function setClasse($classe) { |
$this->classe = $classe; |
} |
public function setBdnt($bdnt){ |
$this->bdnt = $bdnt; |
} |
public function setNum_nom($nn){ |
$this->num_nom = $nn; |
} |
// TODO: array_map() // XXX: PHP-5.3 |
static function _build_range() { |
$ret = array(); |
foreach (self::$codes as $classe => $val) { |
foreach(range($val[0], $val[1]) as $i) { |
$ret[] = $classe . ':' . $i; |
} |
} |
return implode(',', $ret); |
} |
// TODO: array_map() // XXX: PHP-5.3 |
static function _split_data($tab) { |
$ret = array(); |
foreach ($tab as $k => $v) { |
list($new_k, $sub_k) = explode(':', $k); |
$ret[$new_k][$sub_k] = $v; |
} |
return $ret; |
} |
public function getLegendeGraphique() { |
$legende = array(); |
// eg: VEL:1,VEL:2,VEL:3,...VER:9,VETX:1,... |
$ressources = self::_build_range(); |
$url = Eflore::s_formaterUrl(Config::get('legendeGraphiqueTpl'), |
$this->ajouterParametreParDefaut(array('params' => $ressources)), |
FALSE); |
$data = $this->chargerDonnees($url); |
return self::_split_data($data); |
} |
public function getGraphique() { |
$url = $this->getUrlInformation(); |
return $this->chargerDonnees($url); |
} |
public function getUrlGraphique() { |
$tpl = Config::get('graphiqueTpl'); |
$params = array( 'bdnt' => $this->bdnt, 'num_nom' => $this->num_nom , 'type_graph' => $this->type_graph); |
$url = $this->formaterUrl($tpl, $params); |
return $url; |
} |
} |
?> |
/branches/v5.3-cordier/metier/api_0.1/Informations.php |
---|
New file |
0,0 → 1,91 |
<?php |
/** |
* |
* classe gérant des informations (descriptives, écologiques ) |
* |
* @author mathilde SALTHUN-LASSALLE <mathilde@tela-botanica.org> |
* |
*/ |
class Informations extends Eflore { |
private $bdnt; |
private $num_nom; |
private $limite; |
private $depart; |
private $catminat; |
public function setDepart($depart){ |
$this->depart = $depart; |
} |
public function setLimite($limite){ |
$this->limite = $limite; |
} |
public function setBdnt($bdnt){ |
$this->bdnt = $bdnt; |
} |
public function setNum_nom($nn){ |
$this->num_nom = $nn; |
} |
public function setCatminat($catminat){ |
$this->catminat = $catminat; |
} |
public function getInformations() { |
$url = $this->getUrlInformation(); |
return $this->chargerDonnees($url); |
} |
public function getInformationsEcologie() { |
$url = $this->getUrlInformation(); |
$url .= '?categorie=ecologie'; |
return $this->chargerDonnees($url); |
} |
public function getInformationsDescription() { |
$url = $this->getUrlInformation(); |
$url .= '?categorie=description'; |
return $this->chargerDonnees($url); |
} |
public function getInformationsRelationCatminat() { |
$url = $this->getUrlInformationsRelationCatminat(); |
return $this->chargerDonnees($url); |
} |
public function getInformationsMasqueCatminat() { |
$url = $this->getUrlInformationsMasqueCatminat(); |
return $this->chargerDonnees($url); |
} |
public function getUrlInformation() { |
$tpl = Config::get('informationTpl'); |
$params = array( 'bdnt' => $this->bdnt, 'num_nom' => $this->num_nom ); |
$url = $this->formaterUrl($tpl, $params); |
return $url; |
} |
public function getUrlInformationsRelationCatminat() { |
$tpl = Config::get('informationsRelationCatminat'); |
$params = array( 'bdnt' => $this->bdnt, 'num_nom' => $this->num_nom, 'limite' => $this->limite, 'depart' => $this->depart ); |
$url = $this->formaterUrl($tpl, $params); |
return $url; |
} |
public function getUrlInformationsMasqueCatminat() { |
$tpl = Config::get('informationsCatminat'); |
$params = array( 'catminat' => $this->catminat, 'limite' => $this->limite, 'depart' => $this->depart ); |
$url = $this->formaterUrl($tpl, $params); |
return $url; |
} |
} |