m_user = &$mark; $this->m_email = $email; $this->perso = $perso; $this->m_type = $type; $this->m_data = $data; } // }}} // {{{ function formu() public function formu() { $res = XDB::query('SELECT IF(MAX(m.last)>p.relance, MAX(m.last), p.relance) FROM accounts AS a LEFT JOIN register_pending AS p ON p.uid = a.uid LEFT JOIN register_marketing AS m ON m.uid = a.uid WHERE a.uid = {?}', $this->m_user->id()); $this->m_relance = $res->fetchOneCell(); return 'include/form.valid.mark.tpl'; } // }}} // {{{ function _mail_subj protected function _mail_subj() { return "[Polytechnique.org] Marketing de {$this->m_user->fullName()} ({$this->m_user->promo()})"; } // }}} // {{{ function _mail_body protected function _mail_body($isok) { if ($isok) { return " Un email de marketing vient d'être envoyé " . ($this->perso ? 'en ton nom' : 'en notre nom') . " à {$this->m_user->fullName()} ({$this->m_user->promo()}) " . "pour l'encourager à s'inscrire !\n\n" . "Merci de ta participation !\n"; } else { return " Nous n'avons pas jugé bon d'envoyer d'email de marketing à " . "{$this->m_user->fullName()} ({$this->m_user->promo()})."; } } // }}} // {{{ function commit() public function commit() { $market = Marketing::get($this->m_user->id(), $this->m_email); if ($market == null) { return false; } $market->send(); return true; } // }}} } // vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8: ?>