[ 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/critiques/ -> bestproduct.php (source)

   1  <?php
   2  /* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
   3   * Copyright (C) 2003 Éric Seigne <erics@rycks.com>
   4   *
   5   * This program is free software; you can redistribute it and/or modify
   6   * it under the terms of the GNU General Public License as published by
   7   * the Free Software Foundation; either version 2 of the License, or
   8   * (at your option) any later version.
   9   *
  10   * This program is distributed in the hope that it will be useful,
  11   * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  13   * GNU General Public License for more details.
  14   *
  15   * You should have received a copy of the GNU General Public License
  16   * along with this program; if not, write to the Free Software
  17   * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  18   *
  19   * $Id: bestproduct.php,v 1.9 2005/07/09 14:34:44 eldy Exp $
  20   * $Source: /cvsroot/dolibarr/dolibarr/htdocs/product/critiques/bestproduct.php,v $
  21   *
  22   */
  23  
  24  require ("./pre.inc.php");
  25  
  26  llxHeader();
  27  
  28  if ($sortfield == "") {
  29    $sortfield="rat";
  30  }
  31  if ($sortorder == "") {
  32    $sortorder="DESC";
  33  }
  34  
  35  
  36  if ($page == -1) { $page = 0 ; }
  37  $limit = $conf->liste_limit;
  38  $offset = $limit * $page ;
  39  
  40  
  41  print_barre_liste("Liste des produits classés pas critiques", $page, "bestproduct.php");
  42  
  43  $sql = "SELECT sum(r.reviews_rating)/count(r.reviews_rating) as rat, r.products_id, p.products_model, p.products_quantity, p.products_status";
  44  $sql .= " FROM ".OSC_DB_NAME.".reviews as r,".OSC_DB_NAME.".products as p ";
  45  $sql .= " WHERE r.products_id = p.products_id";
  46  $sql .= " GROUP BY r.products_id, p.products_model, p.products_quantity, p.products_status";
  47  
  48  $sql .= " ORDER BY $sortfield $sortorder ";
  49  $sql .= $db->plimit( $limit ,$offset);
  50  
  51    print "<p><TABLE border=\"0\" width=\"100%\" cellspacing=\"0\" cellpadding=\"4\">";
  52    print "<TR class=\"liste_titre\"><td>".$langs->trans("Ref");
  53    print '</td><TD align="center">Indice critiques</TD>';
  54    print '</td><td align="center">Quantité';
  55    print '</td><td align="center">Status</TD>';
  56    print "</TR>\n";
  57   
  58  if ( $db->query($sql) ) {
  59    $num = $db->num_rows();
  60    $i = 0;
  61  
  62    $var=True;
  63    while ($i < $num) {
  64      $objp = $db->fetch_object( $i);
  65      $var=!$var;
  66      print "<TR $bc[$var]>";
  67      print '<TD><a href="'.DOL_URL_ROOT.'/boutique/livre/fiche.php?oscid='.$objp->products_id.'">'.$objp->products_model.'</a></TD>';
  68      print '<TD align="center">'.$objp->rat."</TD>\n";
  69      print '<TD align="center">'.$objp->products_quantity."</TD>\n";
  70      print '<TD align="center">'.$objp->products_status."</TD>\n";
  71      print "</TR>\n";
  72      $i++;
  73    }
  74    $db->free();
  75  }
  76  
  77  print "</TABLE>";
  78  
  79  
  80  $db->close();
  81  
  82  llxFooter("<em>Derni&egrave;re modification $Date: 2005/07/09 14:34:44 $ r&eacute;vision $Revision: 1.9 $</em>");
  83  ?>


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