function __construct($id) { $obj = new CTableEmail(array('id'=>$id)); $this->email = $obj->select_row(); $obj = new CTableTexte(array('id'=>$this->email['id_text'])); $this->text = $obj->select_row(); $this->expediteur = $this->get_expediteur(); $this->destinataires = $this->get_destinataires(); $this->objet = $this->get_objet(); $this->message = $this->get_message(); }
$email = $obj->select_row(); $expediteur = $email['expediteur']; $destinataire = $email['destinataire']; $nom = $email['nom']; $text = $email['text']; $pj = $email['pj']; $date = $email['date']; $tdes = new CTableTexte(array('id'=>$email['id_text'])); $texte = $tdes->select_row(); $style = $texte['style']; } else if(!empty($_GET['reply'])) { $reply = $_GET['reply']; $obj = new CTableEmail(array('id'=>$reply)); $email = $obj->select_row(); $expediteur = $email['destinataire']; $destinataire = $email['expediteur']; $nom = "Re : " . $email['nom']; $text = $email['text']; } else { if(!empty($_GET['expediteur'])) $expediteur = $_GET['expediteur']; if(!empty($_GET['destinataire'])) $destinataire = $_GET['destinataire']; if(!empty($_GET['nom'])) $nom = $_GET['nom']; if(!empty($_GET['text'])) $text = $_GET['text']; } break; case 55 : // Envoyer 2 if(!empty($_POST['id'])) $id = $_POST['id'];
'type'=>'relance', 'etat'=>$etat, 'periode'=>$periode, 'date'=>'0000-00-00 00:00:00' ) ); $email->insert(); $msginfo = 'Envoi bien ajouté'; $a = 0; break; case 5 : // Modifier 1 if(!empty($_GET['id'])) $id = $_GET['id']; $email = new CTableEmail(array('id'=>$id)); $des = $email->select_row(); $nom = $des['nom']; $etat = $des['etat']; $periode = $des['periode']; $texte = CBdd::select_row("SELECT id FROM texte WHERE nom = '" . $des['text']."'"); $id_texte = $texte['id']; break; case 55 : // Modifier 2 if(!empty($_POST['id'])) $id = $_POST['id']; if(!empty($_POST['nom'])) $nom = trim($_POST['nom']); if(!empty($_POST['etat'])) $etat = $_POST['etat']; if(!empty($_POST['periode'])) $periode = $_POST['periode'] + 0;
if(!$result) { echo 'INSERT_ERROR, 0'; } else { echo 'Enregistrement réussi'; } } else{ echo 'Cette date est déja passée ou prise'; } break; case 5: // AFFICHAGE POUR MODIFICATION $t_envoi = new CTableEmail(array('id'=>$id)); $envoi = $t_envoi->select_row(); $sql = "SELECT DATE_FORMAT(date, '%Y/%m/%d') AS min_range FROM email WHERE date < '".$envoi['date']."' AND id_campagne = ".$envoi['id_campagne']." ORDER BY date DESC LIMIT 0, 1"; $left = CBdd::select_one($sql, 'min_range'); $sql = "SELECT DATE_FORMAT(date, '%Y/%m/%d') AS max_range FROM email WHERE date > '".$envoi['date']."' AND id_campagne = ".$envoi['id_campagne']." ORDER BY date ASC LIMIT 0, 1"; $right = CBdd::select_one($sql, 'max_range'); ?> <fieldset> <legend>Modifier <?php echo $nom; ?></legend> <p> <label>Type Groupe</label> <span style="font-size:12px">Groupe</span> <input type="radio" id="groupe" style="font-size:12px;" name="isGr" value="0" <?php if ($envoi['type_envoi'] == 0) echo 'checked="checked"'; ?> onclick="javascript:fct_groupe('<?= $nom; ?>', <?php echo $envoi['id']; ?>, 0, 5);" /> <span style="font-size:12px">Groupe GR</span> <input type="radio" id="groupe_gr" style="font-size:12px;" name="isGr" value="1" <?php if ($envoi['type_envoi'] == 1) echo 'checked="checked"'; ?> onclick="javascript:fct_groupe('<?= $nom; ?>', <?php echo $envoi['id']; ?>, 1, 5);" /> </p>