188,12 → 188,45 |
$this->construireWhereTag(); |
|
$resultats_emplacements = $this->executerRequete($requete); |
$emplacements = $this->traiterEmplacements($resultats_emplacements); |
$emplacements = $this->traiterEmplacements($resultats_emplacements, $this->compterObservations($params)); |
|
return $emplacements; |
} |
|
private function traiterEmplacements(&$emplacements) { |
private $nb_obs = 0; |
|
private function compterObservations($params) { |
$requete = 'SELECT COUNT(*) AS nb '. |
'FROM cel_inventory AS i '. |
' LEFT JOIN locations AS l '. |
' ON (l.name = i.location AND l.code = i.id_location) '. |
"WHERE transmission = '1' ". |
" AND (". |
"(".($this->construireWhereRectangleStationOR() != null ? $this->construireWhereRectangleStationOR().' AND ' : ''). |
" (mots_cles_texte IS NULL OR mots_cles_texte NOT LIKE '%sensible%') ". |
")". |
" OR ". |
" ( ". |
"(".($this->construireWhereRectangleCommuneOR() != null ? $this->construireWhereRectangleCommuneOR().' Or ' : ''). |
" mots_cles_texte LIKE '%sensible%' ". |
")". |
" ) ". |
") ". |
$this->construireWhereDept(). |
$this->construireWhereCommune(). |
$this->construireWhereUtilisateur(). |
$this->construireWhereNumTaxon(). |
$this->construireWhereNomTaxon(). |
$this->construireWhereDate(). |
$this->construireWhereCommentaire(). |
$this->construireWhereProjet(). |
$this->construireWhereTag(); |
|
$resultats_nb_obs = $this->executerRequete($requete); |
return $resultats_nb_obs[0]['nb']; |
} |
|
private function traiterEmplacements(&$emplacements, $nb_total_observation) { |
$zoom = (int) array_key_exists('zoom', $this->parametres) ? $this->parametres['zoom'] : 11; |
$distance = (int) array_key_exists('distance', $this->parametres) ? $this->parametres['distance'] : 20; |
|
213,7 → 246,7 |
|
$marqueurs['stats']['stations'] = $nb_elements['stations']; |
$marqueurs['stats']['communes'] = $nb_elements['communes']; |
$marqueurs['stats']['observations'] = $nb_elements['observations']; |
$marqueurs['stats']['observations'] = (int)$nb_total_observation; |
} else { |
$marqueurs['points'] = $emplacements; |
} |
369,8 → 402,8 |
|
// Post-traitement |
$observations = $this->traiterObservations($resultats, $total); |
//$observations = $this->ajouterImagesAuxObs($observations); |
//$observations = $this->ajouterAuteursAuxObs($observations); |
$observations = $this->ajouterImagesAuxObs($observations); |
$observations = $this->ajouterAuteursAuxObs($observations); |
$observations = $this->supprimerIdDesObs($observations); |
|
return $observations; |