Subversion Repositories eFlore/Applications.eflore-consultation

Rev

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

Rev 451 Rev 541
Line 17... Line 17...
17
	private $conteneur = null;
17
	private $conteneur = null;
18
	private $nomCourant = null;
18
	private $nomCourant = null;
19
	private $textes = null;
19
	private $textes = null;
20
	private $meta = null;
20
	private $meta = null;
21
	private $wikini = null;
21
	private $wikini = null;
-
 
22
	private $informations = null;
-
 
23
	private $mois = array('janvier', 'février', 'mars', 'avril', 'mai', 'juin', 'juillet', 'août',
-
 
24
						'septembre', 'octobre', 'novembre', 'décembre');
22
 
25
	
23
	public function __construct(Conteneur $conteneur) {
26
	public function __construct(Conteneur $conteneur) {
24
		$this->conteneur = $conteneur;
27
		$this->conteneur = $conteneur;
25
		$this->nomCourant = $this->conteneur->getNomCourant();
28
		$this->nomCourant = $this->conteneur->getNomCourant();
26
		$this->textes = $this->conteneur->getApiTextes();
29
		$this->textes = $this->conteneur->getApiTextes();
27
		$this->wikini = $this->conteneur->getApiWikini();
30
		$this->wikini = $this->conteneur->getApiWikini();
28
		$this->meta = $this->conteneur->getApiMetaDonnees();
31
		$this->meta = $this->conteneur->getApiMetaDonnees();
-
 
32
		$this->informations = $this->conteneur->getApiInformations();
29
		$this->appUrls = $this->conteneur->getAppUrls();
33
		$this->appUrls = $this->conteneur->getAppUrls();
30
	}
34
	}
Line 31... Line 35...
31
 
35
 
32
	public function obtenirDonnees() {
36
	public function obtenirDonnees() {
33
		$donnees = array();
37
		$donnees = array();
34
		$donnees['wp'] = $this->getWp();
38
		$donnees['wikipedia'] = $this->getWikipedia();
35
		$donnees['coste'] = $this->getCoste();
39
		$donnees['coste'] = $this->getCoste();
-
 
40
		$donnees['wikini'] = $this->getWikini();
36
		$donnees['wikini'] = $this->getWikini();
41
		$donnees['baseflor'] = $this->getBaseflor();
37
		return $donnees;
42
		return $donnees;
-
 
43
	}
-
 
44
	
-
 
45
	private function getBaseflor() {
-
 
46
		$baseflor = array();
-
 
47
		$this->informations ->setProjet('baseflor');
-
 
48
		$this->informations ->setBdnt($this->conteneur->getParametre('referentiel'));
-
 
49
		$this->informations ->setNum_nom($this->conteneur->getParametre('num_nom'));
-
 
50
		$informations = $this->informations->getInformations();
-
 
51
		$baseflor['chorologie'] = $informations['chorologie'];
-
 
52
		$baseflor['inflorescence'] = $informations['inflorescence'];
-
 
53
		$baseflor['sexualite'] = $informations['sexualite'];
-
 
54
		$baseflor['ordre_maturation'] = $informations['ordre_maturation'];
-
 
55
		$baseflor['pollinisation'] = $informations['pollinisation'];
-
 
56
		$baseflor['dissemination'] = $informations['dissemination'];
-
 
57
		$baseflor['fruit'] = $informations['fruit'];
-
 
58
		$baseflor['couleur_fleur'] = $informations['couleur_fleur'];
-
 
59
		$baseflor['macule'] = $informations['macule'];
-
 
60
		$baseflor['floraison'] = $this->changerFloraisonEnChaine($informations['floraison']);
-
 
61
		//récupérer dans ontologies
-
 
62
		$baseflor['type_bio'] = $informations['type_bio.libelle'];
-
 
63
		$baseflor['form_vegetale'] = $informations['form_vegetale'];
-
 
64
		$baseflor['description']=$baseflor;
-
 
65
		$this->meta->setProjet('baseflor');
-
 
66
		$meta = $this->meta->getMetaDonnees();
-
 
67
		$citation = $meta[0]['citation'];
-
 
68
		$baseflor['meta']['citation'] = $citation;
-
 
69
		$baseflor['meta']['url'] = $this->appUrls->obtenirUrlMetaDonnees('baseflor');
-
 
70
		
-
 
71
		return $baseflor;
-
 
72
	}
-
 
73
	
-
 
74
	public function changerFloraisonEnChaine($floraison){
-
 
75
		$chaine = "";
-
 
76
		if ($floraison != ""){
-
 
77
			$mois_fleurs=preg_match('/-/',$floraison) ? preg_split('/-/',$floraison) : $floraison;
-
 
78
			if (is_array($mois_fleurs)){
-
 
79
				$chaine = "de ".$this->mois[(int)$mois_fleurs[0]]." à ".$this->mois[(int)$mois_fleurs[1]];
-
 
80
					
-
 
81
			}else { $chaine = "en ".$this->mois[(int)$mois_fleurs];
-
 
82
			}
-
 
83
		}
-
 
84
		return $chaine;
-
 
85
	}
Line 38... Line 86...
38
	}
86
 
-
 
87
 
39
 
88
	public function getBloc() {
40
	public function getBloc() {
89
		
41
		$donnees['titre'] = "Description de Coste";
90
		$donnees['titre'] = "Description de Coste";
-
 
91
		$description = $this->getCoste();
-
 
92
		if ($description['description'] == '') {
-
 
93
			$donnees['titre'] = "Description Baseflor";
-
 
94
			$description = $this->getBaseflor();
42
		$description = $this->getCoste();
95
		}
43
		if ($description['description'] == '') {
96
		if ($description['description'] == '') {
44
			$donnees['titre'] = "Description collaborative";
97
			$donnees['titre'] = "Description collaborative";
45
			$description = $this->getWikini();
98
			$description = $this->getWikini();
46
		}
99
		}
47
		$donnees['description'] = $description['description'];
100
		$donnees['description'] = $description['description'];
Line 48... Line 101...
48
		return $donnees;
101
		return $donnees;
49
	}
102
	}
50
 
103
 
51
	private function getWp() {
104
	private function getWikipedia() {
52
		$wp = array();
105
		$wp = array();
53
		$this->textes->setProjet('wikipedia');
106
		$this->textes->setProjet('wikipedia');