83 |
aurelien |
1 |
<?php
|
|
|
2 |
/**
|
|
|
3 |
* PHP Version 5
|
|
|
4 |
*
|
|
|
5 |
* @category PHP
|
|
|
6 |
* @package annuaire
|
|
|
7 |
* @author aurelien <aurelien@tela-botanica.org>
|
|
|
8 |
* @copyright 2010 Tela-Botanica
|
|
|
9 |
* @license http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL
|
|
|
10 |
* @version SVN: <svn_id>
|
|
|
11 |
* @link /doc/annuaire/
|
|
|
12 |
*/
|
|
|
13 |
|
|
|
14 |
class StatistiqueModele extends Modele {
|
|
|
15 |
|
|
|
16 |
public function obtenirInscriptionsParDate($id_annuaire, $annee) {
|
|
|
17 |
|
|
|
18 |
$requete_annee_inscrit = 'SELECT COUNT(*) FROM annuaire_tela '.
|
|
|
19 |
' WHERE id_annuaire '.$this->proteger($id_annuaire);
|
|
|
20 |
|
|
|
21 |
}
|
215 |
aurelien |
22 |
|
|
|
23 |
public function obtenirIdDernieresModificationsProfil($id_annuaire, $limite = 10) {
|
|
|
24 |
|
|
|
25 |
$this->obtenirDerniersEvenementsStatistiques($id_annuaire, 'modification', $limite);
|
|
|
26 |
|
|
|
27 |
}
|
|
|
28 |
|
|
|
29 |
public function obtenirDerniersEvenementsStatistique($id_annuaire, $type, $limite = 10) {
|
|
|
30 |
|
|
|
31 |
$requete_derniers_evenements = 'SELECT at_ressource as id_utilisateur, at_action as evenement, at_valeur as date_evenement '.
|
|
|
32 |
'FROM annu_triples '.
|
|
|
33 |
'WHERE at_ce_annuaire = '.$this->proteger($id_annuaire).' '.
|
|
|
34 |
'AND at_action = '.$this->proteger($type).' '.
|
247 |
aurelien |
35 |
'ORDER BY at_valeur DESC ';
|
215 |
aurelien |
36 |
|
247 |
aurelien |
37 |
if($limite != 0) {
|
|
|
38 |
$requete_derniers_evenements .= 'LIMIT 0,'.$limite;
|
|
|
39 |
}
|
|
|
40 |
|
|
|
41 |
|
215 |
aurelien |
42 |
$resultat_derniers_evenements = $this->requeteTous($requete_derniers_evenements);
|
|
|
43 |
|
|
|
44 |
return $resultat_derniers_evenements;
|
|
|
45 |
}
|
|
|
46 |
|
247 |
aurelien |
47 |
public function obtenirEvenementsDansIntervalle($id_annuaire, $type, $date_debut, $date_fin) {
|
|
|
48 |
|
|
|
49 |
$requete_nb_modif_intervalle = 'SELECT COUNT(*) as nb '.
|
|
|
50 |
'FROM annu_triples '.
|
|
|
51 |
'WHERE at_ce_annuaire = '.$this->proteger($id_annuaire).' '.
|
|
|
52 |
'AND at_action = '.$this->proteger($type).' '.
|
|
|
53 |
'AND at_valeur >= "'.date('Y-m-d H:i:s', $date_debut).'" '.
|
|
|
54 |
'AND at_valeur < "'.date('Y-m-d H:i:s', $date_fin).'" ';
|
|
|
55 |
|
|
|
56 |
$resultat_nb_modif_intervalle = $this->requeteUn($requete_nb_modif_intervalle);
|
|
|
57 |
|
|
|
58 |
if(!$resultat_nb_modif_intervalle) {
|
|
|
59 |
return 0;
|
|
|
60 |
}
|
|
|
61 |
|
|
|
62 |
return $resultat_nb_modif_intervalle['nb'];
|
|
|
63 |
}
|
|
|
64 |
|
215 |
aurelien |
65 |
public function ajouterEvenementStatistique($id_annuaire, $id_utilisateur, $type) {
|
|
|
66 |
|
|
|
67 |
$date_courante = AppControleur::genererDateCouranteFormatMySql();
|
|
|
68 |
|
|
|
69 |
$requete_insertion_evenenement = 'INSERT INTO annu_triples (at_ce_annuaire, at_ressource, at_action, at_valeur) '.
|
|
|
70 |
'VALUES ('.$this->proteger($id_annuaire).', '.$this->proteger($id_utilisateur).', '.$this->proteger($type).', '.$this->proteger($date_courante).')';
|
|
|
71 |
|
|
|
72 |
$resultat_insertion_evenement = $this->requete($requete_insertion_evenenement);
|
|
|
73 |
|
|
|
74 |
return $resultat_insertion_evenement;
|
|
|
75 |
|
|
|
76 |
}
|
83 |
aurelien |
77 |
|
|
|
78 |
}
|
313 |
aurelien |
79 |
?>
|