[ Index ]
 

Code source de Dolibarr 2.0.1

Accédez au Source d'autres logiciels libres

Classes | Fonctions | Variables | Constantes | Tables

title

Body

[fermer]

/htdocs/energie/ -> graph.php (source)

   1  <?php
   2  /* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
   3   *
   4   * This program is free software; you can redistribute it and/or modify
   5   * it under the terms of the GNU General Public License as published by
   6   * the Free Software Foundation; either version 2 of the License, or
   7   * (at your option) any later version.
   8   *
   9   * This program is distributed in the hope that it will be useful,
  10   * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  12   * GNU General Public License for more details.
  13   *
  14   * You should have received a copy of the GNU General Public License
  15   * along with this program; if not, write to the Free Software
  16   * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  17   *
  18   * $Id: graph.php,v 1.2 2005/08/11 08:46:14 rodolphe Exp $
  19   * $Source: /cvsroot/dolibarr/dolibarr/htdocs/energie/graph.php,v $
  20   *
  21   */
  22  
  23  /**
  24     \file       htdocs/commande/fiche.php
  25     \ingroup    commande
  26     \brief      Fiche commande
  27     \version    $Revision: 1.2 $
  28  */
  29  
  30  require ("./pre.inc.php");
  31  
  32  /*
  33   *
  34   */    
  35  if ($_POST["action"] == 'addvalue')
  36  {
  37    if ($_POST["releve"] > 0)
  38      {
  39        $compteur = new EnergieCompteur($db, $user);
  40        if ( $compteur->fetch($_GET["id"]) == 0)
  41      {
  42        $date = mktime(12, 
  43               0 , 
  44               0, 
  45               $_POST["remonth"], 
  46               $_POST["reday"], 
  47               $_POST["reyear"]);
  48        
  49        $compteur->AjoutReleve($date, $_POST["releve"]);
  50        Header("Location: compteur.php?id=".$_GET["id"]);
  51      }
  52      }
  53  }
  54  /*
  55   *
  56   */    
  57  
  58  llxHeader($langs, '',$langs->trans("Compteur"),"Compteur");
  59  
  60  if ($_GET["period"] == '')
  61  {
  62    $period = "day";
  63  }
  64  else
  65  {
  66    $period = $_GET["period"];
  67  }
  68  
  69  $head[0][0] = DOL_URL_ROOT.'/energie/graph.php?period=day';
  70  $head[0][1] = $langs->trans("Day");
  71  $h++;
  72  
  73  $head[$h][0] = DOL_URL_ROOT.'/energie/graph.php?period=week';
  74  $head[$h][1] = $langs->trans("Week");
  75  $h++;
  76  
  77  $head[$h][0] = DOL_URL_ROOT.'/energie/graph.php?period=month';
  78  $head[$h][1] = $langs->trans("Month");
  79  $h++;
  80  
  81  $head[$h][0] = DOL_URL_ROOT.'/energie/graph.php?period=year';
  82  $head[$h][1] = $langs->trans("Year");
  83  $h++;
  84  
  85  $as["day"] = 0;
  86  $as["week"] = 1;
  87  $as["month"] = 2;
  88  $as["year"] = 3;
  89  
  90  dolibarr_fiche_head($head, $as[$period], $soc->nom);      
  91  
  92  print '<table class="noborder" width="100%">';
  93  
  94  $sql = "SELECT c.rowid, c.libelle";
  95  $sql .= " FROM ".MAIN_DB_PREFIX."energie_compteur as c";
  96  $sql .= " ORDER BY c.libelle DESC";
  97  $resql = $db->query($sql);
  98  if ( $resql) 
  99  {
 100    $num = $db->num_rows($resql);
 101    if ($num)
 102      {
 103        $i = 0;
 104        
 105        $var = True;
 106        while ($i < $num)
 107      {
 108        $var=!$var;
 109        $obj = $db->fetch_object($resql);
 110              
 111        print '<tr><td align="center">';
 112        $file = $period.".".$obj->rowid.".png";
 113        print '<img src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=energie&file='.$file.'" alt="" title="">';
 114        print '</td></tr>';
 115        
 116        $i++;
 117      }
 118        
 119      }
 120  }
 121  print '</table><br>';
 122  
 123  $db->close();
 124  
 125  llxFooter("<em>Derni&egrave;re modification $Date: 2005/08/11 08:46:14 $ r&eacute;vision $Revision: 1.2 $</em>");
 126  ?>


Généré le : Mon Nov 26 12:29:37 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics