[ 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/promotion/ -> index.php (source)

   1  <?php
   2  /* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
   3   * Copyright (C) 2004 Laurent Destailleur  <eldy@users.sourceforge.net>
   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: index.php,v 1.8 2005/07/09 14:34:44 eldy Exp $
  20   * $Source: /cvsroot/dolibarr/dolibarr/htdocs/product/promotion/index.php,v $
  21   *
  22   */
  23  
  24  require ("./pre.inc.php");
  25  
  26  llxHeader();
  27  
  28  if ($action == "inactive")
  29  {
  30    $promotion = new Promotion($db);
  31    $promotion->set_inactive($id);
  32  }
  33  if ($action == "active")
  34  {
  35    $promotion = new Promotion($db);
  36    $promotion->set_active($id);
  37  }
  38  
  39  if ($sortfield == "")
  40  {
  41    $sortfield="pd.products_name";
  42  }
  43  if ($sortorder == "")
  44  {
  45    $sortorder="ASC";
  46  }
  47  
  48  if ($page == -1) { $page = 0 ; }
  49  $limit = $conf->liste_limit;
  50  $offset = $limit * $page ;
  51  
  52  print_barre_liste("Liste des promotions", $page, "index.php", "",$sortfield, $sortorder);
  53  
  54  $urladd = "&sortorder=$sortorder&sortfield=$sortfield";
  55  
  56  $sql = "SELECT pd.products_name, s.specials_new_products_price, p.products_price, p.products_model, s.status, p.products_id";
  57  $sql .= ",".$db->pdate("expires_date")." as fin";
  58  $sql .= " FROM ".OSC_DB_NAME.".specials as s,".OSC_DB_NAME.".products_description as pd,".OSC_DB_NAME.".products as p";
  59  $sql .= " WHERE s.products_id = pd.products_id AND pd.products_id = p.products_id AND pd.language_id = ".OSC_LANGUAGE_ID;
  60  $sql .= " ORDER BY $sortfield $sortorder ";
  61  $sql .= $db->plimit( $limit ,$offset);
  62    
  63  if ( $db->query($sql) )
  64  {
  65    $num = $db->num_rows();
  66    $i = 0;
  67    print '<table class=\"noborder width="100%">';
  68    print "<tr class=\"liste_titre\">";
  69    print_liste_field_titre($langs->trans("Ref"),"index.php", "p.products_model");
  70    print_liste_field_titre("Titre","index.php", "pd.products_name");
  71    print "<td>&nbsp;</td><td>&nbsp;</td><td>Fin</td>";
  72    print '<td align="right">Prix initial</td>';
  73    print '<td align="right">Prix remisé</td>';
  74    print "</tr>\n";
  75    $var=True;
  76    while ($i < $num)
  77      {
  78        $objp = $db->fetch_object( $i);
  79        $var=!$var;
  80        
  81        print "<tr $bc[$var]>";
  82        print '<td>'.$objp->products_model."</td>";
  83        print '<td>'.$objp->products_name."</td>";
  84  
  85        if ($objp->status == 1)
  86      {
  87        print '<td align="center"><img src="/theme/'.$conf->theme.'/img/icon_status_green.png" border="0" alt="actif"></td>';
  88        print '<td align="center">';
  89        print '<a href="index.php?action=inactive&id='.$objp->products_id.''.$urladd.'&page='.$page.'">';
  90        print '<img src="/theme/'.$conf->theme.'/img/icon_status_red_light.png" border="0"></a></td>';
  91      }
  92        else
  93      {
  94        print '<td align="center">';
  95        print '<a href="index.php?action=active&id='.$objp->products_id.''.$urladd.'&page='.$page.'">';
  96        print '<img src="/theme/'.$conf->theme.'/img/icon_status_green_light.png" border="0"></a></td>';
  97        print '<td align="center"><img src="/theme/'.$conf->theme.'/img/icon_status_red.png" border="0" alt="inactif"></td>';
  98      }
  99        print "<td>".strftime("%d/%m/%Y", $objp->fin)."</td>";
 100        print '<td align="right">'.price($objp->products_price)."</td>";
 101        print '<td align="right">'.price($objp->specials_new_products_price)."</td>";
 102        print "</tr>";
 103        $i++;
 104      }
 105    print "</TABLE>";
 106    $db->free();
 107  }
 108  else
 109  {
 110    print $db->error();
 111  }
 112  $db->close();
 113  
 114  llxFooter("<em>Derni&egrave;re modification $Date: 2005/07/09 14:34:44 $ r&eacute;vision $Revision: 1.8 $</em>");
 115  
 116  
 117  ?>


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