[ 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/boutique/editeur/ -> 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/23 14:58:32 eldy Exp $
  20   * $Source: /cvsroot/dolibarr/dolibarr/htdocs/boutique/editeur/fiche.php,v $
  21   *
  22   */
  23  
  24  require ("./pre.inc.php");
  25  
  26  if ($action == 'add') {
  27    $editeur = new Editeur($db);
  28  
  29    $editeur->nom = $nom;
  30  
  31    $id = $editeur->create($user);
  32  }
  33  
  34  if ($action == 'addga') {
  35    $editeur = new Editeur($db);
  36  
  37    $editeur->linkga($id, $ga);
  38  }
  39  
  40  if ($action == 'update' && !$cancel)
  41  {
  42    $editeur = new Editeur($db);
  43  
  44    $editeur->nom = $nom;
  45  
  46    $editeur->update($id, $user);
  47  }
  48  
  49  if ($_POST["action"] == 'confirm_delete' && $_POST["confirm"] == yes)
  50  {
  51    $editeur = new Editeur($db);
  52    $result = $editeur->fetch($id);
  53    $editeur->delete();
  54    Header("Location: index.php");
  55  }
  56  
  57  llxHeader();
  58  
  59  /*
  60   *
  61   *
  62   */
  63  if ($action == 'create')
  64  {
  65  
  66    print "<form action=\"fiche.php?id=$id\" method=\"post\">\n";
  67    print '<input type="hidden" name="action" value="add">';
  68  
  69    print '<div class="titre">Nouvel Editeur</div><br>';
  70        
  71    print '<table border="1" width="100%" cellspacing="0" cellpadding="4">';
  72    print "<tr>";
  73    print '<td width="20%">Nom</td><td><input name="nom" size="40" value=""></td></tr>';
  74    print '<tr><td>&nbsp;</td><td><input type="submit" value="Créer"></td></tr>';
  75    print '</table>';
  76    print '</form>';
  77        
  78  
  79  }
  80  else
  81  {
  82    if ($id)
  83      {
  84  
  85        $editeur = new Editeur($db);
  86        $result = $editeur->fetch($id);
  87  
  88        if ( $result )
  89      { 
  90        $livres = $editeur->liste_livre();
  91  
  92        /*
  93         * Confirmation de la suppression de l'editeur
  94         *
  95         */
  96        
  97        if ($action == 'delete')
  98          {
  99            $htmls = new Form($db);
 100            $htmls->form_confirm("fiche.php?id=$id","Supprimer un éditeur","Etes-vous sur de vouloir supprimer cet éditeur ?","confirm_delete");
 101          }
 102        
 103        /*
 104         * Edition de la fiche
 105         *
 106         */
 107  
 108        if ($action == 'edit')
 109          {
 110            print '<div class="titre">Edition de la fiche Editeur : '.$editeur->titre.'</div><br>';
 111            
 112            print "<form action=\"fiche.php?id=$id\" method=\"post\">\n";
 113            print '<input type="hidden" name="action" value="update">';
 114            
 115            print '<table class="border" width="100%">';
 116            print "<tr>";
 117            print '<td width="20%">Nom</td><td width="80%"><input name="nom" size="40" value="'.$editeur->nom.'"></td>';
 118  
 119            print '<tr><td colspan="2" align="center"><input type="submit" value="'.$langs->trans("Save").'">&nbsp;<input type="submit" value="'.$langs->trans("Cancel").'" name="cancel"></td></tr>';
 120            
 121            print '</form>';
 122  
 123            print '</table><hr>';
 124            
 125          }    
 126  
 127        print '<div class="titre">Fiche Editeur : '.$editeur->titre.'</div><br>';
 128  
 129        print '<table class="border" width="100%">';
 130        print "<tr>";
 131        print '<td width="20%">Nom</td><td width="80%">'.$editeur->nom.'</td></tr>';
 132  
 133        print '<tr><td>Livres</td><td>';
 134  
 135        foreach ($livres as $key => $value)
 136          {
 137            print '<a href="../livre/fiche.php?id='.$key.'">'.$value."<br>\n";
 138          }
 139        print "</td></tr>";
 140  
 141        print "</table>";
 142  
 143  
 144  
 145      }
 146        else
 147      {
 148        print "Fetch failed";
 149      }
 150      
 151  
 152      }
 153    else
 154      {
 155        print "Error";
 156      }
 157  }
 158  
 159  /* ************************************************************************** */
 160  /*                                                                            */ 
 161  /* Barre d'action                                                             */ 
 162  /*                                                                            */ 
 163  /* ************************************************************************** */
 164  
 165  print '<div class="tabsAction">';
 166  if ($action != 'create')
 167  {
 168    print '<a class="tabAction" href="fiche.php?action=edit&id='.$id.'">'.$langs->trans("Edit").'</a>';
 169  }
 170  
 171  if(sizeof($livres)==0 && $id)
 172  {
 173    print '<a class="tabAction" href="fiche.php?action=delete&id='.$id.'">'.$langs->trans("Delete").'</a>';
 174  }
 175  print '</div>';
 176  
 177  
 178  $db->close();
 179  
 180  llxFooter("<em>Derni&egrave;re modification $Date: 2004/10/23 14:58:32 $ r&eacute;vision $Revision: 1.9 $</em>");
 181  ?>


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