Subversion Repositories Applications.annuaire

Rev

Rev 429 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 429 Rev 442
Line 16... Line 16...
16
	private $statistiques = null;
16
	private $statistiques = null;
Line 17... Line 17...
17
 
17
 
18
	private $champ_pays = '12';
18
	private $champ_pays = '12';
19
	private $champ_rapport_activite_bota = '102';
19
	private $champ_rapport_activite_bota = '102';
-
 
20
	private $champ_experience_bota = '4';
Line 20... Line 21...
20
	private $champ_experience_bota = '4';
21
	private $tab_mois = array('Jan','Fev','Mar','Avr','Mai','Juin','Juil','Aout','Sep','Oct','Nov','Dec');
21
 
-
 
22
	public function StatistiqueControleur() {
22
	
23
		
23
	public function StatistiqueControleur() {
24
		$this->__construct();
24
		$this->__construct();
Line 25... Line 25...
25
		$this->statistiques = Composant::fabrique('statistiques', array());
25
		$this->statistiques = Composant::fabrique('statistiques', array());
26
	}
-
 
27
	
26
	}
28
	public function obtenirStatistiquesInscritsParContinents($id_annuaire) {
27
	
Line -... Line 28...
-
 
28
	public function obtenirStatistiquesInscritsParContinents($id_annuaire) {
29
		
29
		$cartographe = new CartoControleur();
30
		$cartographe = new CartoControleur();
30
		$annuaire_controleur = new AnnuaireControleur();
31
		$annuaire_controleur = new AnnuaireControleur();
31
		
32
		
32
		$continents = array(
33
		$continents = array('Afrique (%1.2f%%)' => 'pays_afrique',
33
			'Afrique (%1.2f%%)' => 'pays_afrique',
34
		 							'Amerique du nord (%1.2f%%)' => 'pays_nord_amerique', 
34
			'Amerique du nord (%1.2f%%)' => 'pays_nord_amerique', 
Line 49... Line 49...
49
    	
49
 
50
    	return $this->dessinerGraph($graph);
50
		return $this->dessinerGraph($graph);
Line 51... Line 51...
51
	}
51
	}
52
	
-
 
53
	public function obtenirStatistiquesInscritsEurope($id_annuaire) {
52
	
54
		
53
	public function obtenirStatistiquesInscritsEurope($id_annuaire) {
55
		$cartographe = new CartoControleur();
54
		$cartographe = new CartoControleur();
Line 56... Line 55...
56
		$annuaire_controleur = new AnnuaireControleur();
55
		$annuaire_controleur = new AnnuaireControleur();
Line 69... Line 68...
69
    	
68
 
70
    	unset($nb_inscrits_par_code['fr']);
69
		unset($nb_inscrits_par_code['fr']);
Line 71... Line 70...
71
    	$somme_autres_pays = 0;
70
		$somme_autres_pays = 0;
72
    	
-
 
73
    	foreach($nb_inscrits_par_code as $code_pays => $inscrits_pays) {
71
 
74
    		
72
		foreach ($nb_inscrits_par_code as $code_pays => $inscrits_pays) {
75
    		$label_pays = $this->convertirPourLegende($ids_zones_europe[$code_pays][2].' (%1.2f%%)');
73
			$label_pays = $this->convertirPourLegende($ids_zones_europe[$code_pays][2].' (%1.2f%%)');
76
    		$nb_inscrits_par_legende[$label_pays] = $inscrits_pays;
74
			$nb_inscrits_par_legende[$label_pays] = $inscrits_pays;
Line 77... Line 75...
77
    		$somme_autres_pays += $inscrits_pays;
75
			$somme_autres_pays += $inscrits_pays;
Line 78... Line 76...
78
    	}
76
		}
79
    	    	
77
 
80
    	$tableau_france_autres = array('France (%1.2f%%)' => $inscrits_france, 'Autres (%1.2f%%)' => $somme_autres_pays);
78
		$tableau_france_autres = array('France (%1.2f%%)' => $inscrits_france, 'Autres (%1.2f%%)' => $somme_autres_pays);
Line 81... Line 79...
81
    	
79
 
82
    	$graph_france = $this->statistiques->genererGraphique(Statistiques::GRAPH_CAMEMBERT,$tableau_france_autres,'', array(320, 200));
80
		$graph_france = $this->statistiques->genererGraphique(Statistiques::GRAPH_CAMEMBERT, $tableau_france_autres, '', array(320, 200));
Line 83... Line 81...
83
		$graph_autres = $this->statistiques->genererGraphique(Statistiques::GRAPH_CAMEMBERT,$nb_inscrits_par_legende,'', array(900, 700));
81
		$graph_autres = $this->statistiques->genererGraphique(Statistiques::GRAPH_CAMEMBERT, $nb_inscrits_par_legende, '', array(930, 900));
84
		$graph = $this->statistiques->combinerGraphiques($graph_france, $graph_autres, array(920, 1200));
-
 
85
		
82
		$graph = $this->statistiques->combinerGraphiques($graph_france, $graph_autres, array(940, 1110));
Line 86... Line 83...
86
		return $this->dessinerGraph($graph);
83
		
87
	}
84
		return $this->dessinerGraph($graph);
88
 
85
	}
Line 114... Line 111...
114
	    	}
111
			}
115
	    }
112
		}
Line 116... Line 113...
116
 
113
 
117
		$graph = $this->statistiques->genererGraphique(Statistiques::GRAPH_CAMEMBERT,$valeurs_a_stat_legende);
114
		$graph = $this->statistiques->genererGraphique(Statistiques::GRAPH_CAMEMBERT,$valeurs_a_stat_legende);
118
	    return $this->dessinerGraph($graph);
-
 
119
 
115
		return $this->dessinerGraph($graph);
Line 120... Line 116...
120
	}
116
	}
121
 
-
 
122
	public function obtenirStatistiquesParCritere($id_annuaire, $code_champ, $titre = '') {
117
 
123
 
118
	public function obtenirStatistiquesParCritere($id_annuaire, $code_champ, $titre = '') {
124
	    $modele_meta = new MetadonneeModele();
119
		$modele_meta = new MetadonneeModele();
125
	   	$modele_onto = new OntologieModele();
120
		$modele_onto = new OntologieModele();
126
	   	$id_champ = $modele_meta->renvoyerIdChampMetadonneeParAbreviation($id_annuaire, $code_champ);
121
		$id_champ = $modele_meta->renvoyerIdChampMetadonneeParAbreviation($id_annuaire, $code_champ);
Line 141... Line 136...
141
	    	$legende_nom = $this->convertirPourLegende($legende['amo_nom']);
136
			$legende_nom = $this->convertirPourLegende($legende['amo_nom']);
142
	    	$legende_code = $legende['amo_id_ontologie'];
137
			$legende_code = $legende['amo_id_ontologie'];
Line 143... Line 138...
143
	    	
138
 
144
	    	if(isset($valeurs_a_stat_code[$legende_code])) {
139
			if (isset($valeurs_a_stat_code[$legende_code])) {
145
				$valeurs_a_stat_legende[$legende_nom] = $valeurs_a_stat_code[$legende_code];
-
 
146
	    	} else {
-
 
147
	    		
140
				$valeurs_a_stat_legende[$legende_nom] = $valeurs_a_stat_code[$legende_code];
148
	    	}
141
			}
Line 149... Line 142...
149
	    }
142
		}
150
	    
143
 
151
		$graph = $this->statistiques->genererGraphique(Statistiques::GRAPH_CAMEMBERT,$valeurs_a_stat_legende, $titre, array(650, 400));
-
 
152
		return $this->dessinerGraph($graph);
144
		$graph = $this->statistiques->genererGraphique(Statistiques::GRAPH_CAMEMBERT,$valeurs_a_stat_legende, $titre, array(650, 400));
Line 153... Line 145...
153
		
145
		return $this->dessinerGraph($graph);
154
	}
-
 
155
 
146
	}
156
	public function obtenirStatistiquesPourAnnee($id_annuaire, $annee = null) {
147
 
Line 157... Line 148...
157
		
148
	public function obtenirStatistiquesPourAnnee($id_annuaire, $annee = null) {
158
		$annee = ($annee == null) ? date("Y") : $annee; 
149
		$annee = ($annee == null) ? date("Y") : $annee; 
Line 159... Line -...
159
		$annuaire_modele = new AnnuaireModele();
-
 
160
		
-
 
161
		$valeurs_a_stat_code = array();
150
		$annuaire_modele = new AnnuaireModele();
162
		$valeurs_a_stat_legende = array();
151
		
163
		 
152
		$valeurs_a_stat_code = array();
164
		$tab_mois = array("Jan","Fev","Mar","Avr","Mai","Juin","Juil","Aout","Sep","Oct","Nov","Dec");
153
		$valeurs_a_stat_legende = array();
165
		
154
		
Line 177... Line 166...
177
		}
166
		}
Line 178... Line 167...
178
		
167
		
179
		//Requete par mois
168
		//Requete par mois
180
		$i = 1;
169
		$i = 1;
181
		while  ($tps_courant <= $tps_fin) {
-
 
182
				
170
		while ($tps_courant <= $tps_fin) {
183
			if (($mois)/12 > 1) {
171
			if ($mois/12 > 1) {
184
				$mois = 1;
172
				$mois = 1;
185
				$annee = $annee+1;
173
				$annee = $annee+1;
Line 186... Line 174...
186
			}
174
			}
187
				
175
				
188
			$tps_mois_suivant = mktime(0,0,0,$mois+1,1,$annee);
176
			$tps_mois_suivant = mktime(0,0,0,$mois+1,1,$annee);
Line 189... Line 177...
189
			$nb_inscrits_dans_intervalle = $annuaire_modele->obtenirNombreInscriptionsDansIntervalleDate($id_annuaire, $tps_debut, $tps_courant);	
177
			$nb_inscrits_dans_intervalle = $annuaire_modele->obtenirNombreInscriptionsDansIntervalleDate($id_annuaire, $tps_debut, $tps_courant);	
190
			$valeurs_a_stat_legende[$tab_mois[$mois-1].' '.$annee] = $nb_inscrits_dans_intervalle;
178
			$valeurs_a_stat_legende[$this->tab_mois[$mois-1].' '.$annee] = $nb_inscrits_dans_intervalle;
191
				
179
				
192
			$tps_courant = $tps_mois_suivant;
180
			$tps_courant = $tps_mois_suivant;
Line 199... Line 187...
199
		$graph = $this->statistiques->genererGraphique(Statistiques::GRAPH_COURBE,$valeurs_a_stat_legende, '', array(500,490), $nom_axeX, '');
187
		$graph = $this->statistiques->genererGraphique(Statistiques::GRAPH_COURBE,$valeurs_a_stat_legende, '', array(500,490), $nom_axeX, '');
200
		return $this->dessinerGraph($graph);
188
		return $this->dessinerGraph($graph);
201
	}
189
	}
Line 202... Line 190...
202
 
190
 
203
	public function obtenirStatistiquesParAnnees($id_annuaire, $annee_fin = '') {
-
 
204
 
191
	public function obtenirStatistiquesParAnnees($id_annuaire, $annee_fin = '') {
Line 205... Line 192...
205
	    $annuaire_modele = new AnnuaireModele();
192
		$annuaire_modele = new AnnuaireModele();
206
 
193
 
Line 207... Line -...
207
		$valeurs_a_stat_code = array();
-
 
208
		$valeurs_a_stat_legende = array();
-
 
209
			        
194
		$valeurs_a_stat_code = array();
210
		$tab_mois = array("Jan","Fev","Mar","Avr","Mai","Juin","Juil","Aout","Sep","Oct","Nov","Dec");
195
		$valeurs_a_stat_legende = array();
211
		
196
 
212
		$annee_debut = 2002;
197
		$annee_debut = 2002;
213
		$mois = 4;
198
		$mois = 4;
Line 222... Line 207...
222
		}
207
		}
Line 223... Line 208...
223
 
208
 
224
		//Requete par mois
209
		//Requete par mois
225
		$i = 1;
210
		$i = 1;
226
		while  ($tps_courant <= $tps_fin) {
-
 
227
			
211
		while ($tps_courant <= $tps_fin) {
228
			if (($mois)/12 > 1) {
212
			if (($mois)/12 > 1) {
229
				$mois = 1;
213
				$mois = 1;
230
				$annee = $annee+1;
214
				$annee = $annee+1;
Line 231... Line 215...
231
			}
215
			}
Line 232... Line 216...
232
			
216
 
Line 233... Line 217...
233
			$tps_mois_suivant = mktime(0,0,0,$mois+1,1,$annee);
217
			$tps_mois_suivant = mktime(0,0,0,$mois+1,1,$annee);
Line 234... Line 218...
234
			
218
 
235
			$nb_inscrits_dans_intervalle = $annuaire_modele->obtenirNombreInscriptionsDansIntervalleDate($id_annuaire, $tps_debut, $tps_courant);
219
			$nb_inscrits_dans_intervalle = $annuaire_modele->obtenirNombreInscriptionsDansIntervalleDate($id_annuaire, $tps_debut, $tps_courant);
236
			
220
 
237
			$valeurs_a_stat_legende[$tab_mois[$mois-1].' '.$annee] = $nb_inscrits_dans_intervalle;
221
			$valeurs_a_stat_legende[$this->tab_mois[$mois-1].' '.$annee] = $nb_inscrits_dans_intervalle;
Line 238... Line 222...
238
			
222
 
Line 239... Line 223...
239
			$tps_courant = $tps_mois_suivant;
223
			$tps_courant = $tps_mois_suivant;
240
			$mois++;
224
			$mois++;
241
			$i++;
-
 
242
		}
225
			$i++;
Line 243... Line 226...
243
 
226
		}
244
		$nom_axeX = 'Mois depuis le 1er avril 2002'; 
-
 
245
		
227
 
Line 246... Line 228...
246
		$graph = $this->statistiques->genererGraphique(Statistiques::GRAPH_COURBE,$valeurs_a_stat_legende, '', array(500,490), $nom_axeX, '');
228
		$nom_axeX = 'Mois depuis le 1er avril 2002'; 
247
	    return $this->dessinerGraph($graph);
229
 
Line 248... Line -...
248
 
-
 
249
	}
-
 
250
	
230
		$graph = $this->statistiques->genererGraphique(Statistiques::GRAPH_COURBE,$valeurs_a_stat_legende, '', array(500,490), $nom_axeX, '');
251
	public function obtenirStatistiquesModificationsProfil($id_annuaire, $annee_fin = '') {
231
		return $this->dessinerGraph($graph);
252
 
232
	}
253
	    $modele = new StatistiqueModele();
233
	
254
 
234
	public function obtenirStatistiquesModificationsProfil($id_annuaire, $annee_fin = '') {
Line 279... Line 259...
279
		}
259
		}
Line 280... Line 260...
280
		
260
 
281
		//Requete par mois
261
		//Requete par mois
282
		$i = 1;
262
		$i = 1;
283
		while  ($tps_courant <= $tps_fin) {
-
 
284
			
263
		while ($tps_courant <= $tps_fin) {
285
			if (($mois)/12 > 1) {
264
			if (($mois)/12 > 1) {
286
				$mois = 1;
265
				$mois = 1;
287
				$annee = $annee+1;
266
				$annee = $annee+1;
Line 288... Line 267...
288
			}
267
			}
Line 289... Line 268...
289
			
268
 
Line 290... Line 269...
290
			$tps_mois_suivant = mktime(0,0,0,$mois+1,1,$annee);
269
			$tps_mois_suivant = mktime(0,0,0,$mois+1,1,$annee);
Line 291... Line 270...
291
			
270
 
292
			$nb_modif_dans_intervalle = $modele->obtenirEvenementsDansIntervalle($id_annuaire,'modification', $tps_debut, $tps_courant);
271
			$nb_modif_dans_intervalle = $modele->obtenirEvenementsDansIntervalle($id_annuaire,'modification', $tps_debut, $tps_courant);
293
			
272
 
294
			$valeurs_a_stat_legende[$tab_mois[$mois-1].' '.$annee] = $nb_modif_dans_intervalle;
273
			$valeurs_a_stat_legende[$this->tab_mois[$mois-1].' '.$annee] = $nb_modif_dans_intervalle;
Line 295... Line 274...
295
			
274
 
Line 296... Line 275...
296
			$tps_courant = $tps_mois_suivant;
275
			$tps_courant = $tps_mois_suivant;
297
			$mois++;
276
			$mois++;
298
			$i++;
-
 
299
		}
277
			$i++;
Line 300... Line 278...
300
 
278
		}
301
		$nom_axeX = 'Mois depuis le 1er juillet 2010'; 
-
 
302
		
279
 
303
		$graph = $this->statistiques->genererGraphique(Statistiques::GRAPH_COURBE,$valeurs_a_stat_legende, '', array(500,490), $nom_axeX, '');
280
		$nom_axeX = 'Mois depuis le 1er juillet 2010'; 
Line 304... Line 281...
304
	    return $this->dessinerGraph($graph);
281
 
Line 305... Line 282...
305
 
282
		$graph = $this->statistiques->genererGraphique(Statistiques::GRAPH_COURBE,$valeurs_a_stat_legende, '', array(500,490), $nom_axeX, '');
306
	}
-
 
307
	
283
		return $this->dessinerGraph($graph);
308
	public function ajouterEvenementStatistique($id_annuaire, $id_utilisateur, $type) {
284
	}
Line 309... Line 285...
309
		
285
	
Line 310... Line 286...
310
		$this->chargerModele('StatistiqueModele');	
286
	public function ajouterEvenementStatistique($id_annuaire, $id_utilisateur, $type) {
311
		$this->StatistiqueModele->ajouterEvenementStatistique($id_annuaire, $id_utilisateur, $type);
287
		$this->chargerModele('StatistiqueModele');	
312
		
288
		$this->StatistiqueModele->ajouterEvenementStatistique($id_annuaire, $id_utilisateur, $type);
Line 313... Line 289...
313
	}
289
		
314
	
-
 
315
	public function obtenirDerniersEvenementsStatistique($id_annuaire, $type) {
290
	}
316
		
291
	
317
		$this->chargerModele('StatistiqueModele');	
292
	public function obtenirDerniersEvenementsStatistique($id_annuaire, $type) {
Line 318... Line 293...
318
		return $this->StatistiqueModele->obtenirDerniersEvenementsStatistique($id_annuaire, $type);
293
		$this->chargerModele('StatistiqueModele');