remove smarty {version} function, we have {#globals.version#} for it !!!
[platal.git] / include / validations / marketing.inc.php
CommitLineData
0337d704 1<?php
2/***************************************************************************
50a40a33 3 * Copyright (C) 2003-2006 Polytechnique.org *
0337d704 4 * http://opensource.polytechnique.org/ *
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., *
19 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
20 ***************************************************************************/
21
22// {{{ class MarkReq
23
24class MarkReq extends Validate
25{
26 // {{{ properties
27
28 var $perso;
29
30 var $m_id;
31 var $m_email;
32 var $m_nom;
33 var $m_prenom;
34 var $m_promo;
35
36 var $rules = "Accepter si l'adresse mail parait correcte, et pas absurde (ou si le marketeur est de confiance). Si le
37 demandeur marque sa propre adresse mail, refuser dans tous les cas.
38 Ne pas marqueter au nom de Polytechnique.org plus d'une
39 fois par an.";
40 // }}}
41 // {{{ constructor
42
43 function MarkReq($sender, $mark_id, $email, $perso = false) {
0337d704 44 $this->Validate($sender, false, 'marketing');
45 $this->m_id = $mark_id;
46 $this->m_email = $email;
47 $this->perso = $perso;
48
08cce2ff 49 $res = XDB::query('SELECT nom, prenom, promo FROM auth_user_md5 WHERE user_id = {?}', $mark_id);
0337d704 50 list ($this->m_nom, $this->m_prenom, $this->m_promo) = $res->fetchOneRow();
51 }
52
53 // }}}
54 // {{{ function formu()
55
56 function formu()
57 { return 'include/form.valid.mark.tpl'; }
58
59 // }}}
60 // {{{ function _mail_subj
61
62 function _mail_subj()
63 {
64 return "[Polytechnique.org] Marketing de {$this->m_prenom} {$this->m_nom} ({$this->m_promo})";
65 }
66
67 // }}}
68 // {{{ function _mail_body
69
70 function _mail_body($isok)
71 {
72 if ($isok) {
73 return " Un mail de marketing vient d'être envoyé "
74 .($this->perso ? 'en ton nom' : 'en notre nom')
75 ." à {$this->m_prenom} {$this->m_nom} ({$this->m_promo}) pour l'encourager à s'inscrire !\n\n"
76 ."Merci de ta participation !\n";
77 } else {
78 return " Nous n'avons pas jugé bon d'envoyer de mail de marketing à {$this->m_prenom} {$this->m_nom} ({$this->m_promo}).";
79 }
80 }
81
82 // }}}
83 // {{{ function commit()
84
85 function commit()
86 {
0337d704 87 require_once('marketing.inc.php');
88 mark_send_mail($this->m_id, $this->m_email,(!$this->perso)?"staff":"user");
89 return true;
90 }
91
92 // }}}
93}
94
95// }}}
96
97// vim:set et sw=4 sts=4 sws=4 foldmethod=marker:
98?>