Subversion Repositories eFlore/Applications.del

Rev

Rev 943 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 943 Rev 1795
Line 1... Line 1...
1
<?php
1
<?php
-
 
2
// declare(encoding='UTF-8');
2
/**
3
/**
3
* Description :
-
 
4
* Classe principale de chargement des services d'eFlore.
4
 * Classe principale de chargement des sous-services Noms et Taxons utilisés par DEL.
5
*
5
 *
6
* Encodage en entrée : utf8
6
 * @category   DEL
7
* Encodage en sortie : utf8
7
 * @package    Services
8
* @package eflore-projets
8
 * @subpackage NomsTaxons
-
 
9
 * @version    0.1
9
* @author Jennifer DHÉ <jennifer.dhe@tela-botanica.org>
10
 * @author     Mathias CHOUET <mathias@tela-botanica.org>
10
* @author Delphine CAUQUIL <delphine@tela-botanica.org>
11
 * @author     Jean-Pascal MILCENT <jpm@tela-botanica.org>
11
* @author Jean-Pascal MILCENT <jpm@tela-botanica.org>
12
 * @author     Aurelien PERONNET <aurelien@tela-botanica.org>
12
* @license GPL v3 <http://www.gnu.org/licenses/gpl.txt>
13
 * @license    GPL v3 <http://www.gnu.org/licenses/gpl.txt>
13
* @license CECILL v2 <http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt>
14
 * @license    CECILL v2 <http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt>
14
* @version 0.1
-
 
15
* @copyright 1999-2011 Tela Botanica (accueil@tela-botanica.org)
15
 * @copyright  1999-2014 Tela Botanica <accueil@tela-botanica.org>
16
*/
16
 */
17
class Nomstaxons extends RestService {
17
class Nomstaxons extends RestService {
Line 18... Line 18...
18
 
18
 
19
	
19
 
20
	private $parametres = array();
20
	private $parametres = array();
21
	private $ressources = array();
21
	private $ressources = array();
22
	private $methode = null;
22
	private $methode = null;
23
	private $projetNom = array();
23
	private $projetNom = array();
24
	private $serviceNom = array();
24
	private $serviceNom = array();
Line 25... Line 25...
25
	private $cheminCourant = null;
25
	private $cheminCourant = null;
26
 
26
 
27
	private $conteneur;
27
	private $conteneur;
28
	
28
 
Line 29... Line 29...
29
	/** Indique si oui (true) ou non (false), on veut utiliser les paramètres bruts. */
29
	/** Indique si oui (true) ou non (false), on veut utiliser les paramètres bruts. */
30
	protected $utilisationParametresBruts = true;
30
	protected $utilisationParametresBruts = true;
Line 47... Line 47...
47
		}
47
		}
48
		$reponseHttp->emettreLesEntetes();
48
		$reponseHttp->emettreLesEntetes();
49
		$corps = $reponseHttp->getCorps();
49
		$corps = $reponseHttp->getCorps();
50
		return $corps;
50
		return $corps;
51
	}
51
	}
52
	
52
 
53
	private function initialiserRessourcesEtParametres($ressources, $parametres) {
53
	private function initialiserRessourcesEtParametres($ressources, $parametres) {
54
		$this->ressources = $ressources;
54
		$this->ressources = $ressources;
55
		$this->parametres = $parametres;
55
		$this->parametres = $parametres;
56
	}
56
	}
Line 79... Line 79...
79
	/*------------------------------------------------------------------------------------------------------------------
79
	/*------------------------------------------------------------------------------------------------------------------
80
								CONFIGURATION DU SERVICE
80
								CONFIGURATION DU SERVICE
81
	------------------------------------------------------------------------------------------------------------------*/
81
	------------------------------------------------------------------------------------------------------------------*/
82
	private function initialiserService() {
82
	private function initialiserService() {
83
		$this->chargerNomService();
83
		$this->chargerNomService();
84
				
84
 
85
		$classe = $this->obtenirNomClasseService($this->serviceNom);
85
		$classe = $this->obtenirNomClasseService($this->serviceNom);
86
		$chemins = array();
86
		$chemins = array();
87
		$chemins[] = $this->cheminCourant.$this->projetNom.DS.$classe.'.php';
87
		$chemins[] = $this->cheminCourant.$this->projetNom.DS.$classe.'.php';
88
		$chemins[] = $this->cheminCourant.'commun'.DS.$classe.'.php';
88
		$chemins[] = $this->cheminCourant.'commun'.DS.$classe.'.php';
89
		$retour = '';
89
		$retour = '';
Line 98... Line 98...
98
				} else {
98
				} else {
99
					//TODO : throw exception
99
					//TODO : throw exception
100
				}
100
				}
101
			}
101
			}
102
		}
102
		}
103
		
103
 
104
		if (is_null($service)) {
104
		if (is_null($service)) {
105
			$message = "Le service demandé '{$this->serviceNom}' n'existe pas dans le projet {$this->projetNom} !";
105
			$message = "Le service demandé '{$this->serviceNom}' n'existe pas dans le projet {$this->projetNom} !";
106
			$code = RestServeur::HTTP_CODE_RESSOURCE_INTROUVABLE;
106
			$code = RestServeur::HTTP_CODE_RESSOURCE_INTROUVABLE;
107
			throw new Exception($message, $code);
107
			throw new Exception($message, $code);
108
		}
108
		}
109
		return $retour;
109
		return $retour;
110
	}
110
	}
111
	
111
 
112
	private function chargerNomService() {
112
	private function chargerNomService() {
113
		// si la méthode est POST, on ajouter un commentaire
113
		// si la méthode est POST, on ajouter un commentaire
114
		$this->serviceNom = 'liste-taxons';
114
		$this->serviceNom = 'liste-taxons';
115
	}
115
	}