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


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