"INSERT INTO register_marketing (uid,sender,email,date,last,nb,type,hash)
VALUES ({?}, {?}, {?}, NOW(), 0, 0, {?}, '')",
$uid, Session::getInt('uid'), $email, Env::get('origine'));
+ require_once('validations.inc.php');
+ $req = new MarkReq(Session::getInt('uid'), $uid, $email, Env::get('origine')=='user');
+ $req->submit();
}
}
}
--- /dev/null
+<?php
+/***************************************************************************
+ * Copyright (C) 2003-2004 Polytechnique.org *
+ * http://opensource.polytechnique.org/ *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the Free Software *
+ * Foundation, Inc., *
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
+ ***************************************************************************/
+
+// {{{ class MarkReq
+
+class MarkReq extends Validate
+{
+ // {{{ properties
+
+ var $perso;
+
+ var $m_id;
+ var $m_email;
+ var $m_nom;
+ var $m_prenom;
+ var $m_promo;
+
+ // }}}
+ // {{{ constructor
+
+ function MarkReq($sender, $mark_id, $email, $perso = false) {
+ global $globals;
+ $this->Validate($sender, false, 'marketing');
+ $this->m_id = $mark_id;
+ $this->m_email = $email;
+ $this->perso = $perso;
+
+ $res = $globals->xdb->query('SELECT nom, prenom, promo FROM auth_user_md5 WHERE user_id = {?}', $mark_id);
+ list ($this->m_nom, $this->m_prenom, $this->m_promo) = $res->fetchOneRow();
+ }
+
+ // }}}
+ // {{{ function formu()
+
+ function formu()
+ { return 'include/form.valid.mark.tpl'; }
+
+ // }}}
+ // {{{ function _mail_subj
+
+ function _mail_subj()
+ {
+ return "[Polytechnique.org] Marketing de {$this->m_prenom} {$this->m_nom} ({$this->m_promo})";
+ }
+
+ // }}}
+ // {{{ function _mail_body
+
+ function _mail_body($isok)
+ {
+ if ($isok) {
+ return " Un mail de marketing vient d'être envoyé "
+ .($this->perso ? 'en ton nom' : 'en notre nom')
+ ." à {$this->m_prenom} {$this->m_nom} ({$this->m_promo}) pour l'encourrager à s'inscrire !\n\n"
+ ."Merci de ta participation !\n";
+ } else {
+ return " Nous n'avons pas jugé bon d'envoyer de mail de marketing à {$this->m_prenom} {$this->m_nom} ({$this->m_promo}).";
+ }
+ }
+
+ // }}}
+ // {{{ function commit()
+
+ function commit()
+ {
+ global $globals;
+ $hash = rand_url_id(12);
+ $globals->xdb->execute('UPDATE register_marketing SET nb=1,hash={?} WHERE uid={?} AND email={?}', $hash, $this->m_id, $this->m_email);
+ // TODO HERE SEND A MARKETING MAIL
+ return true;
+ }
+
+ // }}}
+}
+
+// }}}
+
+// vim:set et sw=4 sts=4 sws=4 foldmethod=marker:
+?>
--- /dev/null
+{***************************************************************************
+ * Copyright (C) 2003-2004 Polytechnique.org *
+ * http://opensource.polytechnique.org/ *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the Free Software *
+ * Foundation, Inc., *
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
+ ***************************************************************************}
+
+
+<tr class="pair">
+ <td class="titre">Marketing sur</td>
+ <td>{$valid->m_prenom} {$valid->m_nom} ({$valid->m_promo})</td>
+</tr>
+<tr class="pair">
+ <td class="titre">Mail deviné</td>
+ <td>{$valid->m_email}</td>
+</tr>
+<tr class="pair">
+ <td class="titre">Envoi de mail ...</td>
+ <td>{if $valid->perso}perso{else}par poly.org{/if}</td>
+</tr>
+
+{* vim:set et sw=2 sts=2 sws=2: *}