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 (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html) |
22
|
|
|
* |
23
|
|
|
* @since 2.5.0 |
24
|
|
|
* |
25
|
|
|
* @author Txmod Xoops https://xoops.org |
26
|
|
|
* Goffy https://myxoops.org |
27
|
|
|
* |
28
|
|
|
*/ |
29
|
|
|
|
30
|
|
|
/** |
31
|
|
|
* Class LanguageModinfo. |
32
|
|
|
*/ |
33
|
|
|
class LanguageModinfo extends Files\CreateFile |
34
|
|
|
{ |
35
|
|
|
/** |
36
|
|
|
* @var mixed |
37
|
|
|
*/ |
38
|
|
|
private $ld = null; |
39
|
|
|
|
40
|
|
|
/** |
41
|
|
|
* @var mixed |
42
|
|
|
*/ |
43
|
|
|
private $pc = null; |
44
|
|
|
|
45
|
|
|
/** |
46
|
|
|
* @public function constructor |
47
|
|
|
* @param null |
48
|
|
|
*/ |
49
|
|
|
public function __construct() |
50
|
|
|
{ |
51
|
|
|
parent::__construct(); |
52
|
|
|
$this->ld = LanguageDefines::getInstance(); |
53
|
|
|
$this->pc = Modulebuilder\Files\CreatePhpCode::getInstance(); |
54
|
|
|
} |
55
|
|
|
|
56
|
|
|
/** |
57
|
|
|
* @static function getInstance |
58
|
|
|
* @param null |
59
|
|
|
* @return LanguageModinfo |
60
|
|
|
*/ |
61
|
|
|
public static function getInstance() |
62
|
|
|
{ |
63
|
|
|
static $instance = false; |
64
|
|
|
if (!$instance) { |
65
|
|
|
$instance = new self(); |
66
|
|
|
} |
67
|
|
|
|
68
|
|
|
return $instance; |
69
|
|
|
} |
70
|
|
|
|
71
|
|
|
/** |
72
|
|
|
* @public function write |
73
|
|
|
* |
74
|
|
|
* @param $module |
75
|
|
|
* @param $table |
76
|
|
|
* @param $filename |
77
|
|
|
* |
78
|
|
|
* @return null |
79
|
|
|
*/ |
80
|
|
|
public function write($module, $table, $filename) |
81
|
|
|
{ |
82
|
|
|
$this->setModule($module); |
83
|
|
|
$this->setTable($table); |
84
|
|
|
$this->setFileName($filename); |
85
|
|
|
|
86
|
|
|
return null; |
87
|
|
|
} |
88
|
|
|
|
89
|
|
|
/** |
90
|
|
|
* @private function getLanguageMain |
91
|
|
|
* |
92
|
|
|
* @param $language |
93
|
|
|
* @param $module |
94
|
|
|
* |
95
|
|
|
* @return string |
96
|
|
|
*/ |
97
|
|
|
private function getLanguageMain($language, $module) |
98
|
|
|
{ |
99
|
|
|
$ret = $this->ld->getBlankLine(); |
100
|
|
|
$ret .= $this->pc->getPhpCodeIncludeDir('__DIR__','common', true); |
101
|
|
|
$ret .= $this->ld->getBlankLine(); |
102
|
|
|
$ret .= $this->ld->getAboveHeadDefines('Admin Main'); |
103
|
|
|
$ret .= $this->ld->getDefine($language, 'NAME', (string)$module->getVar('mod_name')); |
104
|
|
|
$ret .= $this->ld->getDefine($language, 'DESC', (string)$module->getVar('mod_description')); |
105
|
|
|
|
106
|
|
|
return $ret; |
107
|
|
|
} |
108
|
|
|
|
109
|
|
|
/** |
110
|
|
|
* @private function getLanguageMenu |
111
|
|
|
* |
112
|
|
|
* @param $module |
113
|
|
|
* @param $language |
114
|
|
|
* |
115
|
|
|
* @return string |
116
|
|
|
*/ |
117
|
|
|
private function getLanguageMenu($module, $language) |
118
|
|
|
{ |
119
|
|
|
$tables = $this->getTableTables($module->getVar('mod_id'), 'table_order'); |
120
|
|
|
$menu = 1; |
121
|
|
|
$ret = $this->ld->getAboveHeadDefines('Admin Menu'); |
122
|
|
|
$ret .= $this->ld->getDefine($language, "ADMENU{$menu}", 'Dashboard'); |
123
|
|
|
$tablePermissions = []; |
124
|
|
|
$tableBroken = []; |
125
|
|
|
foreach (\array_keys($tables) as $i) { |
126
|
|
|
++$menu; |
127
|
|
|
$tablePermissions[] = $tables[$i]->getVar('table_permissions'); |
128
|
|
|
$tableBroken[] = $tables[$i]->getVar('table_broken'); |
129
|
|
|
$ucfTableName = \ucfirst($tables[$i]->getVar('table_name')); |
130
|
|
|
$ret .= $this->ld->getDefine($language, "ADMENU{$menu}", $ucfTableName); |
131
|
|
|
} |
132
|
|
|
if (\in_array(1, $tableBroken)) { |
133
|
|
|
++$menu; |
134
|
|
|
$ret .= $this->ld->getDefine($language, "ADMENU{$menu}", 'Broken items'); |
135
|
|
|
} |
136
|
|
|
if (\in_array(1, $tablePermissions)) { |
137
|
|
|
++$menu; |
138
|
|
|
$ret .= $this->ld->getDefine($language, "ADMENU{$menu}", 'Permissions'); |
139
|
|
|
} |
140
|
|
|
++$menu; |
141
|
|
|
$ret .= $this->ld->getDefine($language, "ADMENU{$menu}", 'Clone'); |
142
|
|
|
++$menu; |
143
|
|
|
$ret .= $this->ld->getDefine($language, "ADMENU{$menu}", 'Feedback'); |
144
|
|
|
$ret .= $this->ld->getDefine($language, 'ABOUT', 'About'); |
145
|
|
|
unset($menu, $tablePermissions); |
146
|
|
|
|
147
|
|
|
return $ret; |
148
|
|
|
} |
149
|
|
|
|
150
|
|
|
/** |
151
|
|
|
* @private function getLanguageAdmin |
152
|
|
|
* @param $language |
153
|
|
|
* |
154
|
|
|
* @return string |
155
|
|
|
*/ |
156
|
|
|
private function getLanguageAdmin($language) |
157
|
|
|
{ |
158
|
|
|
$ret = $this->ld->getAboveHeadDefines('Admin Nav'); |
159
|
|
|
$ret .= $this->ld->getDefine($language, 'ADMIN_PAGER', 'Admin pager'); |
160
|
|
|
$ret .= $this->ld->getDefine($language, 'ADMIN_PAGER_DESC', 'Admin per page list'); |
161
|
|
|
|
162
|
|
|
return $ret; |
163
|
|
|
} |
164
|
|
|
|
165
|
|
|
/** |
166
|
|
|
* @private function getLanguageSubmenu |
167
|
|
|
* @param $language |
168
|
|
|
* @param array $tables |
169
|
|
|
* |
170
|
|
|
* @return string |
171
|
|
|
*/ |
172
|
|
|
private function getLanguageSubmenu($language, $tables) |
173
|
|
|
{ |
174
|
|
|
$ret = $this->ld->getAboveDefines('Submenu'); |
175
|
|
|
$ret .= $this->ld->getDefine($language, 'SMNAME1', 'Index page'); |
176
|
|
|
$i = 2; |
177
|
|
|
$tableSubmit = []; |
178
|
|
|
$tableSearch = []; |
179
|
|
|
foreach (\array_keys($tables) as $t) { |
180
|
|
|
$tableName = $tables[$t]->getVar('table_name'); |
181
|
|
|
$tableSearch[] = $tables[$t]->getVar('table_search'); |
182
|
|
|
$ucfTablename = \ucfirst(\mb_strtolower($tableName)); |
183
|
|
|
if (1 == $tables[$t]->getVar('table_submenu')) { |
184
|
|
|
$ret .= $this->ld->getDefine($language, "SMNAME{$i}", $ucfTablename); |
185
|
|
|
} |
186
|
|
|
++$i; |
187
|
|
|
if (1 == $tables[$t]->getVar('table_submit')) { |
188
|
|
|
$ret .= $this->ld->getDefine($language, "SMNAME{$i}", 'Submit ' . $ucfTablename); |
189
|
|
|
++$i; |
190
|
|
|
} |
191
|
|
|
} |
192
|
|
|
|
193
|
|
|
if (\in_array(1, $tableSearch)) { |
194
|
|
|
$ret .= $this->ld->getDefine($language, "SMNAME{$i}", 'Search'); |
195
|
|
|
} |
196
|
|
|
unset($i, $tableSubmit); |
197
|
|
|
|
198
|
|
|
return $ret; |
199
|
|
|
} |
200
|
|
|
|
201
|
|
|
/** |
202
|
|
|
* @private function getLanguageBlocks |
203
|
|
|
* @param $language |
204
|
|
|
* @param array $tables |
205
|
|
|
* |
206
|
|
|
* @return string |
207
|
|
|
*/ |
208
|
|
|
private function getLanguageBlocks($tables, $language) |
209
|
|
|
{ |
210
|
|
|
$ret = $this->ld->getAboveDefines('Blocks'); |
211
|
|
|
foreach (\array_keys($tables) as $i) { |
212
|
|
|
if (1 == $tables[$i]->getVar('table_blocks')) { |
213
|
|
|
$tableName = $tables[$i]->getVar('table_name'); |
214
|
|
|
$stuTableName = \mb_strtoupper($tableName); |
215
|
|
|
$tableSoleName = $tables[$i]->getVar('table_solename'); |
216
|
|
|
$stuTableSoleName = \mb_strtoupper($tableSoleName); |
217
|
|
|
$ucfTableName = \ucfirst($tableName); |
218
|
|
|
$ucfTableSoleName = \ucfirst($stuTableSoleName); |
219
|
|
|
$ret .= $this->ld->getDefine($language, "{$stuTableName}_BLOCK", "{$ucfTableName} block"); |
220
|
|
|
$ret .= $this->ld->getDefine($language, "{$stuTableName}_BLOCK_DESC", "{$ucfTableName} block description"); |
221
|
|
|
if (1 == $tables[$i]->getVar('table_category')) { |
222
|
|
|
$ret .= $this->ld->getDefine($language, "{$stuTableName}_BLOCK_{$stuTableSoleName}", "{$ucfTableName} block {$ucfTableSoleName}"); |
223
|
|
|
$ret .= $this->ld->getDefine($language, "{$stuTableName}_BLOCK_{$stuTableSoleName}_DESC", "{$ucfTableName} block {$ucfTableSoleName} description"); |
224
|
|
|
} else { |
225
|
|
|
$ret .= $this->ld->getDefine($language, "{$stuTableName}_BLOCK_{$stuTableSoleName}", "{$ucfTableName} block {$ucfTableSoleName}"); |
226
|
|
|
$ret .= $this->ld->getDefine($language, "{$stuTableName}_BLOCK_{$stuTableSoleName}_DESC", "{$ucfTableName} block {$ucfTableSoleName} description"); |
227
|
|
|
$ret .= $this->ld->getDefine($language, "{$stuTableName}_BLOCK_LAST", "{$ucfTableName} block last"); |
228
|
|
|
$ret .= $this->ld->getDefine($language, "{$stuTableName}_BLOCK_LAST_DESC", "{$ucfTableName} block last description"); |
229
|
|
|
$ret .= $this->ld->getDefine($language, "{$stuTableName}_BLOCK_NEW", "{$ucfTableName} block new"); |
230
|
|
|
$ret .= $this->ld->getDefine($language, "{$stuTableName}_BLOCK_NEW_DESC", "{$ucfTableName} block new description"); |
231
|
|
|
$ret .= $this->ld->getDefine($language, "{$stuTableName}_BLOCK_HITS", "{$ucfTableName} block hits"); |
232
|
|
|
$ret .= $this->ld->getDefine($language, "{$stuTableName}_BLOCK_HITS_DESC", "{$ucfTableName} block hits description"); |
233
|
|
|
$ret .= $this->ld->getDefine($language, "{$stuTableName}_BLOCK_TOP", "{$ucfTableName} block top"); |
234
|
|
|
$ret .= $this->ld->getDefine($language, "{$stuTableName}_BLOCK_TOP_DESC", "{$ucfTableName} block top description"); |
235
|
|
|
$ret .= $this->ld->getDefine($language, "{$stuTableName}_BLOCK_RANDOM", "{$ucfTableName} block random"); |
236
|
|
|
$ret .= $this->ld->getDefine($language, "{$stuTableName}_BLOCK_RANDOM_DESC", "{$ucfTableName} block random description"); |
237
|
|
|
$ret .= $this->ld->getDefine($language, "{$stuTableName}_BLOCK_SPOTLIGHT", "{$ucfTableName} block spotlight"); |
238
|
|
|
$ret .= $this->ld->getDefine($language, "{$stuTableName}_BLOCK_SPOTLIGHT_DESC", "{$ucfTableName} block spotlight description"); |
239
|
|
|
} |
240
|
|
|
} |
241
|
|
|
} |
242
|
|
|
|
243
|
|
|
return $ret; |
244
|
|
|
} |
245
|
|
|
|
246
|
|
|
/** |
247
|
|
|
* @private function getLanguageUser |
248
|
|
|
* @param $language |
249
|
|
|
* |
250
|
|
|
* @return string |
251
|
|
|
*/ |
252
|
|
|
private function getLanguageUser($language) |
253
|
|
|
{ |
254
|
|
|
$ret = $this->ld->getAboveDefines('User'); |
255
|
|
|
$ret .= $this->ld->getDefine($language, 'USER_PAGER', 'User pager'); |
256
|
|
|
$ret .= $this->ld->getDefine($language, 'USER_PAGER_DESC', 'User per page list'); |
257
|
|
|
|
258
|
|
|
return $ret; |
259
|
|
|
} |
260
|
|
|
|
261
|
|
|
/** |
262
|
|
|
* @private function getLanguageConfig |
263
|
|
|
* @param $language |
264
|
|
|
* @param $tables |
265
|
|
|
* |
266
|
|
|
* @return string |
267
|
|
|
*/ |
268
|
|
|
private function getLanguageConfig($language, $tables) |
269
|
|
|
{ |
270
|
|
|
$ret = $this->ld->getAboveDefines('Config'); |
271
|
|
|
$fieldImage = false; |
272
|
|
|
$fieldFile = false; |
273
|
|
|
$useTag = false; |
274
|
|
|
$fieldEditor = false; |
275
|
|
|
// $usePermissions = false; |
276
|
|
|
foreach (\array_keys($tables) as $i) { |
277
|
|
|
$fields = $this->getTableFields($tables[$i]->getVar('table_mid'), $tables[$i]->getVar('table_id')); |
278
|
|
|
foreach (\array_keys($fields) as $f) { |
279
|
|
|
$fieldElement = $fields[$f]->getVar('field_element'); |
280
|
|
|
if (3 == $fieldElement) { |
281
|
|
|
$fieldEditor = true; |
282
|
|
|
} |
283
|
|
|
if (4 == $fieldElement) { |
284
|
|
|
$fieldEditor = true; |
285
|
|
|
} |
286
|
|
|
if (10 == $fieldElement) { |
287
|
|
|
$fieldImage = true; |
288
|
|
|
} |
289
|
|
|
if (13 == $fieldElement) { |
290
|
|
|
$fieldImage = true; |
291
|
|
|
} |
292
|
|
|
if (14 == $fieldElement) { |
293
|
|
|
$fieldFile = true; |
294
|
|
|
} |
295
|
|
|
} |
296
|
|
|
if (0 != $tables[$i]->getVar('table_tag')) { |
297
|
|
|
$useTag = true; |
298
|
|
|
} |
299
|
|
|
} |
300
|
|
|
if ($fieldEditor) { |
301
|
|
|
$ret .= $this->ld->getDefine($language, 'EDITOR_ADMIN', 'Editor admin'); |
302
|
|
|
$ret .= $this->ld->getDefine($language, 'EDITOR_ADMIN_DESC', 'Select the editor which should be used in admin area for text area fields'); |
303
|
|
|
$ret .= $this->ld->getDefine($language, 'EDITOR_USER', 'Editor user'); |
304
|
|
|
$ret .= $this->ld->getDefine($language, 'EDITOR_USER_DESC', 'Select the editor which should be used in user area for text area fields'); |
305
|
|
|
$ret .= $this->ld->getDefine($language, 'EDITOR_MAXCHAR', 'Text max characters'); |
306
|
|
|
$ret .= $this->ld->getDefine($language, 'EDITOR_MAXCHAR_DESC', 'Max characters for showing text of a textarea or editor field in admin area'); |
307
|
|
|
} |
308
|
|
|
$ret .= $this->ld->getDefine($language, 'KEYWORDS', 'Keywords'); |
309
|
|
|
$ret .= $this->ld->getDefine($language, 'KEYWORDS_DESC', 'Insert here the keywords (separate by comma)'); |
310
|
|
|
|
311
|
|
|
if ($fieldImage || $fieldFile) { |
312
|
|
|
$ret .= $this->ld->getDefine($language, 'SIZE_MB', 'MB'); |
313
|
|
|
} |
314
|
|
|
if ($fieldImage) { |
315
|
|
|
$ret .= $this->ld->getDefine($language, 'MAXSIZE_IMAGE', 'Max size image'); |
316
|
|
|
$ret .= $this->ld->getDefine($language, 'MAXSIZE_IMAGE_DESC', 'Define the max size for uploading images'); |
317
|
|
|
$ret .= $this->ld->getDefine($language, 'MIMETYPES_IMAGE', 'Mime types image'); |
318
|
|
|
$ret .= $this->ld->getDefine($language, 'MIMETYPES_IMAGE_DESC', 'Define the allowed mime types for uploading images'); |
319
|
|
|
$ret .= $this->ld->getDefine($language, 'MAXWIDTH_IMAGE', 'Max width image'); |
320
|
|
|
$ret .= $this->ld->getDefine($language, 'MAXWIDTH_IMAGE_DESC', 'Set the max width to which uploaded images should be scaled (in pixel)<br>0 means, that images keeps the original size. <br>If an image is smaller than maximum value then the image will be not enlarge, it will be save in original width.'); |
321
|
|
|
$ret .= $this->ld->getDefine($language, 'MAXHEIGHT_IMAGE', 'Max height image'); |
322
|
|
|
$ret .= $this->ld->getDefine($language, 'MAXHEIGHT_IMAGE_DESC', 'Set the max height to which uploaded images should be scaled (in pixel)<br>0 means, that images keeps the original size. <br>If an image is smaller than maximum value then the image will be not enlarge, it will be save in original height'); |
323
|
|
|
} |
324
|
|
|
if ($fieldFile) { |
325
|
|
|
$ret .= $this->ld->getDefine($language, 'MAXSIZE_FILE', 'Max size file'); |
326
|
|
|
$ret .= $this->ld->getDefine($language, 'MAXSIZE_FILE_DESC', 'Define the max size for uploading files'); |
327
|
|
|
$ret .= $this->ld->getDefine($language, 'MIMETYPES_FILE', 'Mime types file'); |
328
|
|
|
$ret .= $this->ld->getDefine($language, 'MIMETYPES_FILE_DESC', 'Define the allowed mime types for uploading files'); |
329
|
|
|
} |
330
|
|
|
if ($useTag) { |
331
|
|
|
$ret .= $this->ld->getDefine($language, 'USE_TAG', 'Use TAG'); |
332
|
|
|
$ret .= $this->ld->getDefine($language, 'USE_TAG_DESC', 'If you use tag module, check this option to yes'); |
333
|
|
|
} |
334
|
|
|
$getDefinesConf = [ |
335
|
|
|
'NUMB_COL' => 'Number Columns', |
336
|
|
|
'NUMB_COL_DESC' => 'Number Columns to View', |
337
|
|
|
'DIVIDEBY' => 'Divide By', |
338
|
|
|
'DIVIDEBY_DESC' => 'Divide by columns number', |
339
|
|
|
'TABLE_TYPE' => 'Table Type', |
340
|
|
|
'TABLE_TYPE_DESC' => 'Table Type is the bootstrap html table', |
341
|
|
|
'PANEL_TYPE' => 'Panel Type', |
342
|
|
|
'PANEL_TYPE_DESC' => 'Panel Type is the bootstrap html div', |
343
|
|
|
'IDPAYPAL' => 'Paypal ID', |
344
|
|
|
'IDPAYPAL_DESC' => 'Insert here your PayPal ID for donations', |
345
|
|
|
'SHOW_BREADCRUMBS' => 'Show breadcrumb navigation', |
346
|
|
|
'SHOW_BREADCRUMBS_DESC' => 'Show breadcrumb navigation which displays the current page in context within the site structure', |
347
|
|
|
'ADVERTISE' => 'Advertisement Code', |
348
|
|
|
'ADVERTISE_DESC' => 'Insert here the advertisement code', |
349
|
|
|
'MAINTAINEDBY' => 'Maintained By', |
350
|
|
|
'MAINTAINEDBY_DESC' => 'Allow url of support site or community', |
351
|
|
|
'BOOKMARKS' => 'Social Bookmarks', |
352
|
|
|
'BOOKMARKS_DESC' => 'Show Social Bookmarks in the single page', |
353
|
|
|
//'FACEBOOK_COMMENTS' => 'Facebook comments', |
354
|
|
|
//'FACEBOOK_COMMENTS_DESC' => 'Allow Facebook comments in the single page', |
355
|
|
|
//'DISQUS_COMMENTS' => 'Disqus comments', |
356
|
|
|
//'DISQUS_COMMENTS_DESC' => 'Allow Disqus comments in the single page', |
357
|
|
|
]; |
358
|
|
|
foreach ($getDefinesConf as $defc => $descc) { |
359
|
|
|
$ret .= $this->ld->getDefine($language, $defc, $descc); |
360
|
|
|
} |
361
|
|
|
|
362
|
|
|
return $ret; |
363
|
|
|
} |
364
|
|
|
|
365
|
|
|
/** |
366
|
|
|
* @private function getLanguageNotificationsGlobal |
367
|
|
|
* @param $language |
368
|
|
|
* @param $tableBroken |
369
|
|
|
* @param $tableComment |
370
|
|
|
* @return string |
371
|
|
|
*/ |
372
|
|
|
private function getLanguageNotificationsGlobal($language, $tableBroken, $tableComment) |
373
|
|
|
{ |
374
|
|
|
$ret = $this->ld->getAboveDefines('Global notifications'); |
375
|
|
|
$getDefinesNotif = [ |
376
|
|
|
'NOTIFY_GLOBAL' => 'Global notification', |
377
|
|
|
'NOTIFY_GLOBAL_NEW' => 'Any new item', |
378
|
|
|
'NOTIFY_GLOBAL_NEW_CAPTION' => 'Notify me about any new item', |
379
|
|
|
'NOTIFY_GLOBAL_NEW_SUBJECT' => 'Notification about new item', |
380
|
|
|
'NOTIFY_GLOBAL_MODIFY' => 'Any modified item', |
381
|
|
|
'NOTIFY_GLOBAL_MODIFY_CAPTION' => 'Notify me about any item modification', |
382
|
|
|
'NOTIFY_GLOBAL_MODIFY_SUBJECT' => 'Notification about modification', |
383
|
|
|
'NOTIFY_GLOBAL_DELETE' => 'Any deleted item', |
384
|
|
|
'NOTIFY_GLOBAL_DELETE_CAPTION' => 'Notify me about any deleted item', |
385
|
|
|
'NOTIFY_GLOBAL_DELETE_SUBJECT' => 'Notification about deleted item', |
386
|
|
|
'NOTIFY_GLOBAL_APPROVE' => 'Any item to approve', |
387
|
|
|
'NOTIFY_GLOBAL_APPROVE_CAPTION' => 'Notify me about any item waiting for approvement', |
388
|
|
|
'NOTIFY_GLOBAL_APPROVE_SUBJECT' => 'Notification about item waiting for approvement', |
389
|
|
|
//'CATEGORY_NOTIFY' => 'Category notification', |
390
|
|
|
//'CATEGORY_NOTIFY_DESC' => 'Category notification desc', |
391
|
|
|
//'CATEGORY_NOTIFY_CAPTION' => 'Category notification caption', |
392
|
|
|
//'CATEGORY_NOTIFY_SUBJECT' => 'Category notification Subject', |
393
|
|
|
//'CATEGORY_SUBMIT_NOTIFY' => 'Category submit notification', |
394
|
|
|
//'CATEGORY_SUBMIT_NOTIFY_CAPTION' => 'Category submit notification caption', |
395
|
|
|
//'CATEGORY_SUBMIT_NOTIFY_DESC' => 'Category submit notification desc', |
396
|
|
|
//'CATEGORY_SUBMIT_NOTIFY_SUBJECT' => 'Category submit notification subject', |
397
|
|
|
]; |
398
|
|
|
if ($tableBroken) { |
399
|
|
|
$getDefinesNotif['NOTIFY_GLOBAL_BROKEN'] = 'Any broken item'; |
400
|
|
|
$getDefinesNotif['NOTIFY_GLOBAL_BROKEN_CAPTION'] = 'Notify me about any broken item'; |
401
|
|
|
$getDefinesNotif['NOTIFY_GLOBAL_BROKEN_SUBJECT'] = 'Notification about broken item'; |
402
|
|
|
} |
403
|
|
|
if ($tableComment) { |
404
|
|
|
$getDefinesNotif['NOTIFY_GLOBAL_COMMENT'] = 'Any comments'; |
405
|
|
|
$getDefinesNotif['NOTIFY_GLOBAL_COMMENT_CAPTION'] = 'Notify me about any comment'; |
406
|
|
|
$getDefinesNotif['NOTIFY_GLOBAL_COMMENT_SUBJECT'] = 'Notification about any comment'; |
407
|
|
|
} |
408
|
|
|
foreach ($getDefinesNotif as $defn => $descn) { |
409
|
|
|
$ret .= $this->ld->getDefine($language, $defn, $descn); |
410
|
|
|
} |
411
|
|
|
|
412
|
|
|
return $ret; |
413
|
|
|
} |
414
|
|
|
|
415
|
|
|
/** |
416
|
|
|
* @private function getLanguageNotificationsTable |
417
|
|
|
* @param $language |
418
|
|
|
* @param $tableName |
419
|
|
|
* @param mixed $tableSoleName |
420
|
|
|
* |
421
|
|
|
* @param $tableBroken |
422
|
|
|
* @param $tableComment |
423
|
|
|
* @return string |
424
|
|
|
*/ |
425
|
|
|
private function getLanguageNotificationsTable($language, $tableName, $tableSoleName, $tableBroken, $tableComment) |
426
|
|
|
{ |
427
|
|
|
$stuTableSoleName = \mb_strtoupper($tableSoleName); |
428
|
|
|
$ucfTableSoleName = \ucfirst($tableSoleName); |
429
|
|
|
$ret = $this->ld->getAboveDefines($ucfTableSoleName . ' notifications'); |
430
|
|
|
$getDefinesNotif = [ |
431
|
|
|
'NOTIFY_' . $stuTableSoleName => $ucfTableSoleName . ' notification', |
432
|
|
|
'NOTIFY_' . $stuTableSoleName . '_MODIFY' => "{$ucfTableSoleName} modification", |
433
|
|
|
'NOTIFY_' . $stuTableSoleName . '_MODIFY_CAPTION' => "Notify me about {$tableSoleName} modification", |
434
|
|
|
'NOTIFY_' . $stuTableSoleName . '_MODIFY_SUBJECT' => "Notification about modification", |
435
|
|
|
'NOTIFY_' . $stuTableSoleName . '_DELETE' => "{$ucfTableSoleName} deleted", |
436
|
|
|
'NOTIFY_' . $stuTableSoleName . '_DELETE_CAPTION' => "Notify me about deleted {$tableName}", |
437
|
|
|
'NOTIFY_' . $stuTableSoleName . '_DELETE_SUBJECT' => "Notification delete {$tableSoleName}", |
438
|
|
|
'NOTIFY_' . $stuTableSoleName . '_APPROVE' => "{$ucfTableSoleName} approve", |
439
|
|
|
'NOTIFY_' . $stuTableSoleName . '_APPROVE_CAPTION' => "Notify me about {$tableName} waiting for approvement", |
440
|
|
|
'NOTIFY_' . $stuTableSoleName . '_APPROVE_SUBJECT' => "Notification {$tableSoleName} waiting for approvement", |
441
|
|
|
]; |
442
|
|
|
if (1 == $tableBroken) { |
443
|
|
|
$getDefinesNotif['NOTIFY_' . $stuTableSoleName . '_BROKEN'] = "{$ucfTableSoleName} broken"; |
444
|
|
|
$getDefinesNotif['NOTIFY_' . $stuTableSoleName . '_BROKEN_CAPTION'] = "Notify me about broken {$tableSoleName}"; |
445
|
|
|
$getDefinesNotif['NOTIFY_' . $stuTableSoleName . '_BROKEN_SUBJECT'] = "Notification about broken {$tableSoleName}"; |
446
|
|
|
} |
447
|
|
|
if (1 == $tableComment) { |
448
|
|
|
$getDefinesNotif['NOTIFY_' . $stuTableSoleName . '_COMMENT'] = "{$ucfTableSoleName} comment"; |
449
|
|
|
$getDefinesNotif['NOTIFY_' . $stuTableSoleName . '_COMMENT_CAPTION'] = "Notify me about comments for {$tableSoleName}"; |
450
|
|
|
$getDefinesNotif['NOTIFY_' . $stuTableSoleName . '_COMMENT_SUBJECT'] = "Notification about comments for {$tableSoleName}"; |
451
|
|
|
} |
452
|
|
|
foreach ($getDefinesNotif as $defn => $descn) { |
453
|
|
|
$ret .= $this->ld->getDefine($language, $defn, $descn); |
454
|
|
|
} |
455
|
|
|
|
456
|
|
|
return $ret; |
457
|
|
|
} |
458
|
|
|
|
459
|
|
|
/** |
460
|
|
|
* @private function getLanguagePermissionsGroups |
461
|
|
|
* @param $language |
462
|
|
|
* |
463
|
|
|
* @return string |
464
|
|
|
*/ |
465
|
|
|
private function getLanguagePermissionsGroups($language) |
466
|
|
|
{ |
467
|
|
|
$ret = $this->ld->getAboveDefines('Permissions Groups'); |
468
|
|
|
$ret .= $this->ld->getDefine($language, 'GROUPS', 'Groups access'); |
469
|
|
|
$ret .= $this->ld->getDefine($language, 'GROUPS_DESC', 'Select general access permission for groups.'); |
470
|
|
|
$ret .= $this->ld->getDefine($language, 'ADMIN_GROUPS', 'Admin Group Permissions'); |
471
|
|
|
$ret .= $this->ld->getDefine($language, 'ADMIN_GROUPS_DESC', 'Which groups have access to tools and permissions page'); |
472
|
|
|
$ret .= $this->ld->getDefine($language, 'UPLOAD_GROUPS', 'Upload Group Permissions'); |
473
|
|
|
$ret .= $this->ld->getDefine($language, 'UPLOAD_GROUPS_DESC', 'Which groups have permissions to upload files'); |
474
|
|
|
|
475
|
|
|
return $ret; |
476
|
|
|
} |
477
|
|
|
|
478
|
|
|
|
479
|
|
|
/** |
480
|
|
|
* @private function getLanguagePermissionsGroups |
481
|
|
|
* @param $language |
482
|
|
|
* |
483
|
|
|
* @return string |
484
|
|
|
*/ |
485
|
|
|
private function getLanguageRatingbars($language) |
486
|
|
|
{ |
487
|
|
|
$ret = $this->ld->getAboveDefines('Rating bars'); |
488
|
|
|
$ret .= $this->ld->getDefine($language, 'RATINGBAR_GROUPS', 'Groups with rating rights'); |
489
|
|
|
$ret .= $this->ld->getDefine($language, 'RATINGBAR_GROUPS_DESC', 'Select groups which should have the right to rate'); |
490
|
|
|
$ret .= $this->ld->getDefine($language, 'RATINGBARS', 'Allow rating'); |
491
|
|
|
$ret .= $this->ld->getDefine($language, 'RATINGBARS_DESC', 'Define whether rating should be possible and which kind of rating should be used'); |
492
|
|
|
$ret .= $this->ld->getDefine($language, 'RATING_NONE', 'Do not use rating'); |
493
|
|
|
$ret .= $this->ld->getDefine($language, 'RATING_5STARS', 'Rating with 5 stars'); |
494
|
|
|
$ret .= $this->ld->getDefine($language, 'RATING_10STARS', 'Rating with 10 stars'); |
495
|
|
|
$ret .= $this->ld->getDefine($language, 'RATING_LIKES', 'Rating with likes and dislikes'); |
496
|
|
|
$ret .= $this->ld->getDefine($language, 'RATING_10NUM', 'Rating with 10 points'); |
497
|
|
|
|
498
|
|
|
return $ret; |
499
|
|
|
} |
500
|
|
|
|
501
|
|
|
/** |
502
|
|
|
* @private function getFooter |
503
|
|
|
* @param null |
504
|
|
|
* @return string |
505
|
|
|
*/ |
506
|
|
|
private function getLanguageFooter() |
507
|
|
|
{ |
508
|
|
|
$ret = $this->ld->getBelowDefines('End'); |
509
|
|
|
$ret .= $this->ld->getBlankLine(); |
510
|
|
|
|
511
|
|
|
return $ret; |
512
|
|
|
} |
513
|
|
|
|
514
|
|
|
/** |
515
|
|
|
* @public function render |
516
|
|
|
* @param null |
517
|
|
|
* @return bool|string |
518
|
|
|
*/ |
519
|
|
|
public function render() |
520
|
|
|
{ |
521
|
|
|
$module = $this->getModule(); |
522
|
|
|
$tables = $this->getTableTables($module->getVar('mod_id')); |
523
|
|
|
$filename = $this->getFileName(); |
524
|
|
|
$moduleDirname = $module->getVar('mod_dirname'); |
525
|
|
|
$language = $this->getLanguage($moduleDirname, 'MI', '', false); |
|
|
|
|
526
|
|
|
$tableAdmin = []; |
527
|
|
|
$tableUser = []; |
528
|
|
|
$tableSubmenu = []; |
529
|
|
|
$tableBlocks = []; |
530
|
|
|
$tableNotifications = []; |
531
|
|
|
$tablePermissions = []; |
532
|
|
|
$notifTable = ''; |
533
|
|
|
$tableBrokens = []; |
534
|
|
|
$tableComments = []; |
535
|
|
|
$tableRate = []; |
536
|
|
|
foreach (\array_keys($tables) as $t) { |
537
|
|
|
$tableName = $tables[$t]->getVar('table_name'); |
538
|
|
|
$tableSoleName = $tables[$t]->getVar('table_solename'); |
539
|
|
|
$tableAdmin[] = $tables[$t]->getVar('table_admin'); |
540
|
|
|
$tableUser[] = $tables[$t]->getVar('table_user'); |
541
|
|
|
$tableSubmenu[] = $tables[$t]->getVar('table_submenu'); |
542
|
|
|
$tableBlocks[] = $tables[$t]->getVar('table_blocks'); |
543
|
|
|
$tableNotifications[] = $tables[$t]->getVar('table_notifications'); |
544
|
|
|
$tableBroken = $tables[$t]->getVar('table_broken'); |
545
|
|
|
$tableBrokens[] = $tables[$t]->getVar('table_broken'); |
546
|
|
|
$tableComment = $tables[$t]->getVar('table_comments'); |
547
|
|
|
$tableComments[] = $tables[$t]->getVar('table_comments'); |
548
|
|
|
$tableRate[] = $tables[$t]->getVar('table_rate'); |
549
|
|
|
$tablePermissions[] = $tables[$t]->getVar('table_permissions'); |
550
|
|
|
if (1 === (int)$tables[$t]->getVar('table_notifications')) { |
551
|
|
|
$notifTable .= $this->getLanguageNotificationsTable($language, $tableName, $tableSoleName, $tableBroken, $tableComment); |
552
|
|
|
} |
553
|
|
|
|
554
|
|
|
} |
555
|
|
|
|
556
|
|
|
$content = $this->getHeaderFilesComments($module); |
557
|
|
|
$content .= $this->getLanguageMain($language, $module); |
558
|
|
|
$content .= $this->getLanguageMenu($module, $language); |
559
|
|
|
if (\in_array(1, $tableAdmin)) { |
560
|
|
|
$content .= $this->getLanguageAdmin($language); |
561
|
|
|
} |
562
|
|
|
if (\in_array(1, $tableUser)) { |
563
|
|
|
$content .= $this->getLanguageUser($language); |
564
|
|
|
} |
565
|
|
|
if (\in_array(1, $tableSubmenu)) { |
566
|
|
|
$content .= $this->getLanguageSubmenu($language, $tables); |
567
|
|
|
} |
568
|
|
|
if (\in_array(1, $tableRate)) { |
569
|
|
|
$content .= $this->getLanguageRatingbars($language); |
570
|
|
|
} |
571
|
|
|
|
572
|
|
|
if (\in_array(1, $tableBlocks)) { |
573
|
|
|
$content .= $this->getLanguageBlocks($tables, $language); |
574
|
|
|
} |
575
|
|
|
$content .= $this->getLanguageConfig($language, $tables); |
576
|
|
|
if (\in_array(1, $tableNotifications)) { |
577
|
|
|
$content .= $this->getLanguageNotificationsGlobal($language, \in_array(1, $tableBrokens), \in_array(1, $tableComments)); |
578
|
|
|
$content .= $notifTable; |
579
|
|
|
} |
580
|
|
|
if (\in_array(1, $tablePermissions)) { |
581
|
|
|
$content .= $this->getLanguagePermissionsGroups($language); |
582
|
|
|
} |
583
|
|
|
$content .= $this->getLanguageFooter(); |
584
|
|
|
|
585
|
|
|
$this->create($moduleDirname, 'language/' . $GLOBALS['xoopsConfig']['language'], $filename, $content, \_AM_MODULEBUILDER_FILE_CREATED, \_AM_MODULEBUILDER_FILE_NOTCREATED); |
586
|
|
|
|
587
|
|
|
return $this->renderFile(); |
588
|
|
|
} |
589
|
|
|
} |
590
|
|
|
|