Subversion Repositories eFlore/Applications.del

Rev

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

Rev 935 Rev 1700
Line 14... Line 14...
14
* @version 0.1
14
* @version 0.1
15
* @copyright 1999-2011 Tela Botanica (accueil@tela-botanica.org)
15
* @copyright 1999-2011 Tela Botanica (accueil@tela-botanica.org)
16
*/
16
*/
17
class Communes extends RestService {
17
class Communes extends RestService {
Line 18... Line -...
18
 
-
 
19
	
18
 
20
	private $parametres = array();
19
	private $parametres = array();
21
	private $ressources = array();
20
	private $ressources = array();
22
	private $methode = null;
21
	private $methode = null;
23
	private $projetNom = array();
22
	private $projetNom = array();
24
	private $serviceNom = array();
23
	private $serviceNom = array();
Line 25... Line 24...
25
	private $cheminCourant = null;
24
	private $cheminCourant = null;
26
 
25
 
27
	private $conteneur;
26
	private $conteneur;
28
	
27
 
Line 29... Line 28...
29
	/** Indique si oui (true) ou non (false), on veut utiliser les paramètres bruts. */
28
	/** Indique si oui (true) ou non (false), on veut utiliser les paramètres bruts. */
30
	protected $utilisationParametresBruts = true;
29
	protected $utilisationParametresBruts = true;
Line 47... Line 46...
47
		}
46
		}
48
		$reponseHttp->emettreLesEntetes();
47
		$reponseHttp->emettreLesEntetes();
49
		$corps = $reponseHttp->getCorps();
48
		$corps = $reponseHttp->getCorps();
50
		return $corps;
49
		return $corps;
51
	}
50
	}
52
	
51
 
53
	private function initialiserRessourcesEtParametres($ressources, $parametres) {
52
	private function initialiserRessourcesEtParametres($ressources, $parametres) {
54
		$this->ressources = $ressources;
53
		$this->ressources = $ressources;
55
		$this->parametres = $parametres;
54
		$this->parametres = $parametres;
56
	}
55
	}
Line 79... Line 78...
79
	/*------------------------------------------------------------------------------------------------------------------
78
	/*------------------------------------------------------------------------------------------------------------------
80
								CONFIGURATION DU SERVICE
79
								CONFIGURATION DU SERVICE
81
	------------------------------------------------------------------------------------------------------------------*/
80
	------------------------------------------------------------------------------------------------------------------*/
82
	private function initialiserService() {
81
	private function initialiserService() {
83
		$this->chargerNomService();
82
		$this->chargerNomService();
84
				
83
 
85
		$classe = $this->obtenirNomClasseService($this->serviceNom);
84
		$classe = $this->obtenirNomClasseService($this->serviceNom);
86
		$chemins = array();
85
		$chemins = array();
87
		$chemins[] = $this->cheminCourant.$this->projetNom.DS.$classe.'.php';
86
		$chemins[] = $this->cheminCourant.$this->projetNom.DS.$classe.'.php';
88
		$chemins[] = $this->cheminCourant.'commun'.DS.$classe.'.php';
87
		$chemins[] = $this->cheminCourant.'commun'.DS.$classe.'.php';
89
		$retour = '';
88
		$retour = '';
Line 98... Line 97...
98
				} else {
97
				} else {
99
					//TODO : throw exception
98
					//TODO : throw exception
100
				}
99
				}
101
			}
100
			}
102
		}
101
		}
103
		
102
 
104
		if (is_null($service)) {
103
		if (is_null($service)) {
105
			$message = "Le service demandé '{$this->serviceNom}' n'existe pas dans le projet {$this->projetNom} !";
104
			$message = "Le service demandé '{$this->serviceNom}' n'existe pas dans le projet {$this->projetNom} !";
106
			$code = RestServeur::HTTP_CODE_RESSOURCE_INTROUVABLE;
105
			$code = RestServeur::HTTP_CODE_RESSOURCE_INTROUVABLE;
107
			throw new Exception($message, $code);
106
			throw new Exception($message, $code);
108
		}
107
		}
109
		return $retour;
108
		return $retour;
110
	}
109
	}
111
	
110
 
112
	private function chargerNomService() {
111
	private function chargerNomService() {
113
		// si la méthode est POST, on ajouter un commentaire
112
		// si la méthode est POST, on ajouter un commentaire
114
		$this->serviceNom = 'liste-communes';
113
		$this->serviceNom = 'liste-communes';
115
	}
114
	}