]> dev.renevier.net Git - syj.git/blob - application/models/Pending/ValidateCreation.php
version 0.1
[syj.git] / application / models / Pending / ValidateCreation.php
1 <?php
2 /*  This file is part of Syj, Copyright (c) 2010 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] 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 and all
23 your items will be 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 and
55 all your data have been deleted. Nevertheless, you can still create a new
56 account.
57
58 Please do not reply this email. If you need to contact us, please use the form
59 contact at %contacturl%
60
61 Regards,
62
63 Syj team", $this->_user->lang);
64         }
65
66         $text = str_replace('%user%', $this->_user->pseudo, $text);
67         $text = str_replace('%hashurl%', $this->getHashUrl(), $text);
68         $text = str_replace('%contacturl%', $this->getContactUrl(), $text);
69
70         return $this->_sendMail($subject, $text);
71     }
72
73     protected function _cancel() {
74         $mapper = new Syj_Model_UserMapper();
75         $mapper->delete($this->_user);
76         return true;
77     }
78 }