Subversion Repositories eFlore/Applications.del

Rev

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

Rev 1593 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 de Plantnet.
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 Plantnet
-
 
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     Samuel DUFOUR-KOWALSKI <samuel.dufour@cirad.fr>
11
* @author Jean-Pascal MILCENT <jpm@tela-botanica.org>
12
 * @author     Jean-Pascal MILCENT <jpm@tela-botanica.org>
-
 
13
 * @author     Aurelien PERONNET <aurelien@tela-botanica.org>
12
* @license GPL v3 <http://www.gnu.org/licenses/gpl.txt>
14
 * @license    GPL v3 <http://www.gnu.org/licenses/gpl.txt>
13
* @license CECILL v2 <http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt>
15
 * @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)
16
 * @copyright  1999-2014 Tela Botanica <accueil@tela-botanica.org>
16
*/
17
*/
17
class PlantNet extends RestService {
18
class PlantNet extends RestService {
Line 18... Line -...
18
 
-
 
19
	
-
 
20
	/*
-
 
21
	 * url possibles : 
-
 
22
	 * */
-
 
23
	
19
 
24
	private $parametres = array();
20
	private $parametres = array();
25
	private $ressources = array();
21
	private $ressources = array();
26
	private $methode = null;
22
	private $methode = null;
27
	private $projetNom = array();
23
	private $projetNom = array();
28
	private $serviceNom = array();
24
	private $serviceNom = array();
Line 29... Line 25...
29
	private $cheminCourant = null;
25
	private $cheminCourant = null;
30
 
26
 
31
	private $conteneur;
27
	private $conteneur;
32
	
28
 
Line 33... Line 29...
33
	/** 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. */
34
	protected $utilisationParametresBruts = true;
30
	protected $utilisationParametresBruts = true;
Line 45... Line 41...
45
                        $this->ressources = $ressources;
41
                        $this->ressources = $ressources;
46
                        $this->parametres = $parametres;
42
                        $this->parametres = $parametres;
Line 47... Line 43...
47
 
43
 
48
 
44
 
49
			$this->conteneur = new Conteneur($this->parametres);
45
			$this->conteneur = new Conteneur($this->parametres);
50
                        
46
 
Line 51... Line 47...
51
                        $this->projetNom = 'plantnet';
47
                        $this->projetNom = 'plantnet';
52
                        $this->serviceNom = 'changements';
48
                        $this->serviceNom = 'changements';
53
 
49
 
54
                        // init projet
50
                        // init projet
55
                        $projet = $this->projetNom;
51
                        $projet = $this->projetNom;
56
                        $chemin = Config::get('chemin_configurations')."config_$projet.ini";
52
                        $chemin = Config::get('chemin_configurations')."config_$projet.ini";
Line 57... Line 53...
57
                        Config::charger($chemin);
53
                        Config::charger($chemin);
Line 58... Line 54...
58
                        
54
 
Line 65... Line 61...
65
		}
61
		}
66
		$reponseHttp->emettreLesEntetes();
62
		$reponseHttp->emettreLesEntetes();
67
		$corps = $reponseHttp->getCorps();
63
		$corps = $reponseHttp->getCorps();
68
		return $corps;
64
		return $corps;
69
	}
65
	}
70
	
66
 
Line 71... Line 67...
71
 
67
 
72
 
68
 
73
 
69
 
74
 
70
 
75
	/*------------------------------------------------------------------------------------------------------------------
71
	/*------------------------------------------------------------------------------------------------------------------
Line 76... Line 72...
76
								CONFIGURATION DU SERVICE
72
								CONFIGURATION DU SERVICE
77
	------------------------------------------------------------------------------------------------------------------*/
73
	------------------------------------------------------------------------------------------------------------------*/
78
	
74
 
79
	
75
 
80
 
76
 
81
	private function initialiserService() {
77
	private function initialiserService() {
82
		
78
 
83
		$classe = $this->obtenirNomClasseService($this->serviceNom);
79
		$classe = $this->obtenirNomClasseService($this->serviceNom);
84
		$chemins = array();
80
		$chemins = array();
85
		$chemins[] = $this->cheminCourant.$this->projetNom.DS.$classe.'.php';
81
		$chemins[] = $this->cheminCourant.$this->projetNom.DS.$classe.'.php';
86
		$retour = '';
82
		$retour = '';
87
		$service = null;
83
		$service = null;
88
		foreach ($chemins as $chemin) {
84
		foreach ($chemins as $chemin) {
89
                  if (file_exists($chemin)) {
85
                  if (file_exists($chemin)) {
90
                    
86
 
91
                    
87
 
92
                    $this->conteneur->chargerConfiguration('config_'.$this->projetNom.'.ini');
88
                    $this->conteneur->chargerConfiguration('config_'.$this->projetNom.'.ini');
93
                    require_once $chemin;
89
                    require_once $chemin;
94
                    
90
 
95
                    $service = new $classe($this->conteneur);
91
                    $service = new $classe($this->conteneur);
96
                    $retour = $service->consulter($this->ressources, $this->parametres);
92
                    $retour = $service->consulter($this->ressources, $this->parametres);
97
                    
93
 
98
                  }
94
                  }
99
		}
95
		}
100
		
96