18,150 → 18,139 |
private $champ_pays = '12'; |
private $champ_rapport_activite_bota = '102'; |
private $champ_experience_bota = '4'; |
|
private $tab_mois = array('Jan','Fev','Mar','Avr','Mai','Juin','Juil','Aout','Sep','Oct','Nov','Dec'); |
|
public function StatistiqueControleur() { |
|
$this->__construct(); |
$this->statistiques = Composant::fabrique('statistiques', array()); |
} |
|
public function obtenirStatistiquesInscritsParContinents($id_annuaire) { |
|
$cartographe = new CartoControleur(); |
$annuaire_controleur = new AnnuaireControleur(); |
|
$continents = array('Afrique (%1.2f%%)' => 'pays_afrique', |
'Amerique du nord (%1.2f%%)' => 'pays_nord_amerique', |
'Asie (%1.2f%%)' => 'pays_asie', |
'Europe (%1.2f%%)' => 'pays_europe', |
'Oceanie (%1.2f%%)' => 'pays_oceanie', |
'Amerique du sud (%1.2f%%)' => 'pays_sud_amerique', |
'Moyen Orient (%1.2f%%)' => 'pays_moyen_orient'); |
$continents = array( |
'Afrique (%1.2f%%)' => 'pays_afrique', |
'Amerique du nord (%1.2f%%)' => 'pays_nord_amerique', |
'Asie (%1.2f%%)' => 'pays_asie', |
'Europe (%1.2f%%)' => 'pays_europe', |
'Oceanie (%1.2f%%)' => 'pays_oceanie', |
'Amerique du sud (%1.2f%%)' => 'pays_sud_amerique', |
'Moyen Orient (%1.2f%%)' => 'pays_moyen_orient'); |
|
// pour chacun des continents, on fait la somme des membres de sa zone |
foreach($continents as $id_continent => $continent) { |
$zones_continent_ids = $cartographe->chargerInformationsPaysDuContinentsCsv($continent); |
$zones_continent_ids = array_map(array($this,'miniQuote'), array_keys($zones_continent_ids)); |
$nb_inscrits[$id_continent] = array_sum($annuaire_controleur->chargerNombreAnnuaireListeInscritsParPays($id_annuaire, $zones_continent_ids)); |
} |
|
$graph = $this->statistiques->genererGraphique(Statistiques::GRAPH_CAMEMBERT,$nb_inscrits,'', array(650, 500)); |
|
return $this->dessinerGraph($graph); |
// pour chacun des continents, on fait la somme des membres de sa zone |
foreach($continents as $id_continent => $continent) { |
$zones_continent_ids = $cartographe->chargerInformationsPaysDuContinentsCsv($continent); |
$zones_continent_ids = array_map(array($this,'miniQuote'), array_keys($zones_continent_ids)); |
$nb_inscrits[$id_continent] = array_sum($annuaire_controleur->chargerNombreAnnuaireListeInscritsParPays($id_annuaire, $zones_continent_ids)); |
} |
|
$graph = $this->statistiques->genererGraphique(Statistiques::GRAPH_CAMEMBERT,$nb_inscrits,'', array(650, 500)); |
|
return $this->dessinerGraph($graph); |
} |
|
public function obtenirStatistiquesInscritsEurope($id_annuaire) { |
|
$cartographe = new CartoControleur(); |
$annuaire_controleur = new AnnuaireControleur(); |
$cartographe = new CartoControleur(); |
|
$ids_zones_europe = $cartographe->chargerInformationsPaysDuContinentsCsv('pays_europe'); |
|
$codes_zones_europe = array_map(array($this,'miniQuote'), array_keys($ids_zones_europe)); |
|
$codes_zones_europe = array_map(array($this, 'miniQuote'), array_keys($ids_zones_europe)); |
|
$titre_zone = $this->convertirPourLegende($zone[2]); |
$nb_inscrits_par_code = $annuaire_controleur->chargerNombreAnnuaireListeInscritsParPays($id_annuaire, $codes_zones_europe); |
$nb_inscrits_par_code = $annuaire_controleur->chargerNombreAnnuaireListeInscritsParPays($id_annuaire, $codes_zones_europe); |
|
$nb_inscrits_par_legende = array(); |
|
$inscrits_france = $nb_inscrits_par_code['fr']; |
|
unset($nb_inscrits_par_code['fr']); |
$somme_autres_pays = 0; |
|
foreach($nb_inscrits_par_code as $code_pays => $inscrits_pays) { |
|
$label_pays = $this->convertirPourLegende($ids_zones_europe[$code_pays][2].' (%1.2f%%)'); |
$nb_inscrits_par_legende[$label_pays] = $inscrits_pays; |
$somme_autres_pays += $inscrits_pays; |
} |
|
$tableau_france_autres = array('France (%1.2f%%)' => $inscrits_france, 'Autres (%1.2f%%)' => $somme_autres_pays); |
|
$graph_france = $this->statistiques->genererGraphique(Statistiques::GRAPH_CAMEMBERT,$tableau_france_autres,'', array(320, 200)); |
$graph_autres = $this->statistiques->genererGraphique(Statistiques::GRAPH_CAMEMBERT,$nb_inscrits_par_legende,'', array(900, 700)); |
$graph = $this->statistiques->combinerGraphiques($graph_france, $graph_autres, array(920, 1200)); |
$nb_inscrits_par_legende = array(); |
|
$inscrits_france = $nb_inscrits_par_code['fr']; |
|
unset($nb_inscrits_par_code['fr']); |
$somme_autres_pays = 0; |
|
foreach ($nb_inscrits_par_code as $code_pays => $inscrits_pays) { |
$label_pays = $this->convertirPourLegende($ids_zones_europe[$code_pays][2].' (%1.2f%%)'); |
$nb_inscrits_par_legende[$label_pays] = $inscrits_pays; |
$somme_autres_pays += $inscrits_pays; |
} |
|
$tableau_france_autres = array('France (%1.2f%%)' => $inscrits_france, 'Autres (%1.2f%%)' => $somme_autres_pays); |
|
$graph_france = $this->statistiques->genererGraphique(Statistiques::GRAPH_CAMEMBERT, $tableau_france_autres, '', array(320, 200)); |
$graph_autres = $this->statistiques->genererGraphique(Statistiques::GRAPH_CAMEMBERT, $nb_inscrits_par_legende, '', array(950, 900)); |
$graph = $this->statistiques->combinerGraphiques($graph_france, $graph_autres, array(920, 1100)); |
|
return $this->dessinerGraph($graph); |
} |
|
public function obtenirStatistiquesParPays($id_annuaire) { |
$controleur = new AnnuaireControleur(); |
|
$controleur = new AnnuaireControleur(); |
|
//$controleur = new AnnuaireControleur(); |
$modele_meta = new MetadonneeModele(); |
$modele_onto = new OntologieModele(); |
$id_champ = 12; |
$valeurs = $modele_meta->obtenirNombreValeurMetadonnee($id_champ); |
$id_onto = $modele_meta->obtenirOntologieLieeAChampParId($id_champ); |
$legendes = $modele_onto->chargerListeOntologie($id_onto); |
//$controleur = new AnnuaireControleur(); |
$modele_meta = new MetadonneeModele(); |
$modele_onto = new OntologieModele(); |
$id_champ = 12; |
$valeurs = $modele_meta->obtenirNombreValeurMetadonnee($id_champ); |
$id_onto = $modele_meta->obtenirOntologieLieeAChampParId($id_champ); |
$legendes = $modele_onto->chargerListeOntologie($id_onto); |
|
$valeurs_a_stat_code = array(); |
$valeurs_a_stat_legende = array(); |
|
foreach($valeurs as $valeur) { |
foreach ($valeurs as $valeur) { |
$valeurs_a_stat_code[$valeur['amv_valeur']] = $valeur['nb']; |
} |
|
foreach($legendes as $legende) { |
$legende_nom = $legende['amo_nom']; |
$legende_code = $legende['amo_id_ontologie']; |
foreach ($legendes as $legende) { |
$legende_nom = $legende['amo_nom']; |
$legende_code = $legende['amo_id_ontologie']; |
|
if(isset($valeurs_a_stat_code[$legende_code])) { |
if (isset($valeurs_a_stat_code[$legende_code])) { |
$valeurs_a_stat_legende[$legende_nom] = $valeurs_a_stat_code[$legende_code]; |
} |
} |
} |
} |
|
$graph = $this->statistiques->genererGraphique(Statistiques::GRAPH_CAMEMBERT,$valeurs_a_stat_legende); |
return $this->dessinerGraph($graph); |
|
return $this->dessinerGraph($graph); |
} |
|
public function obtenirStatistiquesParCritere($id_annuaire, $code_champ, $titre = '') { |
$modele_meta = new MetadonneeModele(); |
$modele_onto = new OntologieModele(); |
$id_champ = $modele_meta->renvoyerIdChampMetadonneeParAbreviation($id_annuaire, $code_champ); |
$valeurs = $modele_meta->obtenirNombreValeurMetadonnee($id_champ); |
$id_onto = $modele_meta->obtenirOntologieLieeAChampParId($id_champ); |
$legendes = $modele_onto->chargerListeOntologie($id_onto); |
|
$modele_meta = new MetadonneeModele(); |
$modele_onto = new OntologieModele(); |
$id_champ = $modele_meta->renvoyerIdChampMetadonneeParAbreviation($id_annuaire, $code_champ); |
$valeurs = $modele_meta->obtenirNombreValeurMetadonnee($id_champ); |
$id_onto = $modele_meta->obtenirOntologieLieeAChampParId($id_champ); |
$legendes = $modele_onto->chargerListeOntologie($id_onto); |
|
$valeurs_a_stat_code = array(); |
$valeurs_a_stat_legende = array(); |
|
|
$titre = $this->convertirPourLegende($titre); |
|
foreach($valeurs as $valeur) { |
foreach ($valeurs as $valeur) { |
$valeurs_a_stat_code[$valeur['amv_valeur']] = $valeur['nb']; |
} |
|
foreach($legendes as $legende) { |
$legende_nom = $this->convertirPourLegende($legende['amo_nom']); |
$legende_code = $legende['amo_id_ontologie']; |
|
if(isset($valeurs_a_stat_code[$legende_code])) { |
|
foreach ($legendes as $legende) { |
$legende_nom = $this->convertirPourLegende($legende['amo_nom']); |
$legende_code = $legende['amo_id_ontologie']; |
|
if (isset($valeurs_a_stat_code[$legende_code])) { |
$valeurs_a_stat_legende[$legende_nom] = $valeurs_a_stat_code[$legende_code]; |
} else { |
|
} |
} |
|
} |
} |
|
$graph = $this->statistiques->genererGraphique(Statistiques::GRAPH_CAMEMBERT,$valeurs_a_stat_legende, $titre, array(650, 400)); |
return $this->dessinerGraph($graph); |
|
} |
|
public function obtenirStatistiquesPourAnnee($id_annuaire, $annee = null) { |
|
$annee = ($annee == null) ? date("Y") : $annee; |
$annuaire_modele = new AnnuaireModele(); |
|
$valeurs_a_stat_code = array(); |
$valeurs_a_stat_legende = array(); |
|
$tab_mois = array("Jan","Fev","Mar","Avr","Mai","Juin","Juil","Aout","Sep","Oct","Nov","Dec"); |
|
$annee_debut = $annee; |
$mois = 1; |
170,7 → 159,7 |
$tps_courant = $tps_debut; |
|
$annee_courante = date("Y"); |
if($annee_fin == $annee_courante) { |
if ($annee_fin == $annee_courante) { |
$tps_fin = time();// jour courant |
} else { |
$tps_fin = mktime(0,0,0,1,1,$annee+1); |
178,9 → 167,8 |
|
//Requete par mois |
$i = 1; |
while ($tps_courant <= $tps_fin) { |
|
if (($mois)/12 > 1) { |
while ($tps_courant <= $tps_fin) { |
if ($mois/12 > 1) { |
$mois = 1; |
$annee = $annee+1; |
} |
187,7 → 175,7 |
|
$tps_mois_suivant = mktime(0,0,0,$mois+1,1,$annee); |
$nb_inscrits_dans_intervalle = $annuaire_modele->obtenirNombreInscriptionsDansIntervalleDate($id_annuaire, $tps_debut, $tps_courant); |
$valeurs_a_stat_legende[$tab_mois[$mois-1].' '.$annee] = $nb_inscrits_dans_intervalle; |
$valeurs_a_stat_legende[$this->tab_mois[$mois-1].' '.$annee] = $nb_inscrits_dans_intervalle; |
|
$tps_courant = $tps_mois_suivant; |
$mois++; |
201,21 → 189,18 |
} |
|
public function obtenirStatistiquesParAnnees($id_annuaire, $annee_fin = '') { |
$annuaire_modele = new AnnuaireModele(); |
|
$annuaire_modele = new AnnuaireModele(); |
|
$valeurs_a_stat_code = array(); |
$valeurs_a_stat_legende = array(); |
|
$tab_mois = array("Jan","Fev","Mar","Avr","Mai","Juin","Juil","Aout","Sep","Oct","Nov","Dec"); |
|
|
$annee_debut = 2002; |
$mois = 4; |
$annee = 2002; |
$tps_debut = mktime(0,0,0,$mois,1,$annee); |
$tps_courant = $tps_debut; |
|
if($annee_fin != '') { |
|
if ($annee_fin != '') { |
$tps_fin = mktime(0,0,0,1,1,$annee_fin); |
} else { |
$tps_fin = time();// jour courant |
223,19 → 208,18 |
|
//Requete par mois |
$i = 1; |
while ($tps_courant <= $tps_fin) { |
|
while ($tps_courant <= $tps_fin) { |
if (($mois)/12 > 1) { |
$mois = 1; |
$annee = $annee+1; |
} |
|
|
$tps_mois_suivant = mktime(0,0,0,$mois+1,1,$annee); |
|
|
$nb_inscrits_dans_intervalle = $annuaire_modele->obtenirNombreInscriptionsDansIntervalleDate($id_annuaire, $tps_debut, $tps_courant); |
|
$valeurs_a_stat_legende[$tab_mois[$mois-1].' '.$annee] = $nb_inscrits_dans_intervalle; |
|
|
$valeurs_a_stat_legende[$this->tab_mois[$mois-1].' '.$annee] = $nb_inscrits_dans_intervalle; |
|
$tps_courant = $tps_mois_suivant; |
$mois++; |
$i++; |
242,35 → 226,31 |
} |
|
$nom_axeX = 'Mois depuis le 1er avril 2002'; |
|
|
$graph = $this->statistiques->genererGraphique(Statistiques::GRAPH_COURBE,$valeurs_a_stat_legende, '', array(500,490), $nom_axeX, ''); |
return $this->dessinerGraph($graph); |
|
return $this->dessinerGraph($graph); |
} |
|
public function obtenirStatistiquesModificationsProfil($id_annuaire, $annee_fin = '') { |
$modele = new StatistiqueModele(); |
|
$modele = new StatistiqueModele(); |
|
$valeurs_a_stat_code = array(); |
$valeurs_a_stat_legende = array(); |
|
$tab_mois = array("Jan","Fev","Mar","Avr","Mai","Juin","Juil","Aout","Sep","Oct","Nov","Dec"); |
|
|
$annee_debut = 2010; |
$mois = 1; |
$annee = 2010; |
$tps_debut = mktime(0,0,0,$mois,1,$annee); |
$tps_courant = $tps_debut; |
|
|
if($annee_fin != '') { |
$tps_fin = mktime(0,0,0,1,1,$annee_fin); |
} else { |
$today = date_parse(date('Y-m-d H:i:s')); |
|
|
$annee_fin_today = $today['year']; |
$mois_fin_today = $today['month']; |
|
|
if($annee_debut == $annee_fin_today) { |
$tps_fin = mktime(0,0,0,$mois_fin_today+1,1,$annee_fin_today); |
} else { |
277,22 → 257,21 |
$tps_fin = time();// jour courant |
} |
} |
|
|
//Requete par mois |
$i = 1; |
while ($tps_courant <= $tps_fin) { |
|
while ($tps_courant <= $tps_fin) { |
if (($mois)/12 > 1) { |
$mois = 1; |
$annee = $annee+1; |
} |
|
|
$tps_mois_suivant = mktime(0,0,0,$mois+1,1,$annee); |
|
|
$nb_modif_dans_intervalle = $modele->obtenirEvenementsDansIntervalle($id_annuaire,'modification', $tps_debut, $tps_courant); |
|
$valeurs_a_stat_legende[$tab_mois[$mois-1].' '.$annee] = $nb_modif_dans_intervalle; |
|
|
$valeurs_a_stat_legende[$this->tab_mois[$mois-1].' '.$annee] = $nb_modif_dans_intervalle; |
|
$tps_courant = $tps_mois_suivant; |
$mois++; |
$i++; |
299,14 → 278,12 |
} |
|
$nom_axeX = 'Mois depuis le 1er juillet 2010'; |
|
|
$graph = $this->statistiques->genererGraphique(Statistiques::GRAPH_COURBE,$valeurs_a_stat_legende, '', array(500,490), $nom_axeX, ''); |
return $this->dessinerGraph($graph); |
|
return $this->dessinerGraph($graph); |
} |
|
public function ajouterEvenementStatistique($id_annuaire, $id_utilisateur, $type) { |
|
$this->chargerModele('StatistiqueModele'); |
$this->StatistiqueModele->ajouterEvenementStatistique($id_annuaire, $id_utilisateur, $type); |
|
313,7 → 290,6 |
} |
|
public function obtenirDerniersEvenementsStatistique($id_annuaire, $type) { |
|
$this->chargerModele('StatistiqueModele'); |
return $this->StatistiqueModele->obtenirDerniersEvenementsStatistique($id_annuaire, $type); |
|
323,9 → 299,8 |
return $this->statistiques->dessinerGraph($graph); |
} |
|
private function convertirPourLegende($texte) { |
|
if(trim($texte) == '') { |
private function convertirPourLegende($texte) { |
if (trim($texte) == '') { |
$texte = '' ; |
} |
|
359,7 → 334,7 |
'C', 'Y', 'N', |
),$texte); |
|
return $texte; |
return $texte; |
} |
|
private function miniQuote($chaine) { |