Link to marketing/broken/{forlife} instead of marketing/broken/uid
[platal.git] / modules / stats.php
index c12eb97..591d18b 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /***************************************************************************
- *  Copyright (C) 2003-2006 Polytechnique.org                              *
+ *  Copyright (C) 2003-2007 Polytechnique.org                              *
  *  http://opensource.polytechnique.org/                                   *
  *                                                                         *
  *  This program is free software; you can redistribute it and/or modify   *
@@ -60,8 +60,6 @@ class StatsModule extends PLModule
 
     function handler_graph_evo(&$page, $jours = 365)
     {
-        global $globals;
-
         define('DUREEJOUR',24*3600);
 
         //recupere le nombre d'inscriptions par jour sur la plage concernée
@@ -125,8 +123,6 @@ EOF2;
 
     function handler_graph(&$page, $promo = null)
     {
-        global $globals;
-
         if ($promo == 'all') {
             // date de départ
             $depart = 1920;
@@ -248,8 +244,6 @@ EOF2;
 
     function handler_promos(&$page, $promo = null)
     {
-        global $globals;
-
         $page->changeTpl('stats/nb_by_promo.tpl');
 
         $res = XDB::iterRow(
@@ -276,29 +270,32 @@ EOF2;
 
     function handler_coupures(&$page, $cp_id = null)
     {
-        global $globals;
-
         $page->changeTpl('stats/coupure.tpl');
 
         if (!is_null($cp_id)) {
-            $res = XDB::query("SELECT  UNIX_TIMESTAMP(debut) AS debut,
-                                                 TIME_FORMAT(duree,'%kh%i') AS duree,
-                                                 resume, description, services
-                                           FROM  coupures
-                                          WHERE  id = {?}", $cp_id);
+            $res = XDB::query("SELECT  debut,
+                                       TIME_FORMAT(duree,'%kh%i') AS duree,
+                                       resume, description, services
+                                 FROM  coupures
+                                WHERE  id = {?}", $cp_id);
             $cp  = $res->fetchOneAssoc();
         }
 
-        if($cp) {
+        if(@$cp) {
             $cp['lg_services'] = serv_to_str($cp['services']);
             $page->assign_by_ref('cp',$cp);
         } else {
             $beginning_date = date("Ymd", time() - 3600*24*21) . "000000";
-            $sql = "SELECT  id, UNIX_TIMESTAMP(debut) AS debut, resume, services
+            $sql = "SELECT  id, debut, resume, services
                       FROM  coupures where debut > '$beginning_date' order by debut desc";
             $page->assign('coupures', XDB::iterator($sql));
+            $res = XDB::iterator("SELECT  host, text
+                                    FROM  mx_watch
+                                   WHERE  state != 'ok'");
+            $page->assign('mxs', $res);
         }
     }
 }
 
+// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
 ?>