Newer
Older
<?php
namespace SGalinski\SgMail\Example;
/***************************************************************
* Copyright notice
*
* (c) sgalinski Internet Services (https://www.sgalinski.de)
*
* All rights reserved
*
* This script is part of the TYPO3 project. The TYPO3 project is
* free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* The GNU General Public License can be found at
* http://www.gnu.org/copyleft/gpl.html.
*
* This script is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
use SGalinski\SgMail\Service\RegisterInterface;
/**
* Example Registration for a Template
*
* @package SGalinski\SgMail\Example
*/
class Register implements RegisterInterface {
/**
* @var array
*/
private $markers = [];
/**
* @var array
*/

Torsten Oppermann
committed
private $subject = [];
/**
* @var string
*/
private $description;
/**
* the extension key
*
* @var string
*/
private $extensionKey;
/**
* a unique name for this template
*
* @var string
*/
private $templateKey;
/**
* path where the template is located
*
* @var string
*/
private $templatePath;
/**
* initialize certain values
*/
public function init() {

Torsten Oppermann
committed
$templateArray = [

Torsten Oppermann
committed
'lastName' => 'Mustermann'
];
$this->markers = [
[
'marker' => 'firstname',
'type' => \SGalinski\SgMail\Service\MailTemplateService::MARKER_TYPE_STRING,
'value' => 'Max',
'description' => 'The first name of the customer'
],
[
'marker' => 'lastname',
'type' => \SGalinski\SgMail\Service\MailTemplateService::MARKER_TYPE_STRING,
'value' => 'Mustermann',
'description' => 'The last name of the customer'

Torsten Oppermann
committed
],
[
'marker' => 'person',
'type' => \SGalinski\SgMail\Service\MailTemplateService::MARKER_TYPE_ARRAY,
'value' => $templateArray,
'description' => 'An array with the customer data',

Torsten Oppermann
committed
'usage' => '{person.firstName}, {person.lastName}'
]
];
$this->description = 'Description about the Template';

Torsten Oppermann
committed
$this->subject = [
'en' => 'The english subject text',
'de' => 'The german subject text'
];
$this->templateKey = 'notice_mail_admin';
$this->extensionKey = 'sg_sample';
}
/**
* Calls MailTemplateService registerTemplate with according values.
*/
public function registerTemplate() {
\SGalinski\SgMail\Service\MailTemplateService::registerTemplate(

Torsten Oppermann
committed
$this->extensionKey, $this->templateKey, $this->templatePath, $this->description, $this->markers,
$this->subject
);
}
/**
* @return array
*/
public function getMarkers() {
return $this->markers;
}
/**
* @param array $markers
* @return RegisterInterface
*/
public function setMarkers(array $markers) {
$this->markers = $markers;
return $this;
}
/**
* @return array
*/

Torsten Oppermann
committed
public function getSubject() {
return $this->subject;

Torsten Oppermann
committed
* @param array $subject

Torsten Oppermann
committed
public function setSubject(array $subject) {
$this->subject = $subject;
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
return $this;
}
/**
* @return string
*/
public function getDescription() {
return $this->description;
}
/**
* @param string $description
* @return RegisterInterface
*/
public function setDescription($description) {
$this->description = $description;
return $this;
}
/**
* @return string
*/
public function getExtensionKey() {
return $this->extensionKey;
}
/**
* @param string $extensionKey
* @return RegisterInterface
*/
public function setExtensionKey($extensionKey) {
$this->extensionKey = $extensionKey;
return $this;
}
/**
* @return string
*/
public function getTemplateKey() {
return $this->templateKey;
}
/**
* @param string $templateKey
* @return RegisterInterface
*/
public function setTemplateKey($templateKey) {
$this->templateKey = $templateKey;
return $this;
}
/**
* @return string
*/
public function getTemplatePath() {
return $this->templatePath;
}
/**
* @param string $templatePath
* @return RegisterInterface
*/
public function setTemplatePath($templatePath) {
$this->templatePath = $templatePath;
return $this;
}
}
?>