projects
/
platal.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Version d'alakazam, plus simple.
[platal.git]
/
include
/
validations
/
marketing.inc.php
diff --git
a/include/validations/marketing.inc.php
b/include/validations/marketing.inc.php
index
317b84f
..
c8fbb9a
100644
(file)
--- a/
include/validations/marketing.inc.php
+++ b/
include/validations/marketing.inc.php
@@
-1,6
+1,6
@@
<?php
/***************************************************************************
<?php
/***************************************************************************
- * Copyright (C) 2003-200
7
Polytechnique.org *
+ * Copyright (C) 2003-200
8
Polytechnique.org *
* http://opensource.polytechnique.org/ *
* *
* This program is free software; you can redistribute it and/or modify *
* http://opensource.polytechnique.org/ *
* *
* This program is free software; you can redistribute it and/or modify *
@@
-24,39
+24,44
@@
class MarkReq extends Validate
{
// {{{ properties
{
// {{{ properties
-
var
$perso;
+
public
$perso;
- var $m_id;
- var $m_email;
- var $m_nom;
- var $m_prenom;
- var $m_promo;
- var $m_relance;
+ public $m_id;
+ public $m_email;
+ public $m_nom;
+ public $m_prenom;
+ public $m_promo;
+ public $m_relance;
+ public $m_type;
+ public $m_data;
- var $rules = "Accepter si l'adresse mail parait correcte, et pas absurde (ou si le marketeur est de confiance). Si le
+ public $rules = "Accepter si l'adresse mail parait correcte, et pas absurde (ou si le marketeur est de confiance). Si le
demandeur marque sa propre adresse mail, refuser dans tous les cas.
demandeur marque sa propre adresse mail, refuser dans tous les cas.
- Ne pas marqueter au nom de Polytechnique.org plus d'une
-
fois par an
.";
+ Ne pas marqueter au nom de Polytechnique.org plus d'une
fois par an.
+
Sauf abus flagrant, il n'y a pas de raison de refuser des marketing perso répétés
.";
// }}}
// {{{ constructor
// }}}
// {{{ constructor
- function MarkReq($sender, $mark_id, $email, $perso = false) {
- $this->Validate($sender, false, 'marketing');
+ public function __construct($sender, $mark_id, $email, $perso, $type, $data)
+ {
+ parent::__construct($sender, false, 'marketing');
$this->m_id = $mark_id;
$this->m_email = $email;
$this->perso = $perso;
$this->m_id = $mark_id;
$this->m_email = $email;
$this->perso = $perso;
+ $this->m_type = $type;
+ $this->m_data = $data;
- $res = XDB::query('SELECT u.nom, u.prenom, u.promo
,
+ $res = XDB::query('SELECT u.nom, u.prenom, u.promo
FROM auth_user_md5 AS u
WHERE user_id = {?}
GROUP BY u.user_id', $mark_id);
FROM auth_user_md5 AS u
WHERE user_id = {?}
GROUP BY u.user_id', $mark_id);
- list ($this->m_nom, $this->m_prenom, $this->m_promo) = $res->fetchOneRow();
+ list ($this->m_nom, $this->m_prenom, $this->m_promo) = $res->fetchOneRow();
}
// }}}
// {{{ function formu()
}
// }}}
// {{{ function formu()
- function formu()
+
public
function formu()
{
$res = XDB::query('SELECT IF(MAX(m.last)>p.relance, MAX(m.last), p.relance)
FROM auth_user_md5 AS u
{
$res = XDB::query('SELECT IF(MAX(m.last)>p.relance, MAX(m.last), p.relance)
FROM auth_user_md5 AS u
@@
-70,8
+75,8
@@
class MarkReq extends Validate
// }}}
// {{{ function _mail_subj
// }}}
// {{{ function _mail_subj
-
- function _mail_subj()
+
+
protected
function _mail_subj()
{
return "[Polytechnique.org] Marketing de {$this->m_prenom} {$this->m_nom} ({$this->m_promo})";
}
{
return "[Polytechnique.org] Marketing de {$this->m_prenom} {$this->m_nom} ({$this->m_promo})";
}
@@
-79,30
+84,33
@@
class MarkReq extends Validate
// }}}
// {{{ function _mail_body
// }}}
// {{{ function _mail_body
- function _mail_body($isok)
+
protected
function _mail_body($isok)
{
if ($isok) {
{
if ($isok) {
- return " Un mail de marketing vient d'
être envoyé
"
+ return " Un mail de marketing vient d'
être envoyé
"
.($this->perso ? 'en ton nom' : 'en notre nom')
.($this->perso ? 'en ton nom' : 'en notre nom')
- ."
à {$this->m_prenom} {$this->m_nom} ({$this->m_promo}) pour l'encourager à
s'inscrire !\n\n"
+ ."
à {$this->m_prenom} {$this->m_nom} ({$this->m_promo}) pour l'encourager à
s'inscrire !\n\n"
."Merci de ta participation !\n";
} else {
."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}).";
+ 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()
- function commit()
+
public
function commit()
{
{
- require_once('marketing.inc.php');
- mark_send_mail($this->m_id, $this->m_email,(!$this->perso)?"staff":"user");
+ $market = Marketing::get($this->m_id, $this->m_email);
+ if ($market == null) {
+ return false;
+ }
+ $market->send();
return true;
}
// }}}
}
return true;
}
// }}}
}
-// vim:set et sw=4 sts=4 sws=4 foldmethod=marker:
+// vim:set et sw=4 sts=4 sws=4 foldmethod=marker
enc=utf-8
:
?>
?>