Subversion Repositories eFlore/Applications.del

Rev

Rev 1779 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1779 Rev 1877
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 PlantNet extends RestService {
17
class PlantNet extends RestService {
Line 18... Line 18...
18
 
18
 
19
	
19
 
20
	/*
20
	/*
21
	 * url possibles : 
21
	 * url possibles :
22
	 * */
22
	 * */
23
	
23
 
24
	private $parametres = array();
24
	private $parametres = array();
25
	private $ressources = array();
25
	private $ressources = array();
26
	private $methode = null;
26
	private $methode = null;
27
	private $projetNom = array();
27
	private $projetNom = 'plantnet';
28
	private $serviceNom = array();
28
	private $serviceNom = 'changements';
Line 29... Line 29...
29
	private $cheminCourant = null;
29
	private $cheminCourant = null;
30
 
30
 
31
	private $conteneur;
31
	private $conteneur;
32
	
32
 
Line 33... Line 33...
33
	/** Indique si oui (true) ou non (false), on veut utiliser les paramètres bruts. */
33
	/** Indique si oui (true) ou non (false), on veut utiliser les paramètres bruts. */
34
	protected $utilisationParametresBruts = true;
34
	protected $utilisationParametresBruts = true;
Line 45... Line 45...
45
                        $this->ressources = $ressources;
45
                        $this->ressources = $ressources;
46
                        $this->parametres = $parametres;
46
                        $this->parametres = $parametres;
Line 47... Line 47...
47
 
47
 
48
 
48
 
49
			$this->conteneur = new Conteneur($this->parametres);
-
 
50
                        
-
 
51
                        $this->projetNom = 'plantnet';
-
 
52
                        $this->serviceNom = 'changements';
-
 
53
 
-
 
54
                        // init projet
-
 
55
                        $projet = $this->projetNom;
-
 
56
                        $chemin = Config::get('chemin_configurations')."config_$projet.ini";
-
 
57
                        Config::charger($chemin);
49
			$this->conteneur = new Conteneur($this->parametres);
Line 58... Line 50...
58
                        
50
 
Line 59... Line 51...
59
                        $resultat = $this->initialiserService();
51
                        $resultat = $this->initialiserService();
Line 65... Line 57...
65
		}
57
		}
66
		$reponseHttp->emettreLesEntetes();
58
		$reponseHttp->emettreLesEntetes();
67
		$corps = $reponseHttp->getCorps();
59
		$corps = $reponseHttp->getCorps();
68
		return $corps;
60
		return $corps;
69
	}
61
	}
70
	
62
 
Line 71... Line 63...
71
 
63
 
72
 
64
 
73
 
65
 
74
 
66
 
75
	/*------------------------------------------------------------------------------------------------------------------
67
	/*------------------------------------------------------------------------------------------------------------------
Line 76... Line 68...
76
								CONFIGURATION DU SERVICE
68
								CONFIGURATION DU SERVICE
77
	------------------------------------------------------------------------------------------------------------------*/
69
	------------------------------------------------------------------------------------------------------------------*/
78
	
70
 
79
	
71
 
80
 
72
 
81
	private function initialiserService() {
73
	private function initialiserService() {
82
		
74
 
83
		$classe = $this->obtenirNomClasseService($this->serviceNom);
75
		$classe = $this->obtenirNomClasseService($this->serviceNom);
84
		$chemins = array();
76
		$chemins = array();
85
		$chemins[] = $this->cheminCourant.$this->projetNom.DS.$classe.'.php';
-
 
86
		$retour = '';
-
 
87
		$service = null;
-
 
88
		foreach ($chemins as $chemin) {
77
		$chemins[] = $this->cheminCourant.$this->projetNom.DS.$classe.'.php';
89
                  if (file_exists($chemin)) {
78
		$retour = '';
90
                    
79
		$service = null;
91
                    
80
		foreach ($chemins as $chemin) {
92
                    $this->conteneur->chargerConfiguration('config_'.$this->projetNom.'.ini');
81
                  if (file_exists($chemin)) {
93
                    require_once $chemin;
82
                    require_once $chemin;
94
                    
83
 
95
                    $service = new $classe($this->conteneur);
84
                    $service = new $classe($this->conteneur);
96
                    $retour = $service->consulter($this->ressources, $this->parametres);
85
                    $retour = $service->consulter($this->ressources, $this->parametres);
97
                    
86
 
98
                  }
87
                  }
99
		}
88
		}
100
		
89