Author: zecas
Date: Fri Apr 11 17:10:01 2014
New Revision: 105

URL: http://svn.gna.org/viewcvs/zzzt?rev=105&view=rev
Log:
use js when avalaible to calculate chart width

Modified:
    trunk/i18n/en.php
    trunk/i18n/fr.php
    trunk/i18n/pt.php
    trunk/stats/daily.php
    trunk/stats/index.php
    trunk/stats/monthly.php

Modified: trunk/i18n/en.php
URL: 
http://svn.gna.org/viewcvs/zzzt/trunk/i18n/en.php?rev=105&r1=104&r2=105&view=diff
==============================================================================
--- trunk/i18n/en.php   (original)
+++ trunk/i18n/en.php   Fri Apr 11 17:10:01 2014
@@ -17,7 +17,7 @@
 */
 
 // Langue de l'application pour les jours de semaine et les mois MySQL
-define("LANG", "en_GB");
+define("LANG", "en_GB.UTF8");
 setlocale(LC_ALL, LANG);
 
 define("APPLICATION","Zzzt!");

Modified: trunk/i18n/fr.php
URL: 
http://svn.gna.org/viewcvs/zzzt/trunk/i18n/fr.php?rev=105&r1=104&r2=105&view=diff
==============================================================================
--- trunk/i18n/fr.php   (original)
+++ trunk/i18n/fr.php   Fri Apr 11 17:10:01 2014
@@ -17,7 +17,7 @@
 */
 
 // Langue de l'application pour les jours de semaine et les mois MySQL
-define("LANG", "fr_FR");
+define("LANG", "fr_FR.UTF8");
 setlocale(LC_ALL, LANG);
 
 define("APPLICATION","Zzzt!");

Modified: trunk/i18n/pt.php
URL: 
http://svn.gna.org/viewcvs/zzzt/trunk/i18n/pt.php?rev=105&r1=104&r2=105&view=diff
==============================================================================
--- trunk/i18n/pt.php   (original)
+++ trunk/i18n/pt.php   Fri Apr 11 17:10:01 2014
@@ -17,7 +17,7 @@
 */
 
 // Langue de l'application pour les jours de semaine et les mois MySQL
-define("LANG", "pt_PT");
+define("LANG", "pt_PT.UTF8");
 setlocale(LC_ALL, LANG);
 
 define("APPLICATION","Zzzt!");

Modified: trunk/stats/daily.php
URL: 
http://svn.gna.org/viewcvs/zzzt/trunk/stats/daily.php?rev=105&r1=104&r2=105&view=diff
==============================================================================
--- trunk/stats/daily.php       (original)
+++ trunk/stats/daily.php       Fri Apr 11 17:10:01 2014
@@ -18,7 +18,8 @@
   <script src="../morris/morris-0.4.3.min.js"></script>
   
   <style>
-    #holder { width: 1000px; height: 600px; }
+    html, body { height: 95%; }
+    #holder { width: 98%; height: 100%; }
   </style>
 </head>
 
@@ -31,10 +32,6 @@
 
   <script type="text/javascript">
     document.write("<div id=\"holder\"></div>");
-  </script>
-  <noscript><img src=image_year.php?width=800&amp;height=500></noscript>
-  
-  <script type="text/javascript" charset="utf-8">
      
     <?php
       $sql="SELECT date,production FROM zzzt_daily
@@ -69,5 +66,7 @@
       ], xkey: 'j', ykeys: ['r','t'], labels: ['<?php echo PAC;?>','<?php echo 
'Record';?>'] });
   
   </script>
+  <noscript><img src=image_year.php?width=800&amp;height=500></noscript>
+
 </body>
 </html>

Modified: trunk/stats/index.php
URL: 
http://svn.gna.org/viewcvs/zzzt/trunk/stats/index.php?rev=105&r1=104&r2=105&view=diff
==============================================================================
--- trunk/stats/index.php       (original)
+++ trunk/stats/index.php       Fri Apr 11 17:10:01 2014
@@ -21,21 +21,26 @@
   $db=new db($inverter);
   $heure=array();
   $values=array();
-  $champs=array('pac','pdc','kdy','tkk');
+  $champs=array('pac','pdc','tkk');
   if(!isset($_GET['day'])) $_GET['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
+              tkk FROM zzzt
        WHERE DATE(`monitor_date`)='{$_GET['day']}' GROUP BY md ORDER BY md 
ASC";
   $db->query($sql);
   while ($row = $db->fetch()) {
-    if(!isset($next)) $next=$row['md'];//premier coup
-    $heure[]=$_GET['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];
+    if(isset($prev) && 
+       ( ($prev<=$row['pdc'] && $prev+10>$row['pdc']) || ($prev>=$row['pdc'] 
&& $prev-10<$row['pdc']) ) 
+      ) $skip=1; else $skip=0;
+    if(!$skip) {
+      $prev=$row['pdc'];
+      $heure[]=$_GET['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];
+    }
   }
 ?>
 <!DOCTYPE html>
@@ -51,8 +56,9 @@
 <script src="../morris/morris-0.4.3.min.js"></script>
 
   <style>
-    #holderP { width: <?php echo $_GET['width']+30;?>px; height: 300px; }
-    #holderR { width: <?php echo $_GET['width']+30;?>px; height: 200px; }
+    table { width: 100%;}
+    #holderP { width: 100%; height: 300px; }
+    #holderR { width: 100%; height: 200px; }
   </style>
 </head>
 <body>
@@ -81,8 +87,8 @@
           }
         ?>
       </select>
-      <?php echo GRAPH_WIDTH.' :';?> <script>document.write('<input type=text 
size=4 name=width value=',document.body.clientWidth-65,'>')</script>
-      <noscript><input type=text size=4 name=width value='<?php echo $_GET 
['width'];?>'></noscript>
+      
+      <noscript><?php echo GRAPH_WIDTH.' :';?><input type=text size=4 
name=width value='<?php echo $_GET ['width'];?>'></noscript>
       <input type=submit>
     </form>
     
@@ -151,13 +157,13 @@
       
$monitors[$row[5]]='#'.dechex(rand(106,254)).dechex(rand(106,254)).dechex(rand(106,254));
     }
        echo"<tr style='background-color:{$monitors[$row[5]]}'>
-               <td>$row[0]</td>\n
-               <td>".sprintf('%.2F',$row[1]*100/($row[2]+0.0001))."%</td>\n
-               <td>$row[1]</td>\n
-               <td>$row[2]</td>\n
-               <td>$row[3]</td>\n
-               <td>$row[4]</td>\n
-               <td>$row[5]</td>\n
+               <td>$row[0]</td>
+               <td>".sprintf('%.2F',$row[1]*100/($row[2]+0.0001))."%</td>
+               <td>$row[1]</td>
+               <td>$row[2]</td>
+               <td>$row[3]</td>
+               <td>$row[4]</td>
+               <td>$row[5]</td>
        </tr>";
   }
   echo $titre;
@@ -171,13 +177,13 @@
       
$monitors[$row[5]]='#'.dechex(rand(106,254)).dechex(rand(106,254)).dechex(rand(106,254));
     }
        echo"<tr style='background-color:{$monitors[$row[5]]}'>
-               <td>$row[0]</td>\n
-               <td>".sprintf('%.2F',$row[1]*100/($row[2]+0.0001))."%</td>\n
-               <td>$row[1]</td>\n
-               <td>$row[2]</td>\n
-               <td>$row[3]</td>\n
-               <td>$row[4]</td>\n
-               <td>$row[5]</td>\n
+               <td>$row[0]</td>
+               <td>".sprintf('%.2F',$row[1]*100/($row[2]+0.0001))."%</td>
+               <td>$row[1]</td>
+               <td>$row[2]</td>
+               <td>$row[3]</td>
+               <td>$row[4]</td>
+               <td>$row[5]</td>
        </tr>";
   }
   echo '</table>';

Modified: trunk/stats/monthly.php
URL: 
http://svn.gna.org/viewcvs/zzzt/trunk/stats/monthly.php?rev=105&r1=104&r2=105&view=diff
==============================================================================
--- trunk/stats/monthly.php     (original)
+++ trunk/stats/monthly.php     Fri Apr 11 17:10:01 2014
@@ -19,7 +19,8 @@
   <script src="../morris/morris-0.4.3.min.js"></script>
 
   <style>
-    #holder { width: 1000px; height: 600px; }
+    html, body { height: 95%; }
+    #holder { width: 98%; height: 100%; }
   </style>
 </head>
 
@@ -59,7 +60,7 @@
        for($i=1;$i<13;$i++) {
          $tab=str_pad((int)$i,2,"0",STR_PAD_LEFT);
          $mois[]=$tab;
-         echo "{ a: '$i'";
+         echo "{ a: '".strftime( '%B', mktime(0,0,0,$i,1) )."'";
          foreach($year as $y) {
            if(!isset($values[$y][$tab])) $values[$y][$tab]='null';
            echo ", '$y': ".$values[$y][$tab]; }
@@ -69,7 +70,7 @@
       ], xkey: 'a', ykeys: ['<?php echo implode("','",$year); ?>'], labels: 
['<?php echo implode("','",$year); ?>'] });
 
   </script>
-  <noscript><img src=image_by_month.php?width=1000&amp;height=600></noscript>
+  <noscript><br><img 
src=image_by_month.php?width=1000&amp;height=600></noscript>
 
 
 </body>


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

Reply via email to