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