[ 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/categorie/ -> fiche.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: fiche.php,v 1.9 2004/10/20 20:06:49 opensides Exp $
  20   * $Source: /cvsroot/dolibarr/dolibarr/htdocs/product/categorie/fiche.php,v $
  21   *
  22   */
  23  
  24  require ("./pre.inc.php");
  25  
  26  llxHeader();
  27  
  28  if ($action == 'add') {
  29    $album = new Album($db);
  30  
  31    $album->titre = $titre;
  32    $album->description = $desc;
  33  
  34    $id = $album->create($user);
  35  }
  36  
  37  if ($action == 'addga') {
  38    $album = new Album($db);
  39  
  40    $album->linkga($id, $ga);
  41  }
  42  
  43  
  44  if ($action == 'update') {
  45    $album = new Album($db);
  46  
  47    $album->titre = $titre;
  48    $album->description = $desc;
  49  
  50    $album->update($id, $user);
  51  }
  52  
  53  if ($action == 'updateosc') {
  54    $album = new Album($db);
  55    $result = $album->fetch($id);
  56  
  57    $album->updateosc($user);
  58  }
  59  
  60  /*
  61   *
  62   *
  63   */
  64  if ($action == 'create')
  65  {
  66  
  67    print "<form action=\"fiche.php?id=$id\" method=\"post\">\n";
  68    print "<input type=\"hidden\" name=\"action\" value=\"add\">";
  69  
  70    print '<div class="titre">Nouvel album</div><br>';
  71        
  72    print '<table border="1" width="100%" cellspacing="0" cellpadding="4">';
  73    print "<tr>";
  74    print '<td>'.$langs->trans("Ref").'</td><td><input name="ref" size="20" value=""></td></tr>';
  75    print '<td>Titre</td><td><input name="titre" size="40" value=""></td></tr>';
  76    print '<tr><td>'.$langs->trans("Price").'</td><TD><input name="price" size="10" value=""></td></tr>';    
  77    print '<tr><td valign="top">'.$langs->trans("Description").'</td><td>';
  78    print '<textarea name="desc" rows="8" cols="50">';
  79    print "</textarea></td></tr>";
  80    print '<tr><td>&nbsp;</td><td><input type="submit" value="Créer"></td></tr>';
  81    print '</table>';
  82    print '</form>';
  83        
  84  
  85  }
  86  else
  87  {
  88    if ($id)
  89      {
  90  
  91        $album = new Album($db);
  92        $result = $album->fetch($id);
  93  
  94        if ( $result )
  95      { 
  96        print '<div class="titre">Fiche Album : '.$album->titre.'</div><br>';
  97        
  98        print '<table class="border" width="100%" cellspacing="0" cellpadding="3">';
  99        print '<tr>';
 100        print '<td>'.$langs->trans("Ref")."</td><td>$album->ref</td>\n";
 101        print '<td>'.$langs->trans("Status").'</td><td>$album->status</td></tr>\n";
 102        print "<td>Titre</td><td>$album->titre</td>\n";
 103        print '<td>'.$langs->trans("Price").'</td><TD>'.price($album->price).'</td></tr>';    
 104        print '<tr><td valign="top">'.$langs->trans("Description").'</td><td valign="top">'.nl2br($album->description)."</td>";
 105  
 106        $gas = $album->liste_groupart();
 107        print '<td valign="top">Artiste/Groupe</td><td><ul>';          
 108        foreach ($gas as $key => $value)
 109          {
 110            print '<li><a href="../groupart/fiche.php?id='.$key.'">'.$value."</a></li>";
 111          }
 112        print "</ul></td></tr>\n";
 113        print "</table>";
 114      }
 115      
 116        if ($action == 'edit')
 117      {
 118        print '<hr><div class="titre">Edition de la fiche Album : '.$album->titre.'</div><br>';
 119  
 120        print "<form action=\"fiche.php?id=$id\" method=\"post\">\n";
 121        print "<input type=\"hidden\" name=\"action\" value=\"update\">";
 122        
 123        print '<table class="border" width="100%" cellspacing="0" cellpadding="3">';
 124        print "<tr>";
 125        print '<td>'.$langs->trans("Ref").'</td><td><input name="ref" size="20" value="'.$album->ref.'"></td></tr>';
 126        print '<td>'.$langs->trans("Label").'</td><td><input name="titre" size="40" value="'.$album->titre.'"></td></tr>';
 127        print '<tr><td>'.$langs->trans("Price").'</td><td><input name="price" size="10" value="'.$album->price.'"></td></tr>';    
 128        print '<tr><td valign="top">'.$langs->trans("Description").'</td><td>';
 129        print '<textarea name="desc" rows="8" cols="50">';
 130        print $album->description;
 131        print "</textarea></td></tr>";
 132        print '<tr><td>&nbsp;</td><td><input type="submit" value="'.$langs->trans("Save").'"></td></tr>';
 133  
 134        print '</form>';
 135  
 136        $htmls = new Form($db);
 137        $ga = new Groupart($db);
 138  
 139        print "<form action=\"fiche.php?id=$id\" method=\"post\">\n";
 140        print "<input type=\"hidden\" name=\"action\" value=\"addga\">";
 141  
 142        foreach ($gas as $key => $value)
 143          {
 144            print '<tr><td>Artiste/Groupe</td>';
 145            print '<td><a href="../groupart/fiche.php?id='.$key.'">'.$value."</td></tr>\n";
 146          }
 147  
 148        print "<tr><td>Artiste/Groupe</td><td>";
 149        $htmls->select_array("ga",  $ga->liste_array());
 150        print "</td></tr>";
 151        print '<tr><td>&nbsp;</td><td><input type="submit" value="'.$langs->trans("Add").'"></td></tr>';
 152        print "</form>";
 153        print '</table>';
 154  
 155      }    
 156      }
 157    else
 158      {
 159        print "Error";
 160      }
 161  }
 162  
 163  /* ************************************************************************** */
 164  /*                                                                            */ 
 165  /* Barre d'action                                                             */ 
 166  /*                                                                            */ 
 167  /* ************************************************************************** */
 168  
 169  print '<br><table width="100%" border="1" cellspacing="0" cellpadding="3">';
 170  print '<td width="20%" align="center">-</td>';
 171  
 172  print '<td width="20%" align="center">[<a href="fiche.php?action=updateosc&id='.$id.'">Update Osc</a>]</td>';
 173  
 174  print '<td width="20%" align="center">-</td>';
 175  
 176  if ($action == 'create')
 177  {
 178    print '<td width="20%" align="center">-</td>';
 179  }
 180  else
 181  {
 182    print '<td width="20%" align="center">[<a href="fiche.php?action=edit&id='.$id.'">'.$langs->trans("Edit").'</a>]</td>';
 183  }
 184  print '<td width="20%" align="center">-</td>';    
 185  print '</table><br>';
 186  
 187  
 188  
 189  $db->close();
 190  
 191  llxFooter("<em>Derni&egrave;re modification $Date: 2004/10/20 20:06:49 $ r&eacute;vision $Revision: 1.9 $</em>");
 192  ?>


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