Author: zecas
Date: Mon Feb 15 12:22:55 2016
New Revision: 131

URL: http://svn.gna.org/viewcvs/zzzt?rev=131&view=rev
Log:
correction d├ęsactivation js

Modified:
    trunk/stats/index.php

Modified: trunk/stats/index.php
URL: 
http://svn.gna.org/viewcvs/zzzt/trunk/stats/index.php?rev=131&r1=130&r2=131&view=diff
==============================================================================
--- trunk/stats/index.php       (original)
+++ trunk/stats/index.php       Mon Feb 15 12:22:55 2016
@@ -22,27 +22,27 @@
   $heure=array();
   $values=array();
   $champs=array('pac','pdc','kdy','tkk');
-  if(!isset($_GET['day'])) $_GET['day']=date('Y-m-d');
+  isset($_GET['day']) ? $day=$_GET['day'] : $day=date('Y-m-d');
   if(!isset($_GET['width'])) $_GET['width']=1000;
   if(!isset($_GET['height'])) $_GET['height']=550;
   $sql="SELECT ROUND(DATE_FORMAT(monitor_date,'%H%i'),0) AS md,
               ROUND(AVG(pac),0) AS pac,
               ROUND(AVG(pdc),0) AS pdc,
               kdy, tkk FROM zzzt
-       WHERE DATE(`monitor_date`)='{$_GET['day']}' GROUP BY md ORDER BY md 
ASC";
+       WHERE DATE(`monitor_date`)='{$day}' GROUP BY md ORDER BY md ASC";
   $db->query($sql);
   while ($row = $db->fetch()) {
     if(isset($prev) && $_GET['detaille']==0 && 
-       ( ($prev<=$row['pdc'] && $prev*1.02>=$row['pdc']) || 
($prev>=$row['pdc'] && $prev*0.98<=$row['pdc']) ) 
+       ( ($prev<=$row['pdc'] && $prev*1.3>=$row['pdc']) || ($prev>=$row['pdc'] 
&& $prev*0.7<=$row['pdc']) ) 
       ) {$skip+=1;} else {$skip=0;}
-    if($skip<1 || $skip>5) {
+    if($skip<1 || $skip>9) {
       $prev=$row['pdc'];
-      $heure[]=$_GET['day'].' 
'.implode(':',str_split(str_pad((int)$row['md'],4,"0",STR_PAD_LEFT),2));
+      $heure[]=$day.' 
'.implode(':',str_split(str_pad((int)$row['md'],4,"0",STR_PAD_LEFT),2));
       
$values['rendement'][]=sprintf('%.2F',$row['pac']/($row['pdc']+0.0001)*100);
       foreach($champs as $c) $values[$c][]=$row[$c];
     }
   }
-  htmlCommun($_GET['day']);
+  htmlCommun($day);
 ?>
 
 <body>
@@ -57,16 +57,15 @@
       <?php echo DDY;?> :
       <select name=day>
         <?php
-          if(!isset($_GET['day'])) $_GET['day']=date('Y-m-d');
-          $demain=date('Y-m-d', strtotime($_GET['day'])+(3600*24) );
-          $hier=date('Y-m-d', strtotime($_GET['day'])-(3600*24) );
+          $demain=date('Y-m-d', strtotime($day)+(3600*24) );
+          $hier=date('Y-m-d', strtotime($day)-(3600*24) );
           if(!isset($_GET['width'])) $_GET['width']=600;
-          
$fixe="image_day.php?day={$_GET['day']}&amp;width={$_GET['width']}&amp;data=";
+          
$fixe="image_day.php?day={$day}&amp;width={$_GET['width']}&amp;data=";
 
           for($i=0;$i<10;$i++){
-            $d=date('Y-m-d', strtotime($_GET['day'])-(3600*24*$i) );
-           $d==$_GET['day'] ? $selected='selected' : $selected='';
-           $bd=strftime("%e %b %G",strtotime($_GET['day'])-(3600*24*$i));
+            $d=date('Y-m-d', strtotime($day)-(3600*24*$i) );
+           $d==$day ? $selected='selected' : $selected='';
+           $bd=strftime("%e %b %G",strtotime($day)-(3600*24*$i));
             echo "<option value='$d' $selected >$bd</option>\n";
           }
         ?>
@@ -103,11 +102,11 @@
 <?php
   $sql="SELECT YEAR(date) AS year, production
               FROM zzzt_daily
-       WHERE DAY(date) = DAY('{$_GET['day']}')
-       AND MONTH(date) = MONTH('{$_GET['day']}')
+       WHERE DAY(date) = DAY('{$day}')
+       AND MONTH(date) = MONTH('{$day}')
        ORDER BY year DESC";
   $db->query($sql);
-  $ap=strftime("%e %B %G", strtotime($_GET['day']))."
+  $ap=strftime("%e %B %G", strtotime($day))."
 ";
   while ($row = $db->fetch()) $ap.=DYR." {$row['year']} : {$row['production']} 
kWh
 ";
@@ -123,7 +122,7 @@
 
   echo "<a title='$ap'>".LAST_MEASURES."</a>";
   $sql="SELECT * FROM zzzt
-         WHERE DATE(monitor_date) = '{$_GET['day']}'
+         WHERE DATE(monitor_date) = '{$day}'
          ORDER BY monitor_date DESC
          LIMIT 0,10";
   $db->query($sql);
@@ -156,7 +155,7 @@
   }
   echo $titre;
   $sql="SELECT * FROM (
-           SELECT * FROM zzzt WHERE DATE(monitor_date) = '{$_GET['day']}' 
ORDER BY monitor_date ASC LIMIT 0,10 )
+           SELECT * FROM zzzt WHERE DATE(monitor_date) = '{$day}' ORDER BY 
monitor_date ASC LIMIT 0,10 )
            AS zzztdebut ORDER BY monitor_date DESC";
   $db->query($sql);
   while ($row = $db->fetch())
@@ -180,7 +179,7 @@
   </table>
   
   <div id='etat' title='<?php echo LAST_MEASURES;?>'>
-    <div id='last'></div>
+    <div id='last' title='<?php echo sizeof($values['rendement']); ?>'></div>
     <progress id='temps' max='6' value='0'></progress>
   </div>
   
@@ -204,12 +203,13 @@
 
  var tabR = [
   <?php
-    for($i=0;$i<sizeof($values['rendement']);$i++) {
-      echo "{ h: '".$heure[$i]."'";
-      echo ", 'r': ".$values['rendement'][$i];
-      echo ", 't': ".$values['tkk'][$i];
-      if($i<sizeof($values['rendement'])-1) echo " },\n"; else echo " }\n";
-    }
+    if( isset($_GET['detaille']))
+      for($i=0;$i<sizeof($values['rendement']);$i++) {
+        echo "{ h: '".$heure[$i]."'";
+        echo ", 'r': ".$values['rendement'][$i];
+        echo ", 't': ".$values['tkk'][$i];
+        if($i<sizeof($values['rendement'])-1) echo " },\n"; else echo " }\n";
+      }
   ?>
   ];
   


_______________________________________________
Zzzt-commits mailing list
Zzzt-commits@gna.org
https://mail.gna.org/listinfo/zzzt-commits

Reply via email to