[ 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 16:58:40 eldy Exp $ 20 * $Source: /cvsroot/dolibarr/dolibarr/htdocs/boutique/newsletter/fiche.php,v $ 21 * 22 */ 23 24 /*! \file htdocs/boutique/newsletter/fiche.php 25 \ingroup boutique 26 \brief Fiche newsletter 27 \version $Revision: 1.10 $ 28 */ 29 30 require ("./pre.inc.php"); 31 32 if ($_POST["action"] == 'add') { 33 $newsletter = new Newsletter($db); 34 35 $newsletter->email_subject = $_POST["email_subject"]; 36 $newsletter->email_from_name = $_POST["email_from_name"]; 37 $newsletter->email_from_email = $_POST["email_from_email"]; 38 $newsletter->email_replyto = $_POST["email_replyto"]; 39 $newsletter->email_body = $_POST["email_body"]; 40 41 $id = $newsletter->create($user); 42 } 43 44 if ($_POST["action"] == 'addga') { 45 $newsletter = new Newsletter($db); 46 47 $newsletter->linkga($id, $ga); 48 } 49 50 if ($_POST["action"] == 'update' && !$cancel) 51 { 52 $newsletter = new Newsletter($db); 53 54 $newsletter->email_subject = $_POST["email_subject"]; 55 $newsletter->email_from_name = $_POST["email_from_name"]; 56 $newsletter->email_from_email = $_POST["email_from_email"]; 57 $newsletter->email_replyto = $_POST["email_replyto"]; 58 $newsletter->email_body = $_POST["email_body"]; 59 60 $newsletter->update($id, $user); 61 } 62 63 if ($_POST["action"] == 'confirm_delete' && $_POST["confirm"] == yes) 64 { 65 $newsletter = new Newsletter($db); 66 $result = $newsletter->fetch($id); 67 $newsletter->delete(); 68 Header("Location: index.php"); 69 } 70 71 if ($_POST["action"] == 'confirm_valid' && $_POST["confirm"] == yes) 72 { 73 $newsletter = new Newsletter($db); 74 $result = $newsletter->fetch($id); 75 $newsletter->validate($user); 76 } 77 78 if ($_POST["action"] == 'confirm_send' && $_POST["confirm"] == yes) 79 { 80 $newsletter = new Newsletter($db); 81 $result = $newsletter->fetch($id); 82 $newsletter->send($user); 83 } 84 85 86 llxHeader(); 87 88 /* 89 * 90 * 91 */ 92 if ($action == 'create') 93 { 94 95 print "<form action=\"fiche.php?id=$id\" method=\"post\">\n"; 96 print '<input type="hidden" name="action" value="add">'; 97 98 print '<div class="titre">Nouvelle Newsletter</div><br>'; 99 100 print '<table border="1" width="100%" cellspacing="0" cellpadding="4">'; 101 print '<tr><td width="20%">Emetteur nom</td><td><input name="email_from_name" size="30" value=""></td></tr>'; 102 print '<tr><td width="20%">Emetteur email</td><td><input name="email_from_email" size="40" value=""></td></tr>'; 103 print '<tr><td width="20%">Email de réponse</td><td><input name="email_replyto" size="40" value=""> (facultatif)</td></tr>'; 104 print '<tr><td width="20%">Sujet</td><td width="80%"><input name="email_subject" size="30" value=""></td></tr>'; 105 print '<tr><td width="20%">Cible</td><td><input name="nom" size="40" value=""></td></tr>'; 106 print '<tr><td width="20%" valign="top">Texte</td><td width="80%"><textarea name="email_body" rows="10" cols="60"></textarea></td></tr>'; 107 print '<tr><td colspan="2" align="center"><input type="submit" value="Créer"></td></tr>'; 108 print '</table>'; 109 print '</form>'; 110 111 } 112 else 113 { 114 if ($id) 115 { 116 117 $newsletter = new Newsletter($db); 118 $result = $newsletter->fetch($id); 119 120 if ( $result ) 121 { 122 123 /* 124 * Confirmation de la suppression de la newsletter 125 * 126 */ 127 if ($action == 'delete') 128 { 129 $htmls = new Form($db); 130 $htmls->form_confirm("fiche.php?id=$id","Supprimer une newsletter","Etes-vous sur de vouloir supprimer cet newsletter ?","confirm_delete"); 131 } 132 133 /* 134 * Confirmation de la validation 135 * 136 */ 137 if ($action == 'valid') 138 { 139 $htmls = new Form($db); 140 $htmls->form_confirm('fiche.php?id='.$id,"Valider une newsletter","Etes-vous sûr de vouloir valider cette newsletter ?"); 141 } 142 /* 143 * 144 * 145 */ 146 if ($action == 'send') 147 { 148 149 print '<form method="post" action="fiche.php?id='.$id.'">'; 150 print '<input type="hidden" name="action" value="confirm_send">'; 151 print '<table class="border" width="100%">'; 152 153 print '<tr><td colspan="3">Envoi de newsletter</td></tr>'; 154 155 print '<tr><td class="delete">Etes-vous sur de vouloir envoyer cette newsletter ?</td><td class="delete">'; 156 $htmls = new Form($db); 157 158 $htmls->selectyesno("confirm","no"); 159 160 print "</td>\n"; 161 print '<td class="delete" align="center"><input type="submit" value="Confirmer"</td></tr>'; 162 print '</table>'; 163 print "</form>\n"; 164 } 165 166 /* 167 * Edition de la fiche 168 * 169 */ 170 171 172 if ($action == 'edit') 173 { 174 print '<div class="titre">Edition de la fiche Newsletter : '.$newsletter->titre.'</div><br>'; 175 176 print "<form action=\"fiche.php?id=$id\" method=\"post\">\n"; 177 print '<input type="hidden" name="action" value="update">'; 178 179 print '<table class="border">'; 180 181 print '<tr><td>Emetteur nom</td><td><input name="email_from_name" size="30" value="'.$newsletter->email_from_name.'"></td></tr>'; 182 print '<tr><td>Emetteur email</td><td><input name="email_from_email" size="40" value="'.$newsletter->email_from_email.'"></td></tr>'; 183 print '<tr><td>Email de réponse</td><td><input name="email_replyto" size="40" value="'.$newsletter->email_replyto.'"></td></tr>'; 184 185 print "<tr>"; 186 print '<td width="20%">Sujet</td>'; 187 print '<td><input name="email_subject" size="40" value="'.$newsletter->email_subject.'"></td>'; 188 189 print '<tr><td width="20%" valign="top">Texte</td><td width="80%"><textarea name="email_body" rows="10" cols="60">'.$newsletter->email_body.'</textarea></td></tr>'; 190 191 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>'; 192 193 print '</form>'; 194 195 print '</table><hr>'; 196 197 } 198 199 /* 200 * Affichage de la fiche 201 * 202 */ 203 204 print '<div class="titre">Fiche Newsletter : '.$newsletter->titre.'</div><br>'; 205 206 print '<table class="border" width="100%">'; 207 208 print '<tr><td width="20%">Emetteur nom</td><td>'.$newsletter->email_from_name.'</td></tr>'; 209 print '<tr><td width="20%">Emetteur email</td><td>'.$newsletter->email_from_email.'</td></tr>'; 210 print '<tr><td width="20%">Email de réponse</td><td>'.$newsletter->email_replyto.'</td></tr>'; 211 print '<tr><td width="20%">Nom</td><td width="80%">'.$newsletter->email_subject.'</td></tr>'; 212 print '<tr><td width="20%" valign="top">Texte</td><td width="80%">'.nl2br($newsletter->email_body).'</td></tr>'; 213 214 print "</table>"; 215 216 if ($newsletter->status == 3) 217 { 218 print "<br />"; 219 print '<table class="border" width="100%">'; 220 221 print '<tr><td width="20%">Début de l\'envoi</td><td width="30%">'.strftime("%d %B %Y %H:%M:%S",$newsletter->date_send_begin).'</td>'; 222 print '<td width="20%">Nombre de mails envoyés</td><td width="30%">'.$newsletter->nbsent.'</td></tr>'; 223 224 print '<tr><td width="20%">Fin de l\'envoi</td><td width="30%">'.strftime("%d %B %Y %H:%M:%S",$newsletter->date_send_end).'</td>'; 225 print '<td width="20%">Nombre de mails en erreur</td><td width="30%">'.$newsletter->nberror.'</td></tr>'; 226 print "</table>"; 227 } 228 229 } 230 else 231 { 232 print "Fetch failed"; 233 } 234 235 236 } 237 else 238 { 239 print "Error"; 240 } 241 } 242 243 /* ************************************************************************** */ 244 /* */ 245 /* Barre d'action */ 246 /* */ 247 /* ************************************************************************** */ 248 249 print '<div class="tabsAction">'; 250 if ($newsletter->status == 0) 251 { 252 print '<a class="tabAction" href="fiche.php?action=edit&id='.$id.'">'.$langs->trans("Edit").'</a>'; 253 } 254 255 if ($newsletter->status == 0 && $id) 256 { 257 print '<a class="tabAction" href="fiche.php?action=valid&id='.$id.'">'.$langs->trans("Valid").'</a>'; 258 } 259 260 if ($newsletter->status == 1) 261 { 262 print '<a class="tabAction" href="fiche.php?action=send&id='.$id.'">'.$langs->trans("Send").'</a>'; 263 } 264 265 if($id && $newsletter->status == 0) 266 { 267 print '<a class="tabAction" href="fiche.php?action=delete&id='.$id.'">'.$langs->trans("Delete").'</a>'; 268 } 269 print '</div>'; 270 271 272 $db->close(); 273 274 llxFooter("<em>Dernière modification $Date: 2004/10/23 16:58:40 $ révision $Revision: 1.10 $</em>"); 275 ?>
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 |
![]() |