Subversion Repositories eFlore/Applications.del

Compare Revisions

Ignore whitespace Rev 1794 → Rev 1795

/trunk/services/modules/0.1/Plantnet.php
1,26 → 1,22
<?php
// declare(encoding='UTF-8');
/**
* Description :
* Classe principale de chargement des services d'eFlore.
* Classe principale de chargement des sous-services de Plantnet.
*
* Encodage en entrée : utf8
* Encodage en sortie : utf8
* @package eflore-projets
* @author Jennifer DHÉ <jennifer.dhe@tela-botanica.org>
* @author Delphine CAUQUIL <delphine@tela-botanica.org>
* @author Jean-Pascal MILCENT <jpm@tela-botanica.org>
* @license GPL v3 <http://www.gnu.org/licenses/gpl.txt>
* @license CECILL v2 <http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt>
* @version 0.1
* @copyright 1999-2011 Tela Botanica (accueil@tela-botanica.org)
* @category DEL
* @package Services
* @subpackage Plantnet
* @version 0.1
* @author Mathias CHOUET <mathias@tela-botanica.org>
* @author Samuel DUFOUR-KOWALSKI <samuel.dufour@cirad.fr>
* @author Jean-Pascal MILCENT <jpm@tela-botanica.org>
* @author Aurelien PERONNET <aurelien@tela-botanica.org>
* @license GPL v3 <http://www.gnu.org/licenses/gpl.txt>
* @license CECILL v2 <http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt>
* @copyright 1999-2014 Tela Botanica <accueil@tela-botanica.org>
*/
class PlantNet extends RestService {
 
/*
* url possibles :
* */
private $parametres = array();
private $ressources = array();
private $methode = null;
29,7 → 25,7
private $cheminCourant = null;
 
private $conteneur;
 
/** Indique si oui (true) ou non (false), on veut utiliser les paramètres bruts. */
protected $utilisationParametresBruts = true;
 
47,7 → 43,7
 
 
$this->conteneur = new Conteneur($this->parametres);
 
$this->projetNom = 'plantnet';
$this->serviceNom = 'changements';
 
55,7 → 51,7
$projet = $this->projetNom;
$chemin = Config::get('chemin_configurations')."config_$projet.ini";
Config::charger($chemin);
 
$resultat = $this->initialiserService();
 
$reponseHttp->setResultatService($resultat);
67,19 → 63,19
$corps = $reponseHttp->getCorps();
return $corps;
}
 
 
 
 
 
/*------------------------------------------------------------------------------------------------------------------
CONFIGURATION DU SERVICE
------------------------------------------------------------------------------------------------------------------*/
 
 
 
private function initialiserService() {
 
$classe = $this->obtenirNomClasseService($this->serviceNom);
$chemins = array();
$chemins[] = $this->cheminCourant.$this->projetNom.DS.$classe.'.php';
87,17 → 83,17
$service = null;
foreach ($chemins as $chemin) {
if (file_exists($chemin)) {
 
 
$this->conteneur->chargerConfiguration('config_'.$this->projetNom.'.ini');
require_once $chemin;
 
$service = new $classe($this->conteneur);
$retour = $service->consulter($this->ressources, $this->parametres);
 
}
}
 
if (is_null($service)) {
$message = "Le service demandé '{$this->serviceNom}' n'existe pas dans le projet {$this->projetNom} !";
$code = RestServeur::HTTP_CODE_RESSOURCE_INTROUVABLE;