[ 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/includes/boxes/ -> box_energie_releve.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: box_energie_releve.php,v 1.1 2005/07/22 15:00:54 rodolphe Exp $
  19   * $Source: /cvsroot/dolibarr/dolibarr/htdocs/includes/boxes/box_energie_releve.php,v $
  20   *
  21   */
  22  
  23  include_once(DOL_DOCUMENT_ROOT."/includes/boxes/modules_boxes.php");
  24  
  25  class box_energie_releve extends ModeleBoxes {
  26  
  27      var $boxcode="energie";
  28      var $boximg="object_energie";
  29      var $boxlabel;
  30  
  31      var $info_box_head = array();
  32      var $info_box_contents = array();
  33  
  34      /**
  35       *      \brief      Constructeur de la classe
  36       */
  37      function box_energie_releve()
  38      {
  39          global $langs;
  40          $langs->load("boxes");
  41  
  42          $this->boxlabel=$langs->trans("Energie");
  43      }
  44  
  45      /**
  46       *      \brief      Charge les données en mémoire pour affichage ultérieur
  47       *      \param      $max        Nombre maximum d'enregistrements à charger
  48       */
  49      function loadBox($max=5)
  50      {
  51        global $user, $langs, $db;
  52        $langs->load("boxes");
  53        
  54        $text = '<a href="energie/">'.$langs->trans("Energie").'</a>';
  55  
  56        $this->info_box_head = array('text' => $text,$max);
  57        
  58  
  59        $sql = "SELECT ec.libelle, ".$db->pdate("date_releve")." as date_releve, ecr.valeur, ec.rowid";
  60        $sql .= " FROM ".MAIN_DB_PREFIX."energie_compteur_releve as ecr";
  61        $sql .= " , ".MAIN_DB_PREFIX."energie_compteur as ec";
  62        $sql .= " WHERE ecr.fk_compteur = ec.rowid";
  63        $sql .= " ORDER BY ecr.date_releve DESC LIMIT 5";
  64        $resql = $db->query($sql);
  65        if ($resql)
  66      {
  67        $num = $db->num_rows($resql);
  68        $i = 0;
  69        $var=True;
  70        while ($i < $num)
  71          {
  72            $objp = $db->fetch_object($resql);
  73            
  74            $this->info_box_contents[$i][0] = array('align' => 'left',
  75                                'logo' => $this->boximg,
  76                                'text' => $objp->libelle,
  77                                'url' => DOL_URL_ROOT."/energie/compteur.php?id=".$objp->rowid);
  78            
  79            $this->info_box_contents[$i][1] = array('align' => 'left',
  80                                'text' => $objp->valeur);
  81            
  82            
  83            $i++;
  84          }
  85      }                       
  86      }
  87    
  88    function showBox()
  89    {
  90      parent::showBox($this->info_box_head, $this->info_box_contents);
  91    }  
  92  }
  93  
  94  ?>


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