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 |
//echo $requete_nb_modif_intervalle;
|
|
|
57 |
//exit;
|
|
|
58 |
|
|
|
59 |
$resultat_nb_modif_intervalle = $this->requeteUn($requete_nb_modif_intervalle);
|
|
|
60 |
|
|
|
61 |
if(!$resultat_nb_modif_intervalle) {
|
|
|
62 |
return 0;
|
|
|
63 |
}
|
|
|
64 |
|
|
|
65 |
return $resultat_nb_modif_intervalle['nb'];
|
|
|
66 |
}
|
|
|
67 |
|
215 |
aurelien |
68 |
public function ajouterEvenementStatistique($id_annuaire, $id_utilisateur, $type) {
|
|
|
69 |
|
|
|
70 |
$date_courante = AppControleur::genererDateCouranteFormatMySql();
|
|
|
71 |
|
|
|
72 |
$requete_insertion_evenenement = 'INSERT INTO annu_triples (at_ce_annuaire, at_ressource, at_action, at_valeur) '.
|
|
|
73 |
'VALUES ('.$this->proteger($id_annuaire).', '.$this->proteger($id_utilisateur).', '.$this->proteger($type).', '.$this->proteger($date_courante).')';
|
|
|
74 |
|
|
|
75 |
$resultat_insertion_evenement = $this->requete($requete_insertion_evenenement);
|
|
|
76 |
|
|
|
77 |
return $resultat_insertion_evenement;
|
|
|
78 |
|
|
|
79 |
}
|
83 |
aurelien |
80 |
|
|
|
81 |
}
|
313 |
aurelien |
82 |
?>
|