52,10 → 52,13 |
} |
|
private function getEvolImgLieesParMois($param) { |
$utilisateur = isset($_GET['utilisateur']) ? $this->bdd->quote($_GET['utilisateur']) : null; |
|
// Récupération des données |
$requete = "SELECT DATE_FORMAT(ci_meta_date_ajout, '%Y%m') AS periode, COUNT(ci_id_image) AS nbre ". |
"FROM cel_obs_images LEFT JOIN cel_images ON (coi_ce_image = ci_id_image) ". |
"WHERE ci_meta_date_ajout != '0000-00-00 00:00:00' ". |
((isset($utilisateur)) ? " AND ci_ce_utilisateur = $utilisateur " : ''). |
'GROUP BY periode '. |
'ORDER BY periode '; |
$resulats = $this->executerRequete($requete); |
119,10 → 122,13 |
} |
|
private function getEvolImgParMois($param) { |
$utilisateur = isset($_GET['utilisateur']) ? $this->bdd->quote($_GET['utilisateur']) : null; |
|
// Récupération des données |
$requete = "SELECT DATE_FORMAT(ci_meta_date_ajout, '%Y%m') AS periode, COUNT(ci_id_image) AS nbre ". |
"FROM cel_images ". |
"WHERE ci_meta_date_ajout != '0000-00-00 00:00:00' ". |
((isset($utilisateur)) ? " AND ci_ce_utilisateur = $utilisateur " : ''). |
'GROUP BY periode '. |
'ORDER BY periode '; |
$resulats = $this->executerRequete($requete); |
509,17 → 515,20 |
} |
|
private function getNbreObsAvecIndicationGeo($param) { |
$utilisateur = isset($_GET['utilisateur']) ? ' AND identifiant = '.$this->bdd->quote($_GET['utilisateur']) : ''; |
|
// Récupération des données |
$total = $this->executerRequeteNombre('cel_inventory', 'id', $utilisateur); |
$where_commune = "location != '000null' AND location != '' AND location IS NOT NULL"; |
$total = $this->executerRequeteNombre('cel_inventory', 'id'); |
$where_commune = $this->creerWhereIndicationGeo('location'); |
$obs['commune'] = $this->executerRequeteNombre('cel_inventory', 'id', $where_commune); |
$obs['commune identifiée'] = $this->executerRequeteNombre('cel_inventory', 'id', "id_location != '000null' AND id_location != '' AND id_location IS NOT NULL"); |
$obs['lieu-dit'] = $this->executerRequeteNombre('cel_inventory', 'id', "lieudit != '000null' AND lieudit != '' AND lieudit IS NOT NULL"); |
$obs['station'] = $this->executerRequeteNombre('cel_inventory', 'id', "station != '000null' AND station != '' AND station IS NOT NULL"); |
$obs['milieu'] = $this->executerRequeteNombre('cel_inventory', 'id', "milieu != '000null' AND milieu != '' AND milieu IS NOT NULL"); |
$obs['coordonnée'] = $this->executerRequeteNombre('cel_inventory', 'id', "coord_x != '000null' AND coord_x != '' AND coord_x IS NOT NULL AND coord_y != '000null' AND coord_y != '' AND coord_y IS NOT NULL"); |
$where_commune_id = $this->creerWhereIndicationGeo('id_location'); |
$obs['commune identifiée'] = $this->executerRequeteNombre('cel_inventory', 'id', $where_commune_id); |
$where_lieudit = $this->creerWhereIndicationGeo('lieudit'); |
$obs['lieu-dit'] = $this->executerRequeteNombre('cel_inventory', 'id', $where_lieudit); |
$where_station = $this->creerWhereIndicationGeo('station'); |
$obs['station'] = $this->executerRequeteNombre('cel_inventory', 'id', $where_station); |
$where_milieu = $this->creerWhereIndicationGeo('milieu'); |
$obs['milieu'] = $this->executerRequeteNombre('cel_inventory', 'id', $where_milieu); |
$where_xy = $this->creerWhereIndicationGeo('coord_x').' AND '.$this->creerWhereIndicationGeo('coord_y'); |
$obs['coordonnée'] = $this->executerRequeteNombre('cel_inventory', 'id', $where_xy); |
|
$donnees = array(); |
$num = 1; |
552,6 → 561,16 |
'chm' => 'B,FF000080,0,1.0,5.0'); |
return $graph; |
} |
|
private function creerWhereIndicationGeo($champ) { |
$where = null; |
if (isset($champ)) { |
$where = "$champ != '000null' ". |
"AND $champ != '' ". |
"AND $champ IS NOT NULL "; |
} |
return $where; |
} |
|
private function getUtilisationJournaliere($param) { |
// Sur quel jour, voulons nous estimer l'utilisation |
570,10 → 589,10 |
$max_obs[] = $this->executerRequeteEvol('cel_inventory', 'id', '%Y%m%d', |
"date_transmission NOT LIKE '$aujourdhui%' ", 'date_transmission'); |
$obs_aujourdhui = $this->executerRequeteNombre('cel_inventory', 'id', |
"date_creation LIKE '$aujourdhui%' |
"(date_creation LIKE '$aujourdhui%' |
OR date_modification LIKE '$aujourdhui%' |
OR date_transmission LIKE '$aujourdhui%' "); |
|
OR date_transmission LIKE '$aujourdhui%') "); |
|
// Cummul des obs crées, modifiées, transmises par jour |
$donnees = array(); |
foreach ($max_obs as $obs_par_jour) { |
588,7 → 607,7 |
|
// Post traitement des données |
$valeur = $obs_aujourdhui; |
$valeur_max = 400;max($donnees); |
$valeur_max = 400; |
if ($valeur > $valeur_max) { |
$pourcentage = 100; |
} else { |
909,7 → 928,7 |
$requete = "SELECT DATE_FORMAT($champ_date, '$format_date') AS periode, COUNT($champ) AS nbre ". |
"FROM $table ". |
"WHERE $champ_date != '0000-00-00 00:00:00' ". |
($utilisateur ? " AND identifiant = $utilisateur " : ''). |
(($utilisateur != false) ? " AND identifiant = $utilisateur " : ''). |
((is_null($where)) ? '' : " AND $where "). |
'GROUP BY periode '. |
((is_null($order_by)) ? '' : "ORDER BY $order_by "); |
926,9 → 945,17 |
} |
|
private function executerRequeteNombre($table, $champ, $where = null) { |
$utilisateur = null; |
if (isset($_GET['utilisateur'])) { |
$utilisateur = $this->bdd->quote($_GET['utilisateur']); |
$where .= isset($where) ? ' AND ' : ''; |
$where .= "identifiant = $utilisateur "; |
} |
|
$requete = "SELECT COUNT($champ) AS nbre ". |
"FROM $table ". |
((is_null($where)) ? '' : "WHERE $where "); |
((isset($where)) ? "WHERE $where " : ''); |
|
$nbre = $this->executerRequete($requete, 'Column'); |
return $nbre; |
} |