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