Subversion Repositories eFlore/Projets.eflore-projets

Rev

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

Rev 959 Rev 964
Line 17... Line 17...
17
* @copyright 1999-2012 Tela Botanica (accueil@tela-botanica.org)
17
 * @copyright 1999-2012 Tela Botanica (accueil@tela-botanica.org)
18
* 
18
 * 
19
* 
19
 * 
20
*/
20
 */
Line 21... Line -...
21
 
-
 
22
 
-
 
23
 
21
 
Line 24... Line 22...
24
class Informations extends Commun {
22
class Informations extends Commun {
25
	
23
	
26
	protected $limite_requete = array( 'depart' => 0, 'limite' => 10);
24
	protected $limite_requete = array( 'depart' => 0, 'limite' => 10);
Line 48... Line 46...
48
			$requete = $this->assemblerLaRequete();
46
		$requete = $this->assemblerLaRequete();
49
			// exemple:
47
		// exemple:
50
			// SELECT * FROM baseflor_index_v2012_12_31 WHERE `bdnt.nn` = 'bdtfx.nn:XXXXX';
48
		// SELECT * FROM baseflor_index_v2012_12_31 WHERE `bdnt.nn` = 'bdtfx.nn:XXXXX';
51
			$resultat = $this->Bdd->recupererTous($requete . ' -- ' . __FILE__ . ':' .__LINE__);
49
		$resultat = $this->Bdd->recupererTous($requete . ' -- ' . __FILE__ . ':' .__LINE__);
52
			$versionResultat = $this->renvoyerResultat($resultat);
50
		$versionResultat = $this->renvoyerResultat($resultat);
53
			if ($versionResultat == null) {
51
		if ($versionResultat === null) {
54
				$message = 'Les données recherchées sont introuvables.';
-
 
55
				$code = RestServeur::HTTP_CODE_RESSOURCE_INTROUVABLE;
52
			throw new Exception('Les données recherchées sont introuvables.', RestServeur::HTTP_CODE_RESSOURCE_INTROUVABLE);
56
				throw new Exception($message, $code);
-
 
57
			}
53
		}
58
		return $versionResultat;
54
		return $versionResultat;
59
	}
55
	}
Line 60... Line 56...
60
 
56
 
61
	public function __construct() {
57
	public function __construct() {
62
		$Conteneur = new Conteneur();
58
		$Conteneur = new Conteneur();
63
		$this->Bdd = $Conteneur ->getBdd();
59
		$this->Bdd = $Conteneur ->getBdd();
Line 64... Line 60...
64
	}
60
	}
65
	
61
	
66
	public function renvoyerResultat($resultat) {
62
	public function renvoyerResultat($resultat) {
67
	$res_formate = array();
63
		if (empty($this->ressources)) return $this->retournerResultatFormate($resultat);
68
	if (empty($this->ressources)) {
-
 
69
		$res_formate = $this->retournerResultatFormate($resultat);
64
		if(empty($resultat[0]['baseflor'])) {
-
 
65
			if(@$this->parametres['categorie'] == 'description') {
-
 
66
				// non-supporté par InformationsTaxonsSup.php...
70
	} else {
67
				return array();
71
		$classe = empty($resultat[0]['baseflor']) ? 'InformationsTaxonsSup' : 'InformationsBaseflor';
68
			}
72
		$info = new $classe(new Conteneur());
69
			$info = new InformationsTaxonsSup(new Conteneur());
-
 
70
			return $info->consulter($this->ressources, $this->parametres);
-
 
71
		}
73
		$res_formate = $info->consulter($this->ressources, $this->parametres);
72
 
74
	}
73
		$info = new InformationsBaseflor(new Conteneur());
Line 75... Line 74...
75
	return $res_formate;
74
		return $info->consulter($this->ressources, $this->parametres);