]> dev.renevier.net Git - syj.git/blob - application/models/Pending/ValidateCreation.php
account creation email title to be more explicit
[syj.git] / application / models / Pending / ValidateCreation.php
1 <?php
2 /*  This file is part of Syj, Copyright (c) 2010-2011 Arnaud Renevier,
3     and is published under the AGPL license. */
4
5 class Syj_Model_Pending_ValidateCreation extends Syj_Model_Pending
6 {
7     protected $_action = 'validate_creation';
8     protected function _run() {
9         return true;
10     }
11
12     public function _notify() {
13         switch ($this->_notifications_number) {
14             case 0:
15                 $subject = $this->translate("[SYJ] Please validate your account", $this->_user->lang);
16                 $text = $this->translate("Hi %user%, and welcome on syj
17
18 Your account is currently active, but you need to confirm your inscription by
19 following this link:
20 %hashurl%
21
22 If you do not not confirm your inscription within 7 days, your account will be
23 deleted.
24
25 Please do not reply this email. If you need to contact us, please use the form
26 contact at %contacturl%
27
28 Thanks,
29
30 Syj team", $this->_user->lang);
31             break;
32
33             case 1:
34                 $subject = $this->translate("[SYJ] Reminder: Validate your account", $this->_user->lang);
35                 $text = $this->translate("Hi %user%,
36
37 You need to validate your account on syj since 6 days. Otherwise, your
38 account will be deleted tomorrow. Please follow this link:
39 %hashurl%
40
41 Please do not reply this email. If you need to contact us, please use the form
42 contact at %contacturl%
43
44 Thanks,
45
46 Syj team", $this->_user->lang);
47
48             break;
49
50             default:
51                 $subject = $this->translate("[SYJ] Account deactivated", $this->_user->lang);
52                 $text = $this->translate("Hi %user%,
53
54 You have not validated your syj account on time. Therefore, your account have
55 been deleted. Nevertheless, you can still create a new account.
56
57 Please do not reply this email. If you need to contact us, please use the form
58 contact at %contacturl%
59
60 Regards,
61
62 Syj team", $this->_user->lang);
63         }
64
65         $text = str_replace('%user%', $this->_user->pseudo, $text);
66         $text = str_replace('%hashurl%', $this->getHashUrl(), $text);
67         $text = str_replace('%contacturl%', $this->getContactUrl(), $text);
68
69         return $this->_sendMail($subject, $text);
70     }
71
72     protected function _cancel() {
73         $mapper = new Syj_Model_UserMapper();
74         $mapper->delete($this->_user);
75         return true;
76     }
77 }