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

   1  <?php
   2  /* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
   3   * Copyright (C) 2004-2005 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: photos.php,v 1.7 2005/09/11 16:51:42 eldy Exp $
  20   * $Source: /cvsroot/dolibarr/dolibarr/htdocs/fourn/product/photos.php,v $
  21   *
  22   */
  23  
  24  /**
  25          \file       htdocs/fourn/product/photos.php
  26          \ingroup    product
  27          \brief      Page de la fiche produit
  28          \version    $Revision: 1.7 $
  29  */
  30  
  31  require ("./pre.inc.php");
  32  require_once(DOL_DOCUMENT_ROOT."/product.class.php");
  33  
  34  
  35  if (!$user->rights->produit->lire) accessforbidden();
  36  
  37  
  38  $types[0] = $langs->trans("Product");
  39  $types[1] = $langs->trans("Service");
  40  
  41  /*
  42   *
  43   */
  44  
  45  if ( $_POST["sendit"] && $conf->upload)
  46  {
  47    if ($_GET["id"])
  48      {           
  49        $product = new Product($db);
  50        $result = $product->fetch($_GET["id"]);
  51  
  52        $product->add_photo($conf->produit->dir_output, $_FILES['photofile']);
  53      }
  54  }
  55  /*
  56   *
  57   */
  58  llxHeader("","",$langs->trans("CardProduct0"));
  59  
  60  /*
  61   * Fiche produit
  62   */
  63  if ($_GET["id"])
  64  {
  65    $product = new Product($db);
  66    $result = $product->fetch($_GET["id"]);
  67  
  68    if ( $result )
  69      { 
  70        /*
  71         *  En mode visu
  72         */
  73        
  74        $h=0;
  75            
  76        $head[$h][0] = DOL_URL_ROOT."/fourn/product/fiche.php?id=".$product->id;
  77        $head[$h][1] = $langs->trans("Card");
  78        $h++;
  79        
  80        
  81        if ($conf->stock->enabled)
  82      {
  83        $head[$h][0] = DOL_URL_ROOT."/product/stock/product.php?id=".$product->id;
  84        $head[$h][1] = $langs->trans("Stock");
  85        $h++;
  86      }
  87       
  88        $head[$h][0] = DOL_URL_ROOT."/fourn/product/photos.php?id=".$product->id;
  89        $head[$h][1] = $langs->trans("Photos");
  90        $hselected = $h;          
  91        $h++;
  92  
  93        //Affichage onglet Catégories
  94        if ($conf->categorie->enabled){
  95      $head[$h][0] = DOL_URL_ROOT."/fourn/product/categorie.php?id=".$product->id;
  96      $head[$h][1] = $langs->trans('Categories');
  97      $h++;
  98        }
  99  
 100        $head[$h][0] = DOL_URL_ROOT."/product/fiche.php?id=".$product->id;
 101        $head[$h][1] = $langs->trans("CommercialCard");
 102        $h++;
 103                  
 104        dolibarr_fiche_head($head, $hselected, $langs->trans("CardProduct".$product->type).' : '.$product->ref);
 105  
 106        print($mesg);
 107        print '<table class="border" width="100%">';
 108        print "<tr>";
 109        print '<td>'.$langs->trans("Ref").'</td><td>'.$product->ref.'</td>';
 110        print '<td colspan="2">';
 111        if ($product->envente)
 112      {
 113        print $langs->trans("OnSell");
 114      }
 115        else
 116      {
 117        print $langs->trans("NotOnSell");
 118      }
 119        print '</td></tr>';
 120        print '<tr><td>'.$langs->trans("Label").'</td><td>'.$product->libelle.'</td>';
 121        print '<td>'.$langs->trans("SellingPrice").'</td><td>'.price($product->price).'</td></tr>';
 122        print "</table><br>\n";
 123  
 124        /*
 125         * Ajouter une photo
 126         *
 127         */
 128        if ($_GET["action"] == 'ajout_photo' && $user->rights->produit->creer  && $product->isproduct && $conf->upload)
 129      {
 130        print_titre($langs->trans("AddPhoto"));
 131        
 132        print '<form name="userfile" action="photos.php?id='.$product->id.'" enctype="multipart/form-data" METHOD="POST">';      
 133        print '<input type="hidden" name="max_file_size" value="2000000">';
 134        
 135        print '<table class="border" width="100%"><tr>';
 136        print '<td>'.$langs->trans("File").'</td>';
 137        print '<td><input type="file" name="photofile"></td></tr>';
 138        
 139        print '<tr><td colspan="4" align="center">';
 140        print '<input type="submit" name="sendit" value="'.$langs->trans("Save").'">&nbsp;';
 141        
 142        
 143        print '<input type="submit" name="cancel" value="'.$langs->trans("Cancel").'"></td></tr>';
 144        print '</table>';
 145        print '</form><br />';
 146      }
 147  
 148  
 149        // Affiche photos
 150        $nbphoto=$product->show_photos($conf->produit->dir_output,1);
 151        if ($nbphoto < 1) print $langs->trans("NoPhotoYet")."<br><br>";
 152        print "</div>\n";
 153  
 154      }
 155  
 156    print "\n<div class=\"tabsAction\">\n";
 157    
 158    if ($_GET["action"] == '')
 159      {            
 160        if ( $user->rights->produit->creer && $product->isproduct && $conf->upload)
 161      {
 162        print '<a class="tabAction" href="photos.php?action=ajout_photo&amp;id='.$product->id.'">';
 163        print $langs->trans("AddPhoto").'</a>';
 164      }      
 165  }
 166  
 167  print "\n</div>\n";
 168  
 169  
 170  
 171  }
 172  else
 173  {
 174    print $langs->trans("ErrorUnknown");
 175  }
 176  
 177  
 178  
 179  
 180  
 181  
 182  
 183  $db->close();
 184  
 185  llxFooter("<em>Derni&egrave;re modification $Date: 2005/09/11 16:51:42 $ r&eacute;vision $Revision: 1.7 $</em>");
 186  ?>


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