Subversion Repositories eFlore/Applications.del

Rev

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

Rev 1795 Rev 1840
Line 37... Line 37...
37
 * @author     Aurelien PERONNET <aurelien@tela-botanica.org>
37
 * @author     Aurelien PERONNET <aurelien@tela-botanica.org>
38
 * @license    GPL v3 <http://www.gnu.org/licenses/gpl.txt>
38
 * @license    GPL v3 <http://www.gnu.org/licenses/gpl.txt>
39
 * @license    CECILL v2 <http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt>
39
 * @license    CECILL v2 <http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt>
40
 * @copyright  1999-2014 Tela Botanica <accueil@tela-botanica.org>
40
 * @copyright  1999-2014 Tela Botanica <accueil@tela-botanica.org>
41
 */
41
 */
-
 
42
 
42
class Observations extends RestService {
43
class Observations extends RestService {
Line 43... Line 44...
43
 
44
 
44
	private $parametres = array();
45
	private $parametres = array();
45
	private $ressources = array();
46
	private $ressources = array();
Line 93... Line 94...
93
		$this->ressources = $ressources;
94
		$this->ressources = $ressources;
94
		$this->parametres = $parametres;
95
		$this->parametres = $parametres;
95
	}
96
	}
Line 96... Line 97...
96
 
97
 
97
	private function traiterRessources() {
-
 
98
		$this->chargerConfigService();
98
	private function traiterRessources() {
99
		$this->analyserRessources();
99
		$this->analyserRessources();
100
		$retour = $this->initialiserService();
100
		$retour = $this->initialiserService();
101
		return $retour;
101
		return $retour;
Line 102... Line -...
102
	}
-
 
103
 
-
 
104
	private function chargerConfigService() {
-
 
105
		$chemin = Config::get('chemin_configurations')."config_{$this->serviceNom}.ini";
-
 
106
		Config::charger($chemin);
-
 
107
	}
-
 
108
 
-
 
109
	/*------------------------------------------------------------------------------------------------------------------
-
 
110
								CONFIGURATION DU SERVICE
-
 
111
	------------------------------------------------------------------------------------------------------------------*/
102
	}
112
 
103
 
113
	private function analyserRessources() {
104
	private function analyserRessources() {
114
		if ($this->methode == 'consulter') {
105
		if ($this->methode == 'consulter') {
115
			$this->analyserRessoucesConsultation();
106
			$this->analyserRessoucesConsultation();
Line 128... Line 119...
128
				$this->sousServiceNom = 'liste-observations';
119
				$this->sousServiceNom = 'liste-observations';
129
			}
120
			}
130
		} else if (count($this->ressources) == 1) {
121
		} else if (count($this->ressources) == 1) {
131
			if ($this->etreRessourceIdentifiant(0)) {
122
			if ($this->etreRessourceIdentifiant(0)) {
132
				// http://localhost/service:del:0.1/observations/#idObs
123
				// http://localhost/service:del:0.1/observations/#idObs
133
				$this->sousServiceNom = 'observation';
124
				$this->sousServiceNom = 'observation-details';
134
			}
125
			}
135
		} else if (count($this->ressources) == 3) {
126
		} else if (count($this->ressources) == 3) {
136
			if ($this->etreRessourceIdentifiant(0) && $this->etreRessourceIdentifiant(1) && $this->verifierRessourceValeur(2, 'vote')) {
127
			if ($this->etreRessourceIdentifiant(0) && $this->etreRessourceIdentifiant(1) && $this->verifierRessourceValeur(2, 'vote')) {
137
				// http://localhost/service:del:0.1/observations/#idObs/#idProposition/vote/
128
				// http://localhost/service:del:0.1/observations/#idObs/#idProposition/vote/
138
				$this->sousServiceNom = 'vote-observation';
129
				$this->sousServiceNom = 'vote-observation';
Line 205... Line 196...
205
		$chemins[] = $this->cheminCourant.'commun'.DS.$classe.'.php';
196
		$chemins[] = $this->cheminCourant.'commun'.DS.$classe.'.php';
206
		$retour = '';
197
		$retour = '';
207
		$service = null;
198
		$service = null;
208
		foreach ($chemins as $chemin) {
199
		foreach ($chemins as $chemin) {
209
			if (file_exists($chemin)) {
200
			if (file_exists($chemin)) {
210
				$this->conteneur->chargerConfiguration('config_'.$this->serviceNom.'.ini');
-
 
211
				require_once $chemin;
201
				require_once $chemin;
212
				$service = new $classe($this->conteneur);
202
				$service = new $classe($this->conteneur);
213
				if ($this->methode == 'consulter') {
203
				if ($this->methode == 'consulter') {
214
					$retour = $service->consulter($this->ressources, $this->parametres);
204
					$retour = $service->consulter($this->ressources, $this->parametres);
215
				} elseif ($this->methode == 'ajouter') {
205
				} elseif ($this->methode == 'ajouter') {