[ Index ] |
|
Code source de Dolibarr 2.0.1 |
1 <?php 2 /* Copyright (C) 2001-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org> 3 * Copyright (C) 2003 Jean-Louis Bergamo <jlb@j1b.org> 4 * Copyright (C) 2004-2005 Laurent Destailleur <eldy@users.sourceforge.net> 5 * 6 * This program is free software; you can redistribute it and/or modify 7 * it under the terms of the GNU General Public License as published by 8 * the Free Software Foundation; either version 2 of the License, or 9 * (at your option) any later version. 10 * 11 * This program is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 * GNU General Public License for more details. 15 * 16 * You should have received a copy of the GNU General Public License 17 * along with this program; if not, write to the Free Software 18 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 19 * 20 * $Id: type.php,v 1.24 2005/09/06 20:58:15 eldy Exp $ 21 * $Source: /cvsroot/dolibarr/dolibarr/htdocs/adherents/type.php,v $ 22 */ 23 24 /** 25 \file htdocs/adherents/type.php 26 \ingroup adherent 27 \brief Page de configuration des types d'adhérents 28 \version $Revision: 1.24 $ 29 */ 30 31 require ("./pre.inc.php"); 32 require (DOL_DOCUMENT_ROOT."/adherents/adherent.class.php"); 33 require(DOL_DOCUMENT_ROOT."/adherents/adherent_type.class.php"); 34 35 $langs->load("members"); 36 37 $rowid=isset($_GET["rowid"])?$_GET["rowid"]:$_POST["rowid"]; 38 39 40 41 if ($_POST["action"] == 'add' && $user->admin) 42 { 43 if ($_POST["button"] != $langs->trans("Cancel")) { 44 $adht = new AdherentType($db); 45 46 $adht->libelle = trim($_POST["libelle"]); 47 $adht->cotisation = $yesno[$_POST["cotisation"]]; 48 $adht->commentaire = trim($_POST["comment"]); 49 $adht->mail_valid = trim($_POST["mail_valid"]); 50 $adht->vote = $yesno[$_POST["vote"]]; 51 52 if ($adht->libelle) 53 { 54 $id=$adht->create($user->id); 55 if ($id > 0) 56 { 57 Header("Location: type.php"); 58 } 59 } 60 } 61 } 62 63 if ($_POST["action"] == 'update' && $user->admin) 64 { 65 if ($_POST["button"] != $langs->trans("Cancel")) { 66 $adht = new AdherentType($db); 67 $adht->id = $_POST["rowid"]; 68 $adht->libelle = $_POST["libelle"]; 69 $adht->cotisation = $yesno[$_POST["cotisation"]]; 70 $adht->commentaire = $_POST["comment"]; 71 $adht->mail_valid = $_POST["mail_valid"]; 72 $adht->vote = $yesno[$_POST["vote"]]; 73 74 $adht->update($user->id); 75 76 Header("Location: type.php?rowid=".$_POST["rowid"]); 77 exit; 78 } 79 } 80 81 if ($_GET["action"] == 'delete') 82 { 83 $adh = new Adherent($db); 84 $adh->delete($rowid); 85 Header("Location: liste.php"); 86 } 87 if ($_GET["action"] == 'commentaire') 88 { 89 $don = new Don($db); 90 $don->set_commentaire($rowid,$_POST["commentaire"]); 91 $action = "edit"; 92 } 93 94 95 96 llxHeader(); 97 98 99 100 /* ************************************************************************** */ 101 /* */ 102 /* Liste des types d'adhérents */ 103 /* */ 104 /* ************************************************************************** */ 105 106 if (! $rowid && $_GET["action"] != 'create' && $_GET["action"] != 'edit') { 107 108 print_titre($langs->trans("MembersTypeSetup")); 109 print '<br>'; 110 111 112 $sql = "SELECT d.rowid, d.libelle, d.cotisation, d.vote"; 113 $sql .= " FROM ".MAIN_DB_PREFIX."adherent_type as d"; 114 115 $result = $db->query($sql); 116 if ($result) 117 { 118 $num = $db->num_rows($result); 119 $i = 0; 120 121 print '<table class="noborder" width="100%">'; 122 123 print '<tr class="liste_titre">'; 124 print '<td>'.$langs->trans("Ref").'</td>'; 125 print '<td>'.$langs->trans("Label").'</td><td align="center">'.$langs->trans("SubscriptionRequired").'</td>'; 126 print '<td align="center">'.$langs->trans("VoteAllowed").'</td><td> </td>'; 127 print "</tr>\n"; 128 129 $var=True; 130 while ($i < $num) 131 { 132 $objp = $db->fetch_object($result); 133 $var=!$var; 134 print "<tr $bc[$var]>"; 135 print '<td><a href="type.php?rowid='.$objp->rowid.'">'.img_object($langs->trans("ShwoType"),'group').' '.$objp->rowid.'</a></td>'; 136 print '<td>'.$objp->libelle.'</td>'; 137 print '<td align="center">'.$langs->trans($objp->cotisation).'</td>'; 138 print '<td align="center">'.$langs->trans($objp->vote).'</td>'; 139 print '<td><a href="type.php?action=edit&rowid='.$objp->rowid.'">'.img_edit().'</td>'; 140 print "</tr>"; 141 $i++; 142 } 143 print "</table>"; 144 } 145 else 146 { 147 dolibarr_print_error($db); 148 } 149 150 151 /* 152 * Barre d'actions 153 * 154 */ 155 print '<div class="tabsAction">'; 156 print "<a class=\"tabAction\" href=\"type.php?action=create\">".$langs->trans("NewType")."</a>"; 157 print "</div>"; 158 159 } 160 161 162 /* ************************************************************************** */ 163 /* */ 164 /* Création d'un type adherent */ 165 /* */ 166 /* ************************************************************************** */ 167 168 169 if ($_GET["action"] == 'create') { 170 $htmls = new Form($db); 171 172 print_titre($langs->trans("NewMemberType")); 173 print '<br>'; 174 175 print "<form action=\"type.php\" method=\"post\">"; 176 print '<table class="border" width="100%">'; 177 178 print '<input type="hidden" name="action" value="add">'; 179 180 print '<tr><td>'.$langs->trans("Label").'</td><td><input type="text" name="libelle" size="40"></td></tr>'; 181 182 print '<tr><td>'.$langs->trans("SubscriptionRequired").'</td><td>'; 183 $htmls->selectyesnonum("cotisation",""); 184 print '</tr>'; 185 186 print '<tr><td>'.$langs->trans("VoteAllowed").'</td><td>'; 187 $htmls->selectyesnonum("vote",""); 188 print '</tr>'; 189 190 print '<tr><td valign="top">'.$langs->trans("Comments").'</td><td>'; 191 print "<textarea name=\"comment\" wrap=\"soft\" cols=\"60\" rows=\"3\"></textarea></td></tr>"; 192 193 print '<tr><td valign="top">'.$langs->trans("WelcomeEMail").'</td><td>'; 194 print "<textarea name=\"mail_valid\" wrap=\"soft\" cols=\"60\" rows=\"15\"></textarea></td></tr>"; 195 196 print '<tr><td colspan="2" align="center"><input type="submit" name="button" class="button" value="'.$langs->trans("Add").'"> '; 197 print '<input type="submit" name="button" class="button" value="'.$langs->trans("Cancel").'"></td></tr>'; 198 199 print "</form>\n"; 200 print "</table>\n"; 201 202 203 } 204 /* ************************************************************************** */ 205 /* */ 206 /* Edition de la fiche */ 207 /* */ 208 /* ************************************************************************** */ 209 if ($rowid > 0) 210 { 211 if ($_GET["action"] != 'edit') 212 { 213 $adht = new AdherentType($db); 214 $adht->id = $rowid; 215 $adht->fetch($rowid); 216 217 218 $h=0; 219 220 $head[$h][0] = $_SERVER["PHP_SELF"].'?rowid='.$adht->id; 221 $head[$h][1] = $langs->trans("MemberType").': '.$adht->libelle; 222 $h++; 223 224 dolibarr_fiche_head($head, 0, ''); 225 226 227 print '<table class="border" width="100%">'; 228 229 print '<tr><td width="15%">'.$langs->trans("Ref").'</td><td>'.$adht->id.'</td></tr>'; 230 print '<tr><td width="15%">'.$langs->trans("Label").'</td><td>'.$adht->libelle.'</td></tr>'; 231 232 print '<tr><td>'.$langs->trans("SubscriptionRequired").'</td><td>'; 233 print $adht->cotisation; 234 print '</tr>'; 235 236 print '<tr><td>'.$langs->trans("VoteAllowed").'</td><td>'; 237 print $adht->vote; 238 print '</tr>'; 239 240 print '<tr><td valign="top">'.$langs->trans("Comments").'</td><td>'; 241 print nl2br($adht->commentaire)."</td></tr>"; 242 243 print '<tr><td valign="top">'.$langs->trans("WelcomeEMail").'</td><td>'; 244 print nl2br($adht->mail_valid)."</td></tr>"; 245 246 print '</table>'; 247 248 print '</div>'; 249 250 /* 251 * Barre d'actions 252 * 253 */ 254 print '<div class="tabsAction">'; 255 print "<a class=\"tabAction\" href=\"type.php?action=edit&rowid=".$adht->id."\">".$langs->trans("Edit")."</a>"; 256 print "</div>"; 257 } 258 259 if ($_GET["action"] == 'edit') 260 { 261 $htmls = new Form($db); 262 263 $adht = new AdherentType($db); 264 $adht->id = $rowid; 265 $adht->fetch($rowid); 266 267 268 $h=0; 269 270 $head[$h][0] = $_SERVER["PHP_SELF"].'?rowid='.$adht->id; 271 $head[$h][1] = $langs->trans("MemberType").': '.$adht->libelle; 272 $h++; 273 274 dolibarr_fiche_head($head, 0, ''); 275 276 277 print '<form method="post" action="'.$_SERVER["PHP_SELF"].'?rowid='.$rowid.'">'; 278 print '<input type="hidden" name="rowid" value="'.$rowid.'">'; 279 print '<input type="hidden" name="action" value="update">'; 280 print '<table class="border" width="100%">'; 281 282 print '<tr><td width="15%">'.$langs->trans("Ref").'</td><td>'.$adht->id.'</td></tr>'; 283 284 print '<tr><td>'.$langs->trans("Label").'</td><td><input type="text" name="libelle" size="40" value="'.$adht->libelle.'"></td></tr>'; 285 286 print '<tr><td>'.$langs->trans("SubscriptionRequired").'</td><td>'; 287 $htmls->selectyesnonum("cotisation",$adht->cotisation); 288 print '</tr>'; 289 290 print '<tr><td>'.$langs->trans("VoteAllowed").'</td><td>'; 291 $htmls->selectyesnonum("vote",$adht->vote); 292 print '</tr>'; 293 294 print '<tr><td valign="top">'.$langs->trans("Comments").'</td><td>'; 295 print "<textarea name=\"comment\" wrap=\"soft\" cols=\"60\" rows=\"3\">".$adht->commentaire."</textarea></td></tr>"; 296 297 print '<tr><td valign="top">'.$langs->trans("WelcomeEMail").'</td><td>'; 298 print "<textarea name=\"mail_valid\" wrap=\"soft\" cols=\"60\" rows=\"15\">".$adht->mail_valid."</textarea></td></tr>"; 299 300 print '<tr><td colspan="2" align="center"><input type="submit" class="button" value="'.$langs->trans("Save").'"> '; 301 print '<input type="submit" name="button" class="button" value="'.$langs->trans("Cancel").'"></td></tr>'; 302 303 print '</table>'; 304 print "</form>"; 305 } 306 } 307 308 $db->close(); 309 310 llxFooter('$Date: 2005/09/06 20:58:15 $ - $Revision: 1.24 $'); 311 ?>
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 |
![]() |