Subversion Repositories Applications.annuaire

Rev

Rev 294 | Rev 429 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 294 Rev 404
1
<?php
1
<?php
2
/**
2
/**
3
* PHP Version 5
3
* PHP Version 5
4
*
4
*
5
* @category  PHP
5
* @category  PHP
6
* @package   annuaire
6
* @package   annuaire
7
* @author    aurelien <aurelien@tela-botanica.org>
7
* @author    aurelien <aurelien@tela-botanica.org>
8
* @copyright 2010 Tela-Botanica
8
* @copyright 2010 Tela-Botanica
9
* @license   http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL
9
* @license   http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL
10
* @version   SVN: <svn_id>
10
* @version   SVN: <svn_id>
11
* @link      /doc/annuaire/
11
* @link      /doc/annuaire/
12
*/
12
*/
13
 
13
 
14
class StatistiqueControleur extends AppControleur {
14
class StatistiqueControleur extends AppControleur {
15
 
15
 
16
	private $statistiques = null;
16
	private $statistiques = null;
17
 
17
 
18
	public function StatistiqueControleur() {
18
	public function StatistiqueControleur() {
19
		
19
		
20
		$this->__construct();
20
		$this->__construct();
21
		$this->statistiques = Composant::fabrique('statistiques', array());
21
		$this->statistiques = Composant::fabrique('statistiques', array());
22
	}
22
	}
23
	
23
	
24
	public function obtenirStatistiquesInscritsParContinents($id_annuaire) {
24
	public function obtenirStatistiquesInscritsParContinents($id_annuaire) {
25
		
25
		
26
		$cartographe = new CartoControleur();
26
		$cartographe = new CartoControleur();
27
		$annuaire_controleur = new AnnuaireControleur();
27
		$annuaire_controleur = new AnnuaireControleur();
28
		
28
		
29
		$continents = array('Afrique (%1.2f%%)' => 'pays_afrique',
29
		$continents = array('Afrique (%1.2f%%)' => 'pays_afrique',
30
		 							'Amerique du nord (%1.2f%%)' => 'pays_nord_amerique', 
30
		 							'Amerique du nord (%1.2f%%)' => 'pays_nord_amerique', 
31
		 							'Asie (%1.2f%%)' => 'pays_asie', 
31
		 							'Asie (%1.2f%%)' => 'pays_asie', 
32
		 							'Europe (%1.2f%%)' => 'pays_europe', 
32
		 							'Europe (%1.2f%%)' => 'pays_europe', 
33
		 							'Oceanie (%1.2f%%)' => 'pays_oceanie', 
33
		 							'Oceanie (%1.2f%%)' => 'pays_oceanie', 
34
		 							'Amerique du sud (%1.2f%%)' => 'pays_sud_amerique', 
34
		 							'Amerique du sud (%1.2f%%)' => 'pays_sud_amerique', 
35
		 							'Moyen Orient (%1.2f%%)' => 'pays_moyen_orient');
35
		 							'Moyen Orient (%1.2f%%)' => 'pays_moyen_orient');
36
				
36
				
37
	    // pour chacun des continents, on fait la somme des membres de sa zone
37
	    // pour chacun des continents, on fait la somme des membres de sa zone
38
    	foreach($continents as $id_continent => $continent) {
38
    	foreach($continents as $id_continent => $continent) {
39
    		$zones_continent_ids = $cartographe->chargerInformationsPaysDuContinentsCsv($continent);
39
    		$zones_continent_ids = $cartographe->chargerInformationsPaysDuContinentsCsv($continent);
40
    		$zones_continent_ids = array_map(array($this,'miniQuote'), array_keys($zones_continent_ids));    		
40
    		$zones_continent_ids = array_map(array($this,'miniQuote'), array_keys($zones_continent_ids));    		
41
    		$nb_inscrits[$id_continent] = array_sum($annuaire_controleur->chargerNombreAnnuaireListeInscritsParPays($id_annuaire, $zones_continent_ids));
41
    		$nb_inscrits[$id_continent] = array_sum($annuaire_controleur->chargerNombreAnnuaireListeInscritsParPays($id_annuaire, $zones_continent_ids));
42
    	}
42
    	}
43
    	    	
43
    	    	
44
    	$graph = $this->statistiques->genererGraphique(Statistiques::GRAPH_CAMEMBERT,$nb_inscrits,'', array(650, 500));
44
    	$graph = $this->statistiques->genererGraphique(Statistiques::GRAPH_CAMEMBERT,$nb_inscrits,'', array(650, 500));
45
    	
45
    	
46
    	return $this->dessinerGraph($graph);
46
    	return $this->dessinerGraph($graph);
47
	}
47
	}
48
	
48
	
49
	public function obtenirStatistiquesInscritsEurope($id_annuaire) {
49
	public function obtenirStatistiquesInscritsEurope($id_annuaire) {
50
		
50
		
51
		$cartographe = new CartoControleur();
51
		$cartographe = new CartoControleur();
52
		$annuaire_controleur = new AnnuaireControleur();
52
		$annuaire_controleur = new AnnuaireControleur();
53
		$cartographe = new CartoControleur();
53
		$cartographe = new CartoControleur();
54
		
54
		
55
		$ids_zones_europe = $cartographe->chargerInformationsPaysDuContinentsCsv('pays_europe');
55
		$ids_zones_europe = $cartographe->chargerInformationsPaysDuContinentsCsv('pays_europe');
56
				
56
				
57
		$codes_zones_europe = array_map(array($this,'miniQuote'), array_keys($ids_zones_europe));    
57
		$codes_zones_europe = array_map(array($this,'miniQuote'), array_keys($ids_zones_europe));    
58
 
58
 
59
		$titre_zone = $this->convertirPourLegende($zone[2]);
59
		$titre_zone = $this->convertirPourLegende($zone[2]);
60
    	$nb_inscrits_par_code = $annuaire_controleur->chargerNombreAnnuaireListeInscritsParPays($id_annuaire, $codes_zones_europe);
60
    	$nb_inscrits_par_code = $annuaire_controleur->chargerNombreAnnuaireListeInscritsParPays($id_annuaire, $codes_zones_europe);
61
		
61
		
62
    	$nb_inscrits_par_legende = array();
62
    	$nb_inscrits_par_legende = array();
63
    	
63
    	
64
    	$inscrits_france = $nb_inscrits_par_code['fr'];
64
    	$inscrits_france = $nb_inscrits_par_code['fr'];
65
    	
65
    	
66
    	unset($nb_inscrits_par_code['fr']);
66
    	unset($nb_inscrits_par_code['fr']);
67
    	$somme_autres_pays = 0;
67
    	$somme_autres_pays = 0;
68
    	
68
    	
69
    	foreach($nb_inscrits_par_code as $code_pays => $inscrits_pays) {
69
    	foreach($nb_inscrits_par_code as $code_pays => $inscrits_pays) {
70
    		
70
    		
71
    		$label_pays = $this->convertirPourLegende($ids_zones_europe[$code_pays][2].' (%1.2f%%)');
71
    		$label_pays = $this->convertirPourLegende($ids_zones_europe[$code_pays][2].' (%1.2f%%)');
72
    		$nb_inscrits_par_legende[$label_pays] = $inscrits_pays;
72
    		$nb_inscrits_par_legende[$label_pays] = $inscrits_pays;
73
    		$somme_autres_pays += $inscrits_pays;
73
    		$somme_autres_pays += $inscrits_pays;
74
    	}
74
    	}
75
    	    	
75
    	    	
76
    	$tableau_france_autres = array('France (%1.2f%%)' => $inscrits_france, 'Autres (%1.2f%%)' => $somme_autres_pays);
76
    	$tableau_france_autres = array('France (%1.2f%%)' => $inscrits_france, 'Autres (%1.2f%%)' => $somme_autres_pays);
77
    	
77
    	
78
    	$graph_france = $this->statistiques->genererGraphique(Statistiques::GRAPH_CAMEMBERT,$tableau_france_autres,'', array(320, 200));
78
    	$graph_france = $this->statistiques->genererGraphique(Statistiques::GRAPH_CAMEMBERT,$tableau_france_autres,'', array(320, 200));
79
		$graph_autres = $this->statistiques->genererGraphique(Statistiques::GRAPH_CAMEMBERT,$nb_inscrits_par_legende,'', array(900, 700));
79
		$graph_autres = $this->statistiques->genererGraphique(Statistiques::GRAPH_CAMEMBERT,$nb_inscrits_par_legende,'', array(900, 700));
80
		$graph = $this->statistiques->combinerGraphiques($graph_france, $graph_autres, array(920, 1200));
80
		$graph = $this->statistiques->combinerGraphiques($graph_france, $graph_autres, array(920, 1200));
81
		
81
		
82
		return $this->dessinerGraph($graph);
82
		return $this->dessinerGraph($graph);
83
	}
83
	}
84
 
84
 
85
	public function obtenirStatistiquesParPays($id_annuaire) {
85
	public function obtenirStatistiquesParPays($id_annuaire) {
86
 
86
 
87
	    $controleur = new AnnuaireControleur();
87
	    $controleur = new AnnuaireControleur();
88
	   	
88
	   	
89
	   	//$controleur = new AnnuaireControleur();
89
	   	//$controleur = new AnnuaireControleur();
90
	    $modele_meta = new MetadonneeModele();
90
	    $modele_meta = new MetadonneeModele();
91
	   	$modele_onto = new OntologieModele();
91
	   	$modele_onto = new OntologieModele();
92
	   	$id_champ = 12;
92
	   	$id_champ = 12;
93
	    $valeurs = $modele_meta->obtenirNombreValeurMetadonnee($id_champ);
93
	    $valeurs = $modele_meta->obtenirNombreValeurMetadonnee($id_champ);
94
	    $id_onto = $modele_meta->obtenirOntologieLieeAChampParId($id_champ);
94
	    $id_onto = $modele_meta->obtenirOntologieLieeAChampParId($id_champ);
95
	   	$legendes = $modele_onto->chargerListeOntologie($id_onto);
95
	   	$legendes = $modele_onto->chargerListeOntologie($id_onto);
96
 
96
 
97
		$valeurs_a_stat_code = array();
97
		$valeurs_a_stat_code = array();
98
		$valeurs_a_stat_legende = array();
98
		$valeurs_a_stat_legende = array();
99
 
99
 
100
		foreach($valeurs as $valeur) {
100
		foreach($valeurs as $valeur) {
101
			$valeurs_a_stat_code[$valeur['amv_valeur']] = $valeur['nb'];
101
			$valeurs_a_stat_code[$valeur['amv_valeur']] = $valeur['nb'];
102
		}
102
		}
103
 
103
 
104
	    foreach($legendes as $legende) {
104
	    foreach($legendes as $legende) {
105
	    	$legende_nom = $legende['amo_nom'];
105
	    	$legende_nom = $legende['amo_nom'];
106
	    	$legende_code = $legende['amo_id_ontologie'];
106
	    	$legende_code = $legende['amo_id_ontologie'];
107
 
107
 
108
	    	if(isset($valeurs_a_stat_code[$legende_code])) {
108
	    	if(isset($valeurs_a_stat_code[$legende_code])) {
109
				$valeurs_a_stat_legende[$legende_nom] = $valeurs_a_stat_code[$legende_code];
109
				$valeurs_a_stat_legende[$legende_nom] = $valeurs_a_stat_code[$legende_code];
110
	    	}
110
	    	}
111
	    }
111
	    }
112
 
112
 
113
		$graph = $this->statistiques->genererGraphique(Statistiques::GRAPH_CAMEMBERT,$valeurs_a_stat_legende);
113
		$graph = $this->statistiques->genererGraphique(Statistiques::GRAPH_CAMEMBERT,$valeurs_a_stat_legende);
114
	    return $this->dessinerGraph($graph);
114
	    return $this->dessinerGraph($graph);
115
 
115
 
116
	}
116
	}
117
 
117
 
118
	public function obtenirStatistiquesParCritere($id_annuaire, $code_champ, $titre = '') {
118
	public function obtenirStatistiquesParCritere($id_annuaire, $code_champ, $titre = '') {
119
 
119
 
120
	    $modele_meta = new MetadonneeModele();
120
	    $modele_meta = new MetadonneeModele();
121
	   	$modele_onto = new OntologieModele();
121
	   	$modele_onto = new OntologieModele();
122
	   	$id_champ = $modele_meta->renvoyerIdChampMetadonneeParAbreviation($id_annuaire, $code_champ);
122
	   	$id_champ = $modele_meta->renvoyerIdChampMetadonneeParAbreviation($id_annuaire, $code_champ);
123
	    $valeurs = $modele_meta->obtenirNombreValeurMetadonnee($id_champ);
123
	    $valeurs = $modele_meta->obtenirNombreValeurMetadonnee($id_champ);
124
	    $id_onto = $modele_meta->obtenirOntologieLieeAChampParId($id_champ);
124
	    $id_onto = $modele_meta->obtenirOntologieLieeAChampParId($id_champ);
125
	   	$legendes = $modele_onto->chargerListeOntologie($id_onto);
125
	   	$legendes = $modele_onto->chargerListeOntologie($id_onto);
126
	   	
126
	   	
127
		$valeurs_a_stat_code = array();
127
		$valeurs_a_stat_code = array();
128
		$valeurs_a_stat_legende = array();
128
		$valeurs_a_stat_legende = array();
129
				
129
				
130
		$titre = $this->convertirPourLegende($titre);
130
		$titre = $this->convertirPourLegende($titre);
131
 
131
 
132
		foreach($valeurs as $valeur) {
132
		foreach($valeurs as $valeur) {
133
			$valeurs_a_stat_code[$valeur['amv_valeur']] = $valeur['nb'];
133
			$valeurs_a_stat_code[$valeur['amv_valeur']] = $valeur['nb'];
134
		}
134
		}
135
		
135
		
136
	    foreach($legendes as $legende) {
136
	    foreach($legendes as $legende) {
137
	    	$legende_nom = $this->convertirPourLegende($legende['amo_nom']);
137
	    	$legende_nom = $this->convertirPourLegende($legende['amo_nom']);
138
	    	$legende_code = $legende['amo_id_ontologie'];
138
	    	$legende_code = $legende['amo_id_ontologie'];
139
	    	
139
	    	
140
	    	if(isset($valeurs_a_stat_code[$legende_code])) {
140
	    	if(isset($valeurs_a_stat_code[$legende_code])) {
141
				$valeurs_a_stat_legende[$legende_nom] = $valeurs_a_stat_code[$legende_code];
141
				$valeurs_a_stat_legende[$legende_nom] = $valeurs_a_stat_code[$legende_code];
142
	    	} else {
142
	    	} else {
143
	    		
143
	    		
144
	    	}
144
	    	}
145
	    }
145
	    }
146
	    
146
	    
147
		$graph = $this->statistiques->genererGraphique(Statistiques::GRAPH_CAMEMBERT,$valeurs_a_stat_legende, $titre, array(650, 400));
147
		$graph = $this->statistiques->genererGraphique(Statistiques::GRAPH_CAMEMBERT,$valeurs_a_stat_legende, $titre, array(650, 400));
148
		return $this->dessinerGraph($graph);
148
		return $this->dessinerGraph($graph);
149
		
149
		
150
	}
150
	}
-
 
151
	
-
 
152
	public function obtenirStatistiquesPourAnnee($id_annuaire, $annee = null) {
-
 
153
		
-
 
154
		$annee = ($annee == null) ? date("Y") : $annee; 
-
 
155
		$annuaire_modele = new AnnuaireModele();
-
 
156
		
-
 
157
		$valeurs_a_stat_code = array();
-
 
158
		$valeurs_a_stat_legende = array();
-
 
159
		 
-
 
160
		$tab_mois = array("Jan","Fev","Mar","Avr","Mai","Juin","Juil","Aout","Sep","Oct","Nov","Dec");
-
 
161
		
-
 
162
		$annee_debut = $annee;
-
 
163
		$mois = 1;
-
 
164
		$annee = $annee;
-
 
165
		$tps_debut = mktime(0,0,0,1,1,$annee);
-
 
166
		$tps_courant = $tps_debut;
-
 
167
		
-
 
168
		$annee_courante = date("Y");
-
 
169
		if($annee_fin == $annee_courante) {
-
 
170
			$tps_fin = time();// jour courant
-
 
171
		} else {
-
 
172
			$tps_fin = mktime(0,0,0,1,1,$annee+1);			
-
 
173
		}
-
 
174
		
-
 
175
		//Requete par mois
-
 
176
		$i = 1;
-
 
177
		while  ($tps_courant <= $tps_fin) {
-
 
178
				
-
 
179
			if (($mois)/12 > 1) {
-
 
180
				$mois = 1;
-
 
181
				$annee = $annee+1;
-
 
182
			}
-
 
183
				
-
 
184
			$tps_mois_suivant = mktime(0,0,0,$mois+1,1,$annee);
-
 
185
			$nb_inscrits_dans_intervalle = $annuaire_modele->obtenirNombreInscriptionsDansIntervalleDate($id_annuaire, $tps_debut, $tps_courant);	
-
 
186
			$valeurs_a_stat_legende[$tab_mois[$mois-1].' '.$annee] = $nb_inscrits_dans_intervalle;
-
 
187
				
-
 
188
			$tps_courant = $tps_mois_suivant;
-
 
189
			$mois++;
-
 
190
			$i++;
-
 
191
		}
-
 
192
		
-
 
193
		$nom_axeX = 'Mois depuis le 1er janvier '.$annee;
-
 
194
		
-
 
195
		$graph = $this->statistiques->genererGraphique(Statistiques::GRAPH_COURBE,$valeurs_a_stat_legende, '', array(500,490), $nom_axeX, '');
-
 
196
		return $this->dessinerGraph($graph);
-
 
197
	}
151
 
198
 
152
	public function obtenirStatistiquesParAnnees($id_annuaire, $annee_fin = '') {
199
	public function obtenirStatistiquesParAnnees($id_annuaire, $annee_fin = '') {
153
 
200
 
154
	    $annuaire_modele = new AnnuaireModele();
201
	    $annuaire_modele = new AnnuaireModele();
155
 
202
 
156
		$valeurs_a_stat_code = array();
203
		$valeurs_a_stat_code = array();
157
		$valeurs_a_stat_legende = array();
204
		$valeurs_a_stat_legende = array();
158
			        
205
			        
159
		$tab_mois = array("Jan","Fev","Mar","Avr","Mai","Juin","Juil","Aout","Sep","Oct","Nov","Dec");
206
		$tab_mois = array("Jan","Fev","Mar","Avr","Mai","Juin","Juil","Aout","Sep","Oct","Nov","Dec");
160
		
207
		
161
		$annee_debut = 2002;
208
		$annee_debut = 2002;
162
		$mois = 4;
209
		$mois = 4;
163
		$annee = 2002;
210
		$annee = 2002;
164
		$tps_debut = mktime(0,0,0,$mois,1,$annee);
211
		$tps_debut = mktime(0,0,0,$mois,1,$annee);
165
		$tps_courant = $tps_debut;
212
		$tps_courant = $tps_debut;
166
		
213
		
167
		if($annee_fin != '') {
214
		if($annee_fin != '') {
168
			$tps_fin = mktime(0,0,0,1,1,$annee_fin);
215
			$tps_fin = mktime(0,0,0,1,1,$annee_fin);
169
		} else {
216
		} else {
170
			$tps_fin = time();// jour courant
217
			$tps_fin = time();// jour courant
171
		}
218
		}
172
 
219
 
173
		//Requete par mois
220
		//Requete par mois
174
		$i = 1;
221
		$i = 1;
175
		while  ($tps_courant <= $tps_fin) {
222
		while  ($tps_courant <= $tps_fin) {
176
			
223
			
177
			if (($mois)/12 > 1) {
224
			if (($mois)/12 > 1) {
178
				$mois = 1;
225
				$mois = 1;
179
				$annee = $annee+1;
226
				$annee = $annee+1;
180
			}
227
			}
181
			
228
			
182
			$tps_mois_suivant = mktime(0,0,0,$mois+1,1,$annee);
229
			$tps_mois_suivant = mktime(0,0,0,$mois+1,1,$annee);
183
			
230
			
184
			$nb_inscrits_dans_intervalle = $annuaire_modele->obtenirNombreInscriptionsDansIntervalleDate($id_annuaire, $tps_debut, $tps_courant);
231
			$nb_inscrits_dans_intervalle = $annuaire_modele->obtenirNombreInscriptionsDansIntervalleDate($id_annuaire, $tps_debut, $tps_courant);
185
			
232
			
186
			$valeurs_a_stat_legende[$tab_mois[$mois-1].' '.$annee] = $nb_inscrits_dans_intervalle;
233
			$valeurs_a_stat_legende[$tab_mois[$mois-1].' '.$annee] = $nb_inscrits_dans_intervalle;
187
			
234
			
188
			$tps_courant = $tps_mois_suivant;
235
			$tps_courant = $tps_mois_suivant;
189
			$mois++;
236
			$mois++;
190
			$i++;
237
			$i++;
191
		}
238
		}
192
 
239
 
193
		$nom_axeX = 'Mois depuis le 1er avril 2002'; 
240
		$nom_axeX = 'Mois depuis le 1er avril 2002'; 
194
		
241
		
195
		$graph = $this->statistiques->genererGraphique(Statistiques::GRAPH_COURBE,$valeurs_a_stat_legende, '', array(500,490), $nom_axeX, '');
242
		$graph = $this->statistiques->genererGraphique(Statistiques::GRAPH_COURBE,$valeurs_a_stat_legende, '', array(500,490), $nom_axeX, '');
196
	    return $this->dessinerGraph($graph);
243
	    return $this->dessinerGraph($graph);
197
 
244
 
198
	}
245
	}
199
	
246
	
200
	public function obtenirStatistiquesModificationsProfil($id_annuaire, $annee_fin = '') {
247
	public function obtenirStatistiquesModificationsProfil($id_annuaire, $annee_fin = '') {
201
 
248
 
202
	    $modele = new StatistiqueModele();
249
	    $modele = new StatistiqueModele();
203
 
250
 
204
		$valeurs_a_stat_code = array();
251
		$valeurs_a_stat_code = array();
205
		$valeurs_a_stat_legende = array();
252
		$valeurs_a_stat_legende = array();
206
			        
253
			        
207
		$tab_mois = array("Jan","Fev","Mar","Avr","Mai","Juin","Juil","Aout","Sep","Oct","Nov","Dec");
254
		$tab_mois = array("Jan","Fev","Mar","Avr","Mai","Juin","Juil","Aout","Sep","Oct","Nov","Dec");
208
		
255
		
209
		$annee_debut = 2010;
256
		$annee_debut = 2010;
210
		$mois = 1;
257
		$mois = 1;
211
		$annee = 2010;
258
		$annee = 2010;
212
		$tps_debut = mktime(0,0,0,$mois,1,$annee);
259
		$tps_debut = mktime(0,0,0,$mois,1,$annee);
213
		$tps_courant = $tps_debut;
260
		$tps_courant = $tps_debut;
214
		
261
		
215
		if($annee_fin != '') {
262
		if($annee_fin != '') {
216
			$tps_fin = mktime(0,0,0,1,1,$annee_fin);
263
			$tps_fin = mktime(0,0,0,1,1,$annee_fin);
217
		} else {
264
		} else {
218
			$today = date_parse(date('Y-m-d H:i:s'));
265
			$today = date_parse(date('Y-m-d H:i:s'));
219
			
266
			
220
			$annee_fin_today = $today['year'];
267
			$annee_fin_today = $today['year'];
221
			$mois_fin_today = $today['month'];
268
			$mois_fin_today = $today['month'];
222
						
269
						
223
			if($annee_debut == $annee_fin_today) {
270
			if($annee_debut == $annee_fin_today) {
224
				$tps_fin = mktime(0,0,0,$mois_fin_today+1,1,$annee_fin_today);
271
				$tps_fin = mktime(0,0,0,$mois_fin_today+1,1,$annee_fin_today);
225
			} else {
272
			} else {
226
				$tps_fin = time();// jour courant
273
				$tps_fin = time();// jour courant
227
			}
274
			}
228
		}
275
		}
229
		
276
		
230
		//Requete par mois
277
		//Requete par mois
231
		$i = 1;
278
		$i = 1;
232
		while  ($tps_courant <= $tps_fin) {
279
		while  ($tps_courant <= $tps_fin) {
233
			
280
			
234
			if (($mois)/12 > 1) {
281
			if (($mois)/12 > 1) {
235
				$mois = 1;
282
				$mois = 1;
236
				$annee = $annee+1;
283
				$annee = $annee+1;
237
			}
284
			}
238
			
285
			
239
			$tps_mois_suivant = mktime(0,0,0,$mois+1,1,$annee);
286
			$tps_mois_suivant = mktime(0,0,0,$mois+1,1,$annee);
240
			
287
			
241
			$nb_modif_dans_intervalle = $modele->obtenirEvenementsDansIntervalle($id_annuaire,'modification', $tps_debut, $tps_courant);
288
			$nb_modif_dans_intervalle = $modele->obtenirEvenementsDansIntervalle($id_annuaire,'modification', $tps_debut, $tps_courant);
242
			
289
			
243
			$valeurs_a_stat_legende[$tab_mois[$mois-1].' '.$annee] = $nb_modif_dans_intervalle;
290
			$valeurs_a_stat_legende[$tab_mois[$mois-1].' '.$annee] = $nb_modif_dans_intervalle;
244
			
291
			
245
			$tps_courant = $tps_mois_suivant;
292
			$tps_courant = $tps_mois_suivant;
246
			$mois++;
293
			$mois++;
247
			$i++;
294
			$i++;
248
		}
295
		}
249
 
296
 
250
		$nom_axeX = 'Mois depuis le 1er juillet 2010'; 
297
		$nom_axeX = 'Mois depuis le 1er juillet 2010'; 
251
		
298
		
252
		$graph = $this->statistiques->genererGraphique(Statistiques::GRAPH_COURBE,$valeurs_a_stat_legende, '', array(500,490), $nom_axeX, '');
299
		$graph = $this->statistiques->genererGraphique(Statistiques::GRAPH_COURBE,$valeurs_a_stat_legende, '', array(500,490), $nom_axeX, '');
253
	    return $this->dessinerGraph($graph);
300
	    return $this->dessinerGraph($graph);
254
 
301
 
255
	}
302
	}
256
	
303
	
257
	public function ajouterEvenementStatistique($id_annuaire, $id_utilisateur, $type) {
304
	public function ajouterEvenementStatistique($id_annuaire, $id_utilisateur, $type) {
258
		
305
		
259
		$this->chargerModele('StatistiqueModele');	
306
		$this->chargerModele('StatistiqueModele');	
260
		$this->StatistiqueModele->ajouterEvenementStatistique($id_annuaire, $id_utilisateur, $type);
307
		$this->StatistiqueModele->ajouterEvenementStatistique($id_annuaire, $id_utilisateur, $type);
261
		
308
		
262
	}
309
	}
263
	
310
	
264
	public function obtenirDerniersEvenementsStatistique($id_annuaire, $type) {
311
	public function obtenirDerniersEvenementsStatistique($id_annuaire, $type) {
265
		
312
		
266
		$this->chargerModele('StatistiqueModele');	
313
		$this->chargerModele('StatistiqueModele');	
267
		return $this->StatistiqueModele->obtenirDerniersEvenementsStatistique($id_annuaire, $type);
314
		return $this->StatistiqueModele->obtenirDerniersEvenementsStatistique($id_annuaire, $type);
268
		
315
		
269
	}
316
	}
270
	
317
	
271
	private function dessinerGraph($graph) {
318
	private function dessinerGraph($graph) {
272
		return $this->statistiques->dessinerGraph($graph);
319
		return $this->statistiques->dessinerGraph($graph);
273
	}
320
	}
274
	
321
	
275
	private function convertirPourLegende($texte) {	
322
	private function convertirPourLegende($texte) {	
276
 
323
 
277
		if(trim($texte) == '') {
324
		if(trim($texte) == '') {
278
			$texte = '' ;
325
			$texte = '' ;
279
		}
326
		}
280
 
327
 
281
		$texte = str_replace(
328
		$texte = str_replace(
282
			array(
329
			array(
283
				'à', 'â', 'ä', 'á', 'ã', 'å',
330
				'à', 'â', 'ä', 'á', 'ã', 'å',
284
				'î', 'ï', 'ì', 'í', 
331
				'î', 'ï', 'ì', 'í', 
285
				'ô', 'ö', 'ò', 'ó', 'õ', 'ø', 
332
				'ô', 'ö', 'ò', 'ó', 'õ', 'ø', 
286
				'ù', 'û', 'ü', 'ú', 
333
				'ù', 'û', 'ü', 'ú', 
287
				'é', 'è', 'ê', 'ë', 
334
				'é', 'è', 'ê', 'ë', 
288
				'ç', 'ÿ', 'ñ',
335
				'ç', 'ÿ', 'ñ',
289
				'À', 'Â', 'Ä', 'Á', 'Ã', 'Å',
336
				'À', 'Â', 'Ä', 'Á', 'Ã', 'Å',
290
				'Î', 'Ï', 'Ì', 'Í', 
337
				'Î', 'Ï', 'Ì', 'Í', 
291
				'Ô', 'Ö', 'Ò', 'Ó', 'Õ', 'Ø', 
338
				'Ô', 'Ö', 'Ò', 'Ó', 'Õ', 'Ø', 
292
				'Ù', 'Û', 'Ü', 'Ú', 
339
				'Ù', 'Û', 'Ü', 'Ú', 
293
				'É', 'È', 'Ê', 'Ë', 
340
				'É', 'È', 'Ê', 'Ë', 
294
				'Ç', 'Ÿ', 'Ñ',
341
				'Ç', 'Ÿ', 'Ñ',
295
			),
342
			),
296
			array(
343
			array(
297
				'a', 'a', 'a', 'a', 'a', 'a', 
344
				'a', 'a', 'a', 'a', 'a', 'a', 
298
				'i', 'i', 'i', 'i', 
345
				'i', 'i', 'i', 'i', 
299
				'o', 'o', 'o', 'o', 'o', 'o', 
346
				'o', 'o', 'o', 'o', 'o', 'o', 
300
				'u', 'u', 'u', 'u', 
347
				'u', 'u', 'u', 'u', 
301
				'e', 'e', 'e', 'e', 
348
				'e', 'e', 'e', 'e', 
302
				'c', 'y', 'n', 
349
				'c', 'y', 'n', 
303
				'A', 'A', 'A', 'A', 'A', 'A', 
350
				'A', 'A', 'A', 'A', 'A', 'A', 
304
				'I', 'I', 'I', 'I', 
351
				'I', 'I', 'I', 'I', 
305
				'O', 'O', 'O', 'O', 'O', 'O', 
352
				'O', 'O', 'O', 'O', 'O', 'O', 
306
				'U', 'U', 'U', 'U', 
353
				'U', 'U', 'U', 'U', 
307
				'E', 'E', 'E', 'E', 
354
				'E', 'E', 'E', 'E', 
308
				'C', 'Y', 'N', 
355
				'C', 'Y', 'N', 
309
			),$texte);
356
			),$texte);
310
		
357
		
311
		return $texte;	
358
		return $texte;	
312
	}
359
	}
313
	
360
	
314
	private function miniQuote($chaine) {
361
	private function miniQuote($chaine) {
315
		return "'".$chaine."'";
362
		return "'".$chaine."'";
316
	}
363
	}
317
}
364
}
318
?>
365
?>