1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace XoopsModules\Modulebuilder\Files\Language; |
4
|
|
|
|
5
|
|
|
use XoopsModules\Modulebuilder; |
6
|
|
|
use XoopsModules\Modulebuilder\Files; |
7
|
|
|
|
8
|
|
|
/* |
9
|
|
|
You may not change or alter any portion of this comment or credits |
10
|
|
|
of supporting developers from this source code or any supporting source code |
11
|
|
|
which is considered copyrighted (c) material of the original comment or credit authors. |
12
|
|
|
|
13
|
|
|
This program is distributed in the hope that it will be useful, |
14
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of |
15
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
16
|
|
|
*/ |
17
|
|
|
/** |
18
|
|
|
* modulebuilder module. |
19
|
|
|
* |
20
|
|
|
* @copyright XOOPS Project (https://xoops.org) |
21
|
|
|
* @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) |
22
|
|
|
* |
23
|
|
|
* @since 2.5.0 |
24
|
|
|
* |
25
|
|
|
* @author Txmod Xoops http://www.txmodxoops.org |
26
|
|
|
* |
27
|
|
|
*/ |
28
|
|
|
|
29
|
|
|
/** |
30
|
|
|
* Class LanguageMailTpl. |
31
|
|
|
*/ |
32
|
|
|
class LanguageMailTpl extends Files\CreateFile |
33
|
|
|
{ |
34
|
|
|
/** |
35
|
|
|
* @public function constructor |
36
|
|
|
* @param null |
37
|
|
|
*/ |
38
|
|
|
public function __construct() |
39
|
|
|
{ |
40
|
|
|
parent::__construct(); |
41
|
|
|
} |
42
|
|
|
|
43
|
|
|
/** |
44
|
|
|
* @static function getInstance |
45
|
|
|
* @param null |
46
|
|
|
* @return LanguageMailTpl |
47
|
|
|
*/ |
48
|
|
|
public static function getInstance() |
49
|
|
|
{ |
50
|
|
|
static $instance = false; |
51
|
|
|
if (!$instance) { |
52
|
|
|
$instance = new self(); |
53
|
|
|
} |
54
|
|
|
|
55
|
|
|
return $instance; |
56
|
|
|
} |
57
|
|
|
|
58
|
|
|
/** |
59
|
|
|
* @public function write |
60
|
|
|
* |
61
|
|
|
* @param $module |
62
|
|
|
* @param $table |
63
|
|
|
* @param $filename |
64
|
|
|
*/ |
65
|
|
|
public function write($module, $table, $filename) |
66
|
|
|
{ |
67
|
|
|
$this->setModule($module); |
68
|
|
|
$this->setTable($table); |
69
|
|
|
$this->setFileName($filename); |
70
|
|
|
} |
71
|
|
|
|
72
|
|
|
/** |
73
|
|
|
* @public function getTemplateDummy |
74
|
|
|
* @param $tableSoleName |
75
|
|
|
* @param $line |
76
|
|
|
* @return string |
77
|
|
|
*/ |
78
|
|
|
public function getTemplateDummy($tableSoleName, $line) |
79
|
|
|
{ |
80
|
|
|
|
81
|
|
|
$ret = $this->getSimpleString('Hello {X_UNAME},'); |
82
|
|
|
$ret .= $this->getSimpleString(''); |
83
|
|
|
$ret .= $this->getSimpleString('A new ' . $tableSoleName . ' "{ITEM_NAME}" has been added at {X_SITENAME}.'); |
84
|
|
|
$ret .= $this->getSimpleString(''); |
85
|
|
|
$ret .= $this->getSimpleString('You can view this ' . $tableSoleName . ' here:'); |
86
|
|
|
$ret .= $this->getSimpleString('{ITEM_URL}'); |
87
|
|
|
$ret .= $this->getSimpleString(''); |
88
|
|
|
$ret .= $this->getSimpleString($line); |
89
|
|
|
$ret .= $this->getSimpleString(''); |
90
|
|
|
$ret .= $this->getSimpleString('You are receiving this message because you selected to be notified when a new ' . $tableSoleName . ' is added to our site.'); |
91
|
|
|
$ret .= $this->getSimpleString(''); |
92
|
|
|
|
93
|
|
|
return $ret; |
94
|
|
|
} |
95
|
|
|
|
96
|
|
|
/** |
97
|
|
|
* @public function getTemplateTableModify |
98
|
|
|
* @param $tableSoleName |
99
|
|
|
* @param $line |
100
|
|
|
* @return string |
101
|
|
|
*/ |
102
|
|
|
public function getTemplateTableModify($tableSoleName, $line) |
103
|
|
|
{ |
104
|
|
|
|
105
|
|
|
$ret = $this->getSimpleString('Hello {X_UNAME},'); |
106
|
|
|
$ret .= $this->getSimpleString(''); |
107
|
|
|
$ret .= $this->getSimpleString('The ' . $tableSoleName . ' "{ITEM_NAME}" has been modified at {X_SITENAME}.'); |
108
|
|
|
$ret .= $this->getSimpleString(''); |
109
|
|
|
$ret .= $this->getSimpleString('You can view this ' . $tableSoleName . ' here:'); |
110
|
|
|
$ret .= $this->getSimpleString('{ITEM_URL}'); |
111
|
|
|
$ret .= $this->getSimpleString(''); |
112
|
|
|
$ret .= $this->getSimpleString($line); |
113
|
|
|
$ret .= $this->getSimpleString(''); |
114
|
|
|
$ret .= $this->getSimpleString('You are receiving this message because you selected to be notified when a ' . $tableSoleName . ' is modified on our site.'); |
115
|
|
|
|
116
|
|
|
return $ret; |
117
|
|
|
} |
118
|
|
|
|
119
|
|
|
/** |
120
|
|
|
* @public function getTemplateTableDelete |
121
|
|
|
* @param $tableSoleName |
122
|
|
|
* @param $line |
123
|
|
|
* @return string |
124
|
|
|
*/ |
125
|
|
|
public function getTemplateTableDelete($tableSoleName, $line) |
126
|
|
|
{ |
127
|
|
|
|
128
|
|
|
$ret = $this->getSimpleString('Hello {X_UNAME},'); |
129
|
|
|
$ret .= $this->getSimpleString(''); |
130
|
|
|
$ret .= $this->getSimpleString('The ' . $tableSoleName . ' "{ITEM_NAME}" has been deleted from {X_SITENAME}.'); |
131
|
|
|
$ret .= $this->getSimpleString(''); |
132
|
|
|
$ret .= $this->getSimpleString($line); |
133
|
|
|
$ret .= $this->getSimpleString(''); |
134
|
|
|
$ret .= $this->getSimpleString('You are receiving this message because you selected to be notified when a ' . $tableSoleName . ' is deleted from our site.'); |
135
|
|
|
|
136
|
|
|
return $ret; |
137
|
|
|
} |
138
|
|
|
|
139
|
|
|
/** |
140
|
|
|
* @public function getTemplateTableApprove |
141
|
|
|
* @param $tableSoleName |
142
|
|
|
* @param $line |
143
|
|
|
* @return string |
144
|
|
|
*/ |
145
|
|
|
public function getTemplateTableApprove($tableSoleName, $line) |
146
|
|
|
{ |
147
|
|
|
|
148
|
|
|
$ret = $this->getSimpleString('Hello {X_UNAME},'); |
149
|
|
|
$ret .= $this->getSimpleString(''); |
150
|
|
|
$ret .= $this->getSimpleString('A new ' . $tableSoleName . ' "{ITEM_NAME}" is waiting for approval at {X_SITENAME}.'); |
151
|
|
|
$ret .= $this->getSimpleString(''); |
152
|
|
|
$ret .= $this->getSimpleString('You can view this ' . $tableSoleName . ' here:'); |
153
|
|
|
$ret .= $this->getSimpleString('{ITEM_URL}'); |
154
|
|
|
$ret .= $this->getSimpleString(''); |
155
|
|
|
$ret .= $this->getSimpleString($line); |
156
|
|
|
$ret .= $this->getSimpleString(''); |
157
|
|
|
$ret .= $this->getSimpleString('You are receiving this message because you selected to be notified when a ' . $tableSoleName . ' is waitung for approval on our site.'); |
158
|
|
|
|
159
|
|
|
return $ret; |
160
|
|
|
} |
161
|
|
|
|
162
|
|
|
/** |
163
|
|
|
* @public function getTemplateTableApprove |
164
|
|
|
* @param $tableSoleName |
165
|
|
|
* @param $line |
166
|
|
|
* @return string |
167
|
|
|
*/ |
168
|
|
|
public function getTemplateTableBroken($tableSoleName, $line) |
169
|
|
|
{ |
170
|
|
|
|
171
|
|
|
$ret = $this->getSimpleString('Hello {X_UNAME},'); |
172
|
|
|
$ret .= $this->getSimpleString(''); |
173
|
|
|
$ret .= $this->getSimpleString('The ' . $tableSoleName . ' "{ITEM_NAME}" has been notified as broken at {X_SITENAME}.'); |
174
|
|
|
$ret .= $this->getSimpleString(''); |
175
|
|
|
$ret .= $this->getSimpleString('You can view this ' . $tableSoleName . ' here:'); |
176
|
|
|
$ret .= $this->getSimpleString('{ITEM_URL}'); |
177
|
|
|
$ret .= $this->getSimpleString(''); |
178
|
|
|
$ret .= $this->getSimpleString($line); |
179
|
|
|
$ret .= $this->getSimpleString(''); |
180
|
|
|
$ret .= $this->getSimpleString('You are receiving this message because you selected to be notified when a ' . $tableSoleName . ' is notified as broken on our site.'); |
181
|
|
|
|
182
|
|
|
return $ret; |
183
|
|
|
} |
184
|
|
|
|
185
|
|
|
/** |
186
|
|
|
* @public function getTemplateTableComment |
187
|
|
|
* @param $tableSoleName |
188
|
|
|
* @param $line |
189
|
|
|
* @return string |
190
|
|
|
*/ |
191
|
|
|
public function getTemplateTableComment($tableSoleName, $line) |
192
|
|
|
{ |
193
|
|
|
|
194
|
|
|
$ret = $this->getSimpleString('Hello {X_UNAME},'); |
195
|
|
|
$ret .= $this->getSimpleString(''); |
196
|
|
|
$ret .= $this->getSimpleString('A comment was published for ' . $tableSoleName . ' "{ITEM_NAME}" at {X_SITENAME}.'); |
197
|
|
|
$ret .= $this->getSimpleString(''); |
198
|
|
|
$ret .= $this->getSimpleString('You can view this comment here:'); |
199
|
|
|
$ret .= $this->getSimpleString('{ITEM_URL}'); |
200
|
|
|
$ret .= $this->getSimpleString(''); |
201
|
|
|
$ret .= $this->getSimpleString($line); |
202
|
|
|
$ret .= $this->getSimpleString(''); |
203
|
|
|
$ret .= $this->getSimpleString('You are receiving this message because you selected to be notified when a ' . $tableSoleName . ' is modified on our site.'); |
204
|
|
|
|
205
|
|
|
return $ret; |
206
|
|
|
} |
207
|
|
|
|
208
|
|
|
/** |
209
|
|
|
* @public function getTemplateGlobalNew |
210
|
|
|
* @param $line |
211
|
|
|
* @return string |
212
|
|
|
*/ |
213
|
|
|
public function getTemplateGlobalNew($line) |
214
|
|
|
{ |
215
|
|
|
|
216
|
|
|
$ret = $this->getSimpleString('Hello {X_UNAME},'); |
217
|
|
|
$ret .= $this->getSimpleString(''); |
218
|
|
|
$ret .= $this->getSimpleString('A new item "{ITEM_NAME}" has been added at {X_SITENAME}.'); |
219
|
|
|
$ret .= $this->getSimpleString(''); |
220
|
|
|
$ret .= $this->getSimpleString('You can view this item here:'); |
221
|
|
|
$ret .= $this->getSimpleString('{ITEM_URL}'); |
222
|
|
|
$ret .= $this->getSimpleString(''); |
223
|
|
|
$ret .= $this->getSimpleString($line); |
224
|
|
|
$ret .= $this->getSimpleString(''); |
225
|
|
|
$ret .= $this->getSimpleString('You are receiving this message because you selected to be notified when a new item is added to our site.'); |
226
|
|
|
|
227
|
|
|
return $ret; |
228
|
|
|
} |
229
|
|
|
|
230
|
|
|
/** |
231
|
|
|
* @public function getTemplateGlobalModify |
232
|
|
|
* @param $line |
233
|
|
|
* @return string |
234
|
|
|
*/ |
235
|
|
|
public function getTemplateGlobalModify($line) |
236
|
|
|
{ |
237
|
|
|
|
238
|
|
|
$ret = $this->getSimpleString('Hello {X_UNAME},'); |
239
|
|
|
$ret .= $this->getSimpleString(''); |
240
|
|
|
$ret .= $this->getSimpleString('The item "{ITEM_NAME}" has been modified at {X_SITENAME}.'); |
241
|
|
|
$ret .= $this->getSimpleString(''); |
242
|
|
|
$ret .= $this->getSimpleString('You can view this item here:'); |
243
|
|
|
$ret .= $this->getSimpleString('{ITEM_URL}'); |
244
|
|
|
$ret .= $this->getSimpleString(''); |
245
|
|
|
$ret .= $this->getSimpleString($line); |
246
|
|
|
$ret .= $this->getSimpleString(''); |
247
|
|
|
$ret .= $this->getSimpleString('You are receiving this message because you selected to be notified when an item is modified on our site.'); |
248
|
|
|
|
249
|
|
|
return $ret; |
250
|
|
|
} |
251
|
|
|
|
252
|
|
|
/** |
253
|
|
|
* @public function getTemplateGlobalDelete |
254
|
|
|
* @param $line |
255
|
|
|
* @return string |
256
|
|
|
*/ |
257
|
|
|
public function getTemplateGlobalDelete($line) |
258
|
|
|
{ |
259
|
|
|
|
260
|
|
|
$ret = $this->getSimpleString('Hello {X_UNAME},'); |
261
|
|
|
$ret .= $this->getSimpleString(''); |
262
|
|
|
$ret .= $this->getSimpleString('The item "{ITEM_NAME}" has been deleted from {X_SITENAME}.'); |
263
|
|
|
$ret .= $this->getSimpleString(''); |
264
|
|
|
$ret .= $this->getSimpleString($line); |
265
|
|
|
$ret .= $this->getSimpleString(''); |
266
|
|
|
$ret .= $this->getSimpleString('You are receiving this message because you selected to be notified when an item is deleted from our site.'); |
267
|
|
|
|
268
|
|
|
return $ret; |
269
|
|
|
} |
270
|
|
|
|
271
|
|
|
/** |
272
|
|
|
* @public function getTemplateGlobalApprove |
273
|
|
|
* @param $line |
274
|
|
|
* @return string |
275
|
|
|
*/ |
276
|
|
|
public function getTemplateGlobalApprove($line) |
277
|
|
|
{ |
278
|
|
|
|
279
|
|
|
$ret = $this->getSimpleString('Hello {X_UNAME},'); |
280
|
|
|
$ret .= $this->getSimpleString(''); |
281
|
|
|
$ret .= $this->getSimpleString('The item "{ITEM_NAME}" is waiting for approval at {X_SITENAME}.'); |
282
|
|
|
$ret .= $this->getSimpleString(''); |
283
|
|
|
$ret .= $this->getSimpleString('You can view this item here:'); |
284
|
|
|
$ret .= $this->getSimpleString('{ITEM_URL}'); |
285
|
|
|
$ret .= $this->getSimpleString(''); |
286
|
|
|
$ret .= $this->getSimpleString($line); |
287
|
|
|
$ret .= $this->getSimpleString(''); |
288
|
|
|
$ret .= $this->getSimpleString('You are receiving this message because you selected to be notified when an item is waitung for approval on our site.'); |
289
|
|
|
|
290
|
|
|
return $ret; |
291
|
|
|
} |
292
|
|
|
|
293
|
|
|
/** |
294
|
|
|
* @public function getTemplateGlobalBroken |
295
|
|
|
* @param $line |
296
|
|
|
* @return string |
297
|
|
|
*/ |
298
|
|
|
public function getTemplateGlobalBroken($line) |
299
|
|
|
{ |
300
|
|
|
|
301
|
|
|
$ret = $this->getSimpleString('Hello {X_UNAME},'); |
302
|
|
|
$ret .= $this->getSimpleString(''); |
303
|
|
|
$ret .= $this->getSimpleString('The item "{ITEM_NAME}" has been notified as broken at {X_SITENAME}.'); |
304
|
|
|
$ret .= $this->getSimpleString(''); |
305
|
|
|
$ret .= $this->getSimpleString('You can view this item here:'); |
306
|
|
|
$ret .= $this->getSimpleString('{ITEM_URL}'); |
307
|
|
|
$ret .= $this->getSimpleString(''); |
308
|
|
|
$ret .= $this->getSimpleString($line); |
309
|
|
|
$ret .= $this->getSimpleString(''); |
310
|
|
|
$ret .= $this->getSimpleString('You are receiving this message because you selected to be notified when an item is notified as broken on our site.'); |
311
|
|
|
|
312
|
|
|
return $ret; |
313
|
|
|
} |
314
|
|
|
|
315
|
|
|
/** |
316
|
|
|
* @public function getTemplateGlobalNew |
317
|
|
|
* @param $line |
318
|
|
|
* @return string |
319
|
|
|
*/ |
320
|
|
|
public function getTemplateGlobalComment($line) |
321
|
|
|
{ |
322
|
|
|
|
323
|
|
|
$ret = $this->getSimpleString('Hello {X_UNAME},'); |
324
|
|
|
$ret .= $this->getSimpleString(''); |
325
|
|
|
$ret .= $this->getSimpleString('A new comment has been added to "{ITEM_NAME}" at {X_SITENAME}.'); |
326
|
|
|
$ret .= $this->getSimpleString(''); |
327
|
|
|
$ret .= $this->getSimpleString('You can view this comment here:'); |
328
|
|
|
$ret .= $this->getSimpleString('{ITEM_URL}'); |
329
|
|
|
$ret .= $this->getSimpleString(''); |
330
|
|
|
$ret .= $this->getSimpleString($line); |
331
|
|
|
$ret .= $this->getSimpleString(''); |
332
|
|
|
$ret .= $this->getSimpleString('You are receiving this message because you selected to be notified when a new comment is added to an item of our site.'); |
333
|
|
|
|
334
|
|
|
return $ret; |
335
|
|
|
} |
336
|
|
|
|
337
|
|
|
/** |
338
|
|
|
* @public function getTemplateTableApprove |
339
|
|
|
* @param $line |
340
|
|
|
* @return string |
341
|
|
|
*/ |
342
|
|
|
public function getTemplateTableFooter($line) |
343
|
|
|
{ |
344
|
|
|
|
345
|
|
|
$ret = $this->getSimpleString(''); |
346
|
|
|
$ret .= $this->getSimpleString('If this is an error or you wish not to receive further such notifications, please update your subscriptions by visiting the link below:'); |
347
|
|
|
$ret .= $this->getSimpleString('{X_UNSUBSCRIBE_URL}'); |
348
|
|
|
$ret .= $this->getSimpleString(''); |
349
|
|
|
$ret .= $this->getSimpleString('Please do not reply to this message.'); |
350
|
|
|
$ret .= $this->getSimpleString(''); |
351
|
|
|
$ret .= $this->getSimpleString($line); |
352
|
|
|
$ret .= $this->getSimpleString(''); |
353
|
|
|
$ret .= $this->getSimpleString('{X_SITENAME} ({X_SITEURL})'); |
354
|
|
|
$ret .= $this->getSimpleString('webmaster'); |
355
|
|
|
$ret .= $this->getSimpleString('{X_ADMINMAIL}'); |
356
|
|
|
$ret .= $this->getSimpleString(''); |
357
|
|
|
$ret .= $this->getSimpleString($line); |
358
|
|
|
|
359
|
|
|
return $ret; |
360
|
|
|
} |
361
|
|
|
|
362
|
|
|
|
363
|
|
|
/** |
364
|
|
|
* @public function renderFile |
365
|
|
|
* @return bool|string |
366
|
|
|
*/ |
367
|
|
|
public function render() |
368
|
|
|
{ |
369
|
|
|
$module = $this->getModule(); |
370
|
|
|
$filename = $this->getFileName(); |
371
|
|
|
$table = $this->getTable(); |
372
|
|
|
$moduleDirname = $module->getVar('mod_dirname'); |
373
|
|
|
$tableSoleName = $table->getVar('table_solename'); |
374
|
|
|
//$stuTableSoleName = mb_strtoupper($tableSoleName); |
375
|
|
|
$fieldMain = ''; |
|
|
|
|
376
|
|
|
$fields = $this->getTableFields($table->getVar('table_mid'), $table->getVar('table_id')); |
377
|
|
|
foreach (array_keys($fields) as $f) { |
378
|
|
|
$fieldName = $fields[$f]->getVar('field_name'); |
379
|
|
|
if (1 == $fields[$f]->getVar('field_main')) { |
380
|
|
|
$fieldMain = $fieldName; // fieldMain = fields parameters main field |
381
|
|
|
} |
382
|
|
|
} |
383
|
|
|
//$stuFieldMain = mb_strtoupper($fieldMain); |
384
|
|
|
|
385
|
|
|
$line = '------------------------------------------------------------------'; |
386
|
|
|
$content = ''; |
387
|
|
|
switch ($filename) { |
388
|
|
|
case 'category_new_notify.tpl': |
389
|
|
|
//$content .= $this->getTemplateCategoryNew('categories', 'CATEGORY', 'CATEGORY', $line); |
390
|
|
|
//break; |
391
|
|
|
case 'default': |
392
|
|
|
default: |
393
|
|
|
$content .= $this->getTemplateDummy($tableSoleName, $line); |
394
|
|
|
break; |
395
|
|
|
case 'global_new_notify.tpl': |
396
|
|
|
$content .= $this->getTemplateGlobalNew($line); |
397
|
|
|
break; |
398
|
|
|
case'global_modify_notify.tpl': |
399
|
|
|
$content .= $this->getTemplateGlobalModify($line); |
400
|
|
|
break; |
401
|
|
|
case 'global_delete_notify.tpl': |
402
|
|
|
$content .= $this->getTemplateGlobalDelete($line); |
403
|
|
|
break; |
404
|
|
|
case 'global_approve_notify.tpl': |
405
|
|
|
$content .= $this->getTemplateGlobalApprove($line); |
406
|
|
|
break; |
407
|
|
|
case 'global_broken_notify.tpl': |
408
|
|
|
$content .= $this->getTemplateGlobalBroken($line); |
409
|
|
|
break; |
410
|
|
|
case 'global_comment_notify.tpl': |
411
|
|
|
$content .= $this->getTemplateGlobalComment($line); |
412
|
|
|
break; |
413
|
|
|
case $tableSoleName . '_modify_notify.tpl': |
414
|
|
|
$content .= $this->getTemplateTableModify($tableSoleName, $line); |
415
|
|
|
break; |
416
|
|
|
case $tableSoleName . '_delete_notify.tpl': |
417
|
|
|
$content .= $this->getTemplateTableDelete($tableSoleName, $line); |
418
|
|
|
break; |
419
|
|
|
case $tableSoleName . '_approve_notify.tpl': |
420
|
|
|
$content .= $this->getTemplateTableApprove($tableSoleName, $line); |
421
|
|
|
break; |
422
|
|
|
case $tableSoleName . '_broken_notify.tpl': |
423
|
|
|
$content .= $this->getTemplateTableBroken($tableSoleName, $line); |
424
|
|
|
break; |
425
|
|
|
case $tableSoleName . '_comment_notify.tpl': |
426
|
|
|
$content .= $this->getTemplateTableComment($tableSoleName, $line); |
427
|
|
|
break; |
428
|
|
|
} |
429
|
|
|
$content .= $this->getTemplateTableFooter($line); |
430
|
|
|
|
431
|
|
|
$this->create($moduleDirname, 'language/' . $GLOBALS['xoopsConfig']['language'] . '/mail_template', $filename, $content, _AM_MODULEBUILDER_FILE_CREATED, _AM_MODULEBUILDER_FILE_NOTCREATED); |
432
|
|
|
|
433
|
|
|
return $this->renderFile(); |
434
|
|
|
} |
435
|
|
|
} |
436
|
|
|
|