[ 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/product/ -> osc-productsbyreviews.php (source)

   1  <?php
   2  /* Copyright (C) 2001-2003 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: osc-productsbyreviews.php,v 1.7 2005/07/09 14:34:44 eldy Exp $
  19   * $Source: /cvsroot/dolibarr/dolibarr/htdocs/product/osc-productsbyreviews.php,v $
  20   *
  21   */
  22  
  23  require ("./pre.inc.php");
  24  
  25  llxHeader();
  26  
  27  if ($sortfield == "") {
  28    $sortfield="rat";
  29  }
  30  if ($sortorder == "") {
  31    $sortorder="DESC";
  32  }
  33  
  34  
  35  if ($page == -1) { $page = 0 ; }
  36  $limit = $conf->liste_limit;
  37  $offset = $limit * $page ;
  38  
  39  
  40  print_barre_liste("Liste des produits classés pas critiques", $page, "osc-productsbyreviews.php");
  41  
  42  $sql = "SELECT sum(r.reviews_rating)/count(r.reviews_rating) as rat, r.products_id, p.products_model, p.products_quantity, p.products_status";
  43  $sql .= " FROM ".OSC_DB_NAME.".reviews as r,".OSC_DB_NAME.".products as p ";
  44  $sql .= " WHERE r.products_id = p.products_id";
  45  $sql .= " GROUP BY r.products_id, p.products_model, p.products_quantity, p.products_status";
  46  
  47  $sql .= " ORDER BY $sortfield $sortorder ";
  48  $sql .= $db->plimit( $limit ,$offset);
  49  
  50    print "<p><TABLE border=\"0\" width=\"100%\" cellspacing=\"0\" cellpadding=\"4\">";
  51    print "<TR class=\"liste_titre\"><td>".$langs->trans("Ref");
  52    print '</td><TD align="center">Indice critiques</TD>';
  53    print '</td><td align="center">Quantité';
  54    print '</td><td align="center">Status</TD>';
  55    print "</TR>\n";
  56   
  57  if ( $db->query($sql) ) {
  58    $num = $db->num_rows();
  59    $i = 0;
  60  
  61    $var=True;
  62    while ($i < $num) {
  63      $objp = $db->fetch_object( $i);
  64      $var=!$var;
  65      print "<TR $bc[$var]>";
  66      print "<TD>$objp->products_model</TD>\n";
  67      print '<TD align="center">'.$objp->rat."</TD>\n";
  68      print '<TD align="center">'.$objp->products_quantity."</TD>\n";
  69      print '<TD align="center">'.$objp->products_status."</TD>\n";
  70      print "</TR>\n";
  71      $i++;
  72    }
  73    $db->free();
  74  }
  75  
  76  print "</TABLE>";
  77  
  78  
  79  $db->close();
  80  
  81  llxFooter("<em>Derni&egrave;re modification $Date: 2005/07/09 14:34:44 $ r&eacute;vision $Revision: 1.7 $</em>");
  82  ?>


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