X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=modules%2Fstats.php;h=4887934f35645a62baa94a526600ace9a366fd36;hb=5841308dadbbf7df3427fe92ef4435f19105bc5d;hp=c12eb9798710158c2d62c1fab88ab3d8039e4d31;hpb=08cce2ff528b38bde27cdec6d6bc28d6af4a42d4;p=platal.git diff --git a/modules/stats.php b/modules/stats.php index c12eb97..4887934 100644 --- a/modules/stats.php +++ b/modules/stats.php @@ -1,6 +1,6 @@ next(); - $total = $init_nb; - - list($numjour, $nb) = $res->next(); + $total = $init_nb; + $numjour = - $jours - 1; for ($i = -$jours; $i<=0; $i++) { if ($numjour<$i) { @@ -98,6 +95,7 @@ class StatsModule extends PLModule header( "Content-type: image/png"); $delt = ($total - $init_nb)/10; + $delt = $delt ? $delt : 5; $ymin = round($init_nb - $delt,0); $ymax = round($total + $delt,0); @@ -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: ?>