Subversion Repositories eFlore/Applications.del

Rev

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

Rev 1729 Rev 1731
Line 74... Line 74...
74
	}
74
	}
Line 75... Line 75...
75
 
75
 
76
	private function formaterObservations($liste_obs) {
76
	private function formaterObservations($liste_obs) {
77
		foreach ($liste_obs as $obs) {
77
		foreach ($liste_obs as $obs) {
-
 
78
			$id_obs = $obs['id_observation'];
-
 
79
			$infos = array();
78
			$id_obs = $obs['id_observation'];
80
			$infos['id'] = $id_obs;
79
			$obs['date'] = $this->formaterDateObs($obs['date_observation']);
81
			$infos['date'] = $this->formaterDateObs($obs['date_observation']);
80
			$obs['nom_propose'] = $this->formaterNomSci($obs);
82
			$infos['nom_propose'] = $this->formaterNomSci($obs);
-
 
83
			$infos['lien'] = $this->obtenirLienFicheObs($id_obs);
81
			$obs['lien'] = $this->obtenirLienFicheObs($id_obs);
84
			$infos['lieu'] = $this->formaterLieu($obs);
82
			$this->observations_concernees[$id_obs] = $obs;
85
			$this->observations_concernees[$id_obs] = $infos;
83
		}
86
		}
Line 84... Line 87...
84
	}
87
	}
85
 
88
 
Line 91... Line 94...
91
		}
94
		}
92
		return $dateFmt;
95
		return $dateFmt;
93
	}
96
	}
Line 94... Line 97...
94
 
97
 
95
	private function formaterNomSci($obs) {
98
	private function formaterNomSci($obs) {
96
		$nom = '';
99
		$nom = 'Espèce indéterminée';
97
		if ($obs['nom_ret'] != '') {
100
		if ($obs['nom_ret'] != '') {
98
			$nom = $obs['nom_ret'];
101
			$nom = $obs['nom_ret'];
99
		} else if($obs['nom_sel'] != '') {
102
		} else if($obs['nom_sel'] != '') {
100
			$nom = $obs['nom_sel'];
103
			$nom = $obs['nom_sel'];
Line 104... Line 107...
104
 
107
 
105
	private function obtenirLienFicheObs($id_obs) {
108
	private function obtenirLienFicheObs($id_obs) {
106
		return  sprintf($this->conteneur->getParametre('url_fiche_observation'), $id_obs);
109
		return  sprintf($this->conteneur->getParametre('url_fiche_observation'), $id_obs);
Line -... Line 110...
-
 
110
	}
-
 
111
 
-
 
112
	private function formaterLieu($obs) {
-
 
113
		$lieuInfos = [];
-
 
114
		$champsLieu = ['zone_geo', 'lieudit', 'station'];
-
 
115
		foreach ($champsLieu as $champ) {
-
 
116
			if (trim($obs[$champ]) != '') {
-
 
117
				$lieuIntitule = $obs[$champ];
-
 
118
				if ($champ == 'zone_geo') {
-
 
119
					$codeDept = $this->convertirCodeZoneGeoVersDepartement($obs['ce_zone_geo']);
-
 
120
					$lieuIntitule .= empty($codeDept) ? '' : " ($codeDept)";
-
 
121
 
-
 
122
				}
-
 
123
				$lieuInfos[] = $lieuIntitule;
-
 
124
			}
-
 
125
		}
-
 
126
		$lieu = (count($lieuInfos) > 0) ? implode(' > ', $lieuInfos) : '(lieu inconnu)';
-
 
127
		return $lieu;
-
 
128
	}
-
 
129
 
-
 
130
	private function convertirCodeZoneGeoVersDepartement($code_zone_geo) {
-
 
131
		$code_departement = '';
-
 
132
		if (preg_match('/^INSEE-C:([0-9]){2}[0-9]{3}$/', $code_a_tester, $match)) {
-
 
133
			$code_departement = $match[1];
-
 
134
		}
-
 
135
		return $code_departement;
107
	}
136
	}
108
 
137
 
109
	private function genererMessage() {
138
	private function genererMessage() {
110
		if ($this->messageHtml == null && $this->messageTxt == null) {
139
		if ($this->messageHtml == null && $this->messageTxt == null) {