-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathNotifier.php
More file actions
53 lines (46 loc) · 2.5 KB
/
Notifier.php
File metadata and controls
53 lines (46 loc) · 2.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<?php
/*************************************************************************************/
/* This file is part of the Notifier Module */
/* */
/* Copyright (c) Omnitic */
/* email : bonjour@omnitic.com */
/* web : http://www.omnitic.com */
/* */
/* For the full copyright and license information, please view the LICENSE.txt */
/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Notifier;
use Propel\Runtime\Connection\ConnectionInterface;
use Thelia\Model\Message;
use Thelia\Model\MessageQuery;
use Thelia\Module\BaseModule;
class Notifier extends BaseModule
{
const EMAIL_MESSAGE_NAME = 'customer_account_creation';
public function postActivation(ConnectionInterface $con = null)
{
if (null === MessageQuery::create()->findOneByName(self::EMAIL_MESSAGE_NAME)) {
$message = new Message();
$message
->setName(self::EMAIL_MESSAGE_NAME)
->setLocale('en_US')
->setTitle('Customer registration confirmation')
->setSubject("Your registration on {config key='store_name'} is confirmed")
->setHtmlMessage(file_get_contents(__DIR__ . DS . 'Config' . DS . 'email-contents.en.html'))
->setTextMessage(file_get_contents(__DIR__ . DS . 'Config' . DS . 'email-contents.en.txt'))
->setLocale('fr_FR')
->setTitle('Confirmation d\'inscription client')
->setSubject("Confirmation de votre inscription sur {config key='store_name'}")
->setHtmlMessage(file_get_contents(__DIR__ . DS . 'Config' . DS . 'email-contents.fr.html'))
->setTextMessage(file_get_contents(__DIR__ . DS . 'Config' . DS . 'email-contents.fr.txt'))
->save();
}
}
public function destroy(ConnectionInterface $con = null, $deleteModuleData = false)
{
// Delete message if required
if ($deleteModuleData) {
MessageQuery::create()->findOneByName(self::EMAIL_MESSAGE_NAME)->delete();
}
}
}