Log referent search / profile view.
authorRaphaël Barrois <raphael.barrois@polytechnique.org>
Mon, 6 Feb 2012 00:44:07 +0000 (01:44 +0100)
committerRaphaël Barrois <raphael.barrois@polytechnique.org>
Mon, 6 Feb 2012 00:44:07 +0000 (01:44 +0100)
Signed-off-by: Raphaël Barrois <raphael.barrois@polytechnique.org>
modules/profile.php
modules/search.php
upgrade/1.1.5/05_log_referent.sql [new file with mode: 0644]

index 940af80..1832e35 100644 (file)
@@ -516,6 +516,11 @@ class ProfileModule extends PLModule
             return PL_NOT_FOUND;
         }
 
+        // Referent view are logged.
+        if (S::logged()) {
+            S::logger()->log('view_referent', $pf->hrid());
+        }
+
         $page->assign_by_ref('profile', $pf);
 
         // Retrieves referents' countries.
index e9c3724..383fadc 100644 (file)
@@ -424,6 +424,12 @@ class SearchModule extends PLModule
         require_once 'ufbuilder.inc.php';
         $ufb = new UFB_MentorSearch();
         if (!$ufb->isEmpty()) {
+
+            // Search query is logged
+            if (S::logged() && !Env::has('page')) {
+                S::logger()->log('search_referent', 'adv=' . var_export($_GET, true));
+            }
+
             require_once 'userset.inc.php';
             $ufc = $ufb->getUFC();
             $set = new ProfileSet($ufc);
diff --git a/upgrade/1.1.5/05_log_referent.sql b/upgrade/1.1.5/05_log_referent.sql
new file mode 100644 (file)
index 0000000..dd4cbd9
--- /dev/null
@@ -0,0 +1,4 @@
+INSERT INTO logger.actions (text, description)
+     VALUES ('view_referent', 'Consultation d\'une fiche référent'),
+            ('search_referent', 'Réalisation d\'une recherche de référent');
+