|
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
|
|
|
* @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 LanguageModinfo |
|
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
|
|
|
* @return null |
|
66
|
|
|
*/ |
|
67
|
|
|
public function write($module, $table, $filename) |
|
68
|
|
|
{ |
|
69
|
|
|
$this->setModule($module); |
|
70
|
|
|
$this->setTable($table); |
|
71
|
|
|
$this->setFileName($filename); |
|
72
|
|
|
|
|
73
|
|
|
return null; |
|
74
|
|
|
} |
|
75
|
|
|
|
|
76
|
|
|
/** |
|
77
|
|
|
* @private function getLanguageMain |
|
78
|
|
|
* |
|
79
|
|
|
* @param $language |
|
80
|
|
|
* @param $module |
|
81
|
|
|
* |
|
82
|
|
|
* @return string |
|
83
|
|
|
*/ |
|
84
|
|
|
private function getLanguageMain($language, $module) |
|
85
|
|
|
{ |
|
86
|
|
|
$df = LanguageDefines::getInstance(); |
|
87
|
|
|
$pc = Modulebuilder\Files\CreatePhpCode::getInstance(); |
|
88
|
|
|
$ret = $df->getBlankLine(); |
|
89
|
|
|
$ret .= $pc->getPhpCodeIncludeDir("'common.php'",'', true, true, 'include'); |
|
90
|
|
|
$ret .= $df->getBlankLine(); |
|
91
|
|
|
$ret .= $df->getAboveHeadDefines('Admin Main'); |
|
92
|
|
|
$ret .= $df->getDefine($language, 'NAME', (string)$module->getVar('mod_name')); |
|
93
|
|
|
$ret .= $df->getDefine($language, 'DESC', (string)$module->getVar('mod_description')); |
|
94
|
|
|
|
|
95
|
|
|
return $ret; |
|
96
|
|
|
} |
|
97
|
|
|
|
|
98
|
|
|
/** |
|
99
|
|
|
* @private function getLanguageMenu |
|
100
|
|
|
* |
|
101
|
|
|
* @param $module |
|
102
|
|
|
* @param $language |
|
103
|
|
|
* |
|
104
|
|
|
* @return string |
|
105
|
|
|
*/ |
|
106
|
|
|
private function getLanguageMenu($module, $language) |
|
107
|
|
|
{ |
|
108
|
|
|
$df = Modulebuilder\Files\Language\LanguageDefines::getInstance(); |
|
109
|
|
|
$tables = $this->getTableTables($module->getVar('mod_id'), 'table_order'); |
|
110
|
|
|
$menu = 1; |
|
111
|
|
|
$ret = $df->getAboveHeadDefines('Admin Menu'); |
|
112
|
|
|
$ret .= $df->getDefine($language, "ADMENU{$menu}", 'Dashboard'); |
|
113
|
|
|
$tablePermissions = []; |
|
114
|
|
|
$tableBroken = []; |
|
115
|
|
|
foreach (array_keys($tables) as $i) { |
|
116
|
|
|
++$menu; |
|
117
|
|
|
$tablePermissions[] = $tables[$i]->getVar('table_permissions'); |
|
118
|
|
|
$tableBroken[] = $tables[$i]->getVar('table_broken'); |
|
119
|
|
|
$ucfTableName = ucfirst($tables[$i]->getVar('table_name')); |
|
120
|
|
|
$ret .= $df->getDefine($language, "ADMENU{$menu}", $ucfTableName); |
|
121
|
|
|
} |
|
122
|
|
|
if (in_array(1, $tableBroken)) { |
|
123
|
|
|
++$menu; |
|
124
|
|
|
$ret .= $df->getDefine($language, "ADMENU{$menu}", 'Broken items'); |
|
125
|
|
|
} |
|
126
|
|
|
if (in_array(1, $tablePermissions)) { |
|
127
|
|
|
++$menu; |
|
128
|
|
|
$ret .= $df->getDefine($language, "ADMENU{$menu}", 'Permissions'); |
|
129
|
|
|
} |
|
130
|
|
|
++$menu; |
|
131
|
|
|
$ret .= $df->getDefine($language, "ADMENU{$menu}", 'Feedback'); |
|
132
|
|
|
$ret .= $df->getDefine($language, 'ABOUT', 'About'); |
|
133
|
|
|
unset($menu, $tablePermissions); |
|
134
|
|
|
|
|
135
|
|
|
return $ret; |
|
136
|
|
|
} |
|
137
|
|
|
|
|
138
|
|
|
/** |
|
139
|
|
|
* @private function getLanguageAdmin |
|
140
|
|
|
* @param $language |
|
141
|
|
|
* |
|
142
|
|
|
* @return string |
|
143
|
|
|
*/ |
|
144
|
|
|
private function getLanguageAdmin($language) |
|
145
|
|
|
{ |
|
146
|
|
|
$df = LanguageDefines::getInstance(); |
|
147
|
|
|
$ret = $df->getAboveHeadDefines('Admin Nav'); |
|
148
|
|
|
$ret .= $df->getDefine($language, 'ADMIN_PAGER', 'Admin pager'); |
|
149
|
|
|
$ret .= $df->getDefine($language, 'ADMIN_PAGER_DESC', 'Admin per page list'); |
|
150
|
|
|
|
|
151
|
|
|
return $ret; |
|
152
|
|
|
} |
|
153
|
|
|
|
|
154
|
|
|
/** |
|
155
|
|
|
* @private function getLanguageSubmenu |
|
156
|
|
|
* @param $language |
|
157
|
|
|
* @param array $tables |
|
158
|
|
|
* |
|
159
|
|
|
* @return string |
|
160
|
|
|
*/ |
|
161
|
|
|
private function getLanguageSubmenu($language, $tables) |
|
162
|
|
|
{ |
|
163
|
|
|
$df = LanguageDefines::getInstance(); |
|
164
|
|
|
$ret = $df->getAboveDefines('Submenu'); |
|
165
|
|
|
$ret .= $df->getDefine($language, 'SMNAME1', 'Index page'); |
|
166
|
|
|
$i = 1; |
|
167
|
|
|
$tableSubmit = []; |
|
168
|
|
|
$tableSearch = []; |
|
169
|
|
|
foreach (array_keys($tables) as $t) { |
|
170
|
|
|
$tableName = $tables[$t]->getVar('table_name'); |
|
171
|
|
|
$tableSearch[] = $tables[$t]->getVar('table_search'); |
|
172
|
|
|
$ucfTablename = ucfirst(mb_strtolower($tableName)); |
|
173
|
|
|
if (1 == $tables[$t]->getVar('table_submenu')) { |
|
174
|
|
|
$ret .= $df->getDefine($language, "SMNAME{$i}", $ucfTablename); |
|
175
|
|
|
} |
|
176
|
|
|
++$i; |
|
177
|
|
|
if (1 == $tables[$t]->getVar('table_submit')) { |
|
178
|
|
|
$ret .= $df->getDefine($language, "SMNAME{$i}", 'Submit ' . $ucfTablename); |
|
179
|
|
|
++$i; |
|
180
|
|
|
} |
|
181
|
|
|
} |
|
182
|
|
|
|
|
183
|
|
|
if (in_array(1, $tableSearch)) { |
|
184
|
|
|
$ret .= $df->getDefine($language, "SMNAME{$i}", 'Search'); |
|
185
|
|
|
} |
|
186
|
|
|
unset($i, $tableSubmit); |
|
187
|
|
|
|
|
188
|
|
|
return $ret; |
|
189
|
|
|
} |
|
190
|
|
|
|
|
191
|
|
|
/** |
|
192
|
|
|
* @private function getLanguageBlocks |
|
193
|
|
|
* @param $language |
|
194
|
|
|
* @param array $tables |
|
195
|
|
|
* |
|
196
|
|
|
* @return string |
|
197
|
|
|
*/ |
|
198
|
|
|
private function getLanguageBlocks($tables, $language) |
|
199
|
|
|
{ |
|
200
|
|
|
$df = LanguageDefines::getInstance(); |
|
201
|
|
|
$ret = $df->getAboveDefines('Blocks'); |
|
202
|
|
|
foreach (array_keys($tables) as $i) { |
|
203
|
|
|
$tableName = $tables[$i]->getVar('table_name'); |
|
204
|
|
|
$stuTableName = mb_strtoupper($tableName); |
|
205
|
|
|
$tableSoleName = $tables[$i]->getVar('table_solename'); |
|
206
|
|
|
$stuTableSoleName = mb_strtoupper($tableSoleName); |
|
207
|
|
|
$ucfTableName = ucfirst($tableName); |
|
208
|
|
|
$ucfTableSoleName = ucfirst($stuTableSoleName); |
|
209
|
|
|
|
|
210
|
|
|
$ret .= $df->getDefine($language, "{$stuTableName}_BLOCK", "{$ucfTableName} block"); |
|
211
|
|
|
$ret .= $df->getDefine($language, "{$stuTableName}_BLOCK_DESC", "{$ucfTableName} block description"); |
|
212
|
|
|
if (1 == $tables[$i]->getVar('table_category')) { |
|
213
|
|
|
$ret .= $df->getDefine($language, "{$stuTableName}_BLOCK_{$stuTableSoleName}", "{$ucfTableName} block {$ucfTableSoleName}"); |
|
214
|
|
|
$ret .= $df->getDefine($language, "{$stuTableName}_BLOCK_{$stuTableSoleName}_DESC", "{$ucfTableName} block {$ucfTableSoleName} description"); |
|
215
|
|
|
} else { |
|
216
|
|
|
$ret .= $df->getDefine($language, "{$stuTableName}_BLOCK_{$stuTableSoleName}", "{$ucfTableName} block {$ucfTableSoleName}"); |
|
217
|
|
|
$ret .= $df->getDefine($language, "{$stuTableName}_BLOCK_{$stuTableSoleName}_DESC", "{$ucfTableName} block {$ucfTableSoleName} description"); |
|
218
|
|
|
$ret .= $df->getDefine($language, "{$stuTableName}_BLOCK_LAST", "{$ucfTableName} block last"); |
|
219
|
|
|
$ret .= $df->getDefine($language, "{$stuTableName}_BLOCK_LAST_DESC", "{$ucfTableName} block last description"); |
|
220
|
|
|
$ret .= $df->getDefine($language, "{$stuTableName}_BLOCK_NEW", "{$ucfTableName} block new"); |
|
221
|
|
|
$ret .= $df->getDefine($language, "{$stuTableName}_BLOCK_NEW_DESC", "{$ucfTableName} block new description"); |
|
222
|
|
|
$ret .= $df->getDefine($language, "{$stuTableName}_BLOCK_HITS", "{$ucfTableName} block hits"); |
|
223
|
|
|
$ret .= $df->getDefine($language, "{$stuTableName}_BLOCK_HITS_DESC", "{$ucfTableName} block hits description"); |
|
224
|
|
|
$ret .= $df->getDefine($language, "{$stuTableName}_BLOCK_TOP", "{$ucfTableName} block top"); |
|
225
|
|
|
$ret .= $df->getDefine($language, "{$stuTableName}_BLOCK_TOP_DESC", "{$ucfTableName} block top description"); |
|
226
|
|
|
$ret .= $df->getDefine($language, "{$stuTableName}_BLOCK_RANDOM", "{$ucfTableName} block random"); |
|
227
|
|
|
$ret .= $df->getDefine($language, "{$stuTableName}_BLOCK_RANDOM_DESC", "{$ucfTableName} block random description"); |
|
228
|
|
|
} |
|
229
|
|
|
} |
|
230
|
|
|
|
|
231
|
|
|
return $ret; |
|
232
|
|
|
} |
|
233
|
|
|
|
|
234
|
|
|
/** |
|
235
|
|
|
* @private function getLanguageUser |
|
236
|
|
|
* @param $language |
|
237
|
|
|
* |
|
238
|
|
|
* @return string |
|
239
|
|
|
*/ |
|
240
|
|
|
private function getLanguageUser($language) |
|
241
|
|
|
{ |
|
242
|
|
|
$df = LanguageDefines::getInstance(); |
|
243
|
|
|
$ret = $df->getAboveDefines('User'); |
|
244
|
|
|
$ret .= $df->getDefine($language, 'USER_PAGER', 'User pager'); |
|
245
|
|
|
$ret .= $df->getDefine($language, 'USER_PAGER_DESC', 'User per page list'); |
|
246
|
|
|
|
|
247
|
|
|
return $ret; |
|
248
|
|
|
} |
|
249
|
|
|
|
|
250
|
|
|
/** |
|
251
|
|
|
* @private function getLanguageConfig |
|
252
|
|
|
* @param $language |
|
253
|
|
|
* @param $tables |
|
254
|
|
|
* |
|
255
|
|
|
* @return string |
|
256
|
|
|
*/ |
|
257
|
|
|
private function getLanguageConfig($language, $tables) |
|
258
|
|
|
{ |
|
259
|
|
|
$df = LanguageDefines::getInstance(); |
|
260
|
|
|
$ret = $df->getAboveDefines('Config'); |
|
261
|
|
|
$fieldImage = false; |
|
262
|
|
|
$fieldFile = false; |
|
263
|
|
|
$useTag = false; |
|
264
|
|
|
$fieldEditor = false; |
|
265
|
|
|
// $usePermissions = false; |
|
266
|
|
|
foreach (array_keys($tables) as $i) { |
|
267
|
|
|
$fields = $this->getTableFields($tables[$i]->getVar('table_mid'), $tables[$i]->getVar('table_id')); |
|
268
|
|
|
$ucfTablename = ucfirst($tables[$i]->getVar('table_name')); |
|
269
|
|
|
$stuTablename = mb_strtoupper($ucfTablename); |
|
|
|
|
|
|
270
|
|
|
foreach (array_keys($fields) as $f) { |
|
271
|
|
|
$fieldElement = $fields[$f]->getVar('field_element'); |
|
272
|
|
|
if (3 == $fieldElement) { |
|
273
|
|
|
$fieldEditor = true; |
|
274
|
|
|
} |
|
275
|
|
|
if (4 == $fieldElement) { |
|
276
|
|
|
$fieldEditor = true; |
|
277
|
|
|
} |
|
278
|
|
|
if (13 == $fieldElement) { |
|
279
|
|
|
$fieldImage = true; |
|
280
|
|
|
} |
|
281
|
|
|
if (14 == $fieldElement) { |
|
282
|
|
|
$fieldFile = true; |
|
283
|
|
|
} |
|
284
|
|
|
} |
|
285
|
|
|
if (0 != $tables[$i]->getVar('table_tag')) { |
|
286
|
|
|
$useTag = true; |
|
287
|
|
|
} |
|
288
|
|
|
// if (0 != $tables[$i]->getVar('table_permissions')) {$usePermissions = true;} |
|
289
|
|
|
} |
|
290
|
|
|
if ($fieldEditor) { |
|
291
|
|
|
$ret .= $df->getDefine($language, 'EDITOR_DEFAULT', 'Editor'); |
|
292
|
|
|
$ret .= $df->getDefine($language, 'EDITOR_DEFAULT_DESC', 'Select the editor which should be used for text area fields'); |
|
293
|
|
|
$ret .= $df->getDefine($language, 'EDITOR_MAXCHAR', 'Text max characters'); |
|
294
|
|
|
$ret .= $df->getDefine($language, 'EDITOR_MAXCHAR_DESC', 'Max characters for showing text of a textarea or editor field in admin area'); |
|
295
|
|
|
} |
|
296
|
|
|
$ret .= $df->getDefine($language, 'KEYWORDS', 'Keywords'); |
|
297
|
|
|
$ret .= $df->getDefine($language, 'KEYWORDS_DESC', 'Insert here the keywords (separate by comma)'); |
|
298
|
|
|
/*if (usePermissions) { |
|
299
|
|
|
$ret .= $df->getDefine($language, "GROUPS", "Groups"); |
|
300
|
|
|
$ret .= $df->getDefine($language, "GROUPS_DESC", "Groups to have permissions"); |
|
301
|
|
|
$ret .= $df->getDefine($language, "ADMIN_GROUPS", "Admin Groups"); |
|
302
|
|
|
$ret .= $df->getDefine($language, "ADMIN_GROUPS_DESC", "Admin Groups to have permissions access"); |
|
303
|
|
|
}*/ |
|
304
|
|
|
|
|
305
|
|
|
if ($fieldImage || $fieldFile) { |
|
306
|
|
|
$ret .= $df->getDefine($language, 'SIZE_MB', 'MB'); |
|
307
|
|
|
} |
|
308
|
|
|
if ($fieldImage) { |
|
309
|
|
|
$ret .= $df->getDefine($language, 'MAXSIZE_IMAGE', 'Max size image'); |
|
310
|
|
|
$ret .= $df->getDefine($language, 'MAXSIZE_IMAGE_DESC', 'Define the max size for uploading images'); |
|
311
|
|
|
$ret .= $df->getDefine($language, 'MIMETYPES_IMAGE', 'Mime types image'); |
|
312
|
|
|
$ret .= $df->getDefine($language, 'MIMETYPES_IMAGE_DESC', 'Define the allowed mime types for uploading images'); |
|
313
|
|
|
$ret .= $df->getDefine($language, 'MAXWIDTH_IMAGE', 'Max width image'); |
|
314
|
|
|
$ret .= $df->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'); |
|
315
|
|
|
$ret .= $df->getDefine($language, 'MAXHEIGHT_IMAGE', 'Max height image'); |
|
316
|
|
|
$ret .= $df->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'); |
|
317
|
|
|
//MB define |
|
318
|
|
|
} |
|
319
|
|
|
if ($fieldFile) { |
|
320
|
|
|
$ret .= $df->getDefine($language, 'MAXSIZE_FILE', 'Max size file'); |
|
321
|
|
|
$ret .= $df->getDefine($language, 'MAXSIZE_FILE_DESC', 'Define the max size for uploading files'); |
|
322
|
|
|
$ret .= $df->getDefine($language, 'MIMETYPES_FILE', 'Mime types file'); |
|
323
|
|
|
$ret .= $df->getDefine($language, 'MIMETYPES_FILE_DESC', 'Define the allowed mime types for uploading files'); |
|
324
|
|
|
} |
|
325
|
|
|
if ($useTag) { |
|
326
|
|
|
$ret .= $df->getDefine($language, 'USE_TAG', 'Use TAG'); |
|
327
|
|
|
$ret .= $df->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 .= $df->getDefine($language, $defc, $descc); |
|
353
|
|
|
} |
|
354
|
|
|
|
|
355
|
|
|
return $ret; |
|
356
|
|
|
} |
|
357
|
|
|
|
|
358
|
|
|
/** |
|
359
|
|
|
* @private function getLanguageNotificationsGlobal |
|
360
|
|
|
* @param $language |
|
361
|
|
|
* @param mixed $tableSoleName |
|
362
|
|
|
* |
|
363
|
|
|
* @return string |
|
364
|
|
|
*/ |
|
365
|
|
|
private function getLanguageNotificationsGlobal($language) |
|
366
|
|
|
{ |
|
367
|
|
|
$df = LanguageDefines::getInstance(); |
|
368
|
|
|
$ret = $df->getAboveDefines('Notifications'); |
|
369
|
|
|
$getDefinesNotif = [ |
|
370
|
|
|
'GLOBAL_NOTIFY' => 'Global notification', |
|
371
|
|
|
'GLOBAL_NOTIFY_DESC' => 'Global notification desc', |
|
372
|
|
|
'GLOBAL_NEW_NOTIFY' => 'New item', |
|
373
|
|
|
'GLOBAL_NEW_NOTIFY_CAPTION' => 'Notify me about new items', |
|
374
|
|
|
'GLOBAL_NEW_NOTIFY_SUBJECT' => 'Notification new item', |
|
375
|
|
|
'GLOBAL_MODIFY_NOTIFY' => 'Item modification', |
|
376
|
|
|
'GLOBAL_MODIFY_NOTIFY_CAPTION' => 'Notify me about item modification', |
|
377
|
|
|
'GLOBAL_MODIFY_NOTIFY_SUBJECT' => 'Notification about modification', |
|
378
|
|
|
'GLOBAL_DELETE_NOTIFY' => 'Item deleted', |
|
379
|
|
|
'GLOBAL_DELETE_NOTIFY_CAPTION' => 'Notify me about deleted items', |
|
380
|
|
|
'GLOBAL_DELETE_NOTIFY_SUBJECT' => 'Notification delete item', |
|
381
|
|
|
'GLOBAL_APPROVE_NOTIFY' => 'Item approve', |
|
382
|
|
|
'GLOBAL_APPROVE_NOTIFY_CAPTION' => 'Notify me about items waiting for approvement', |
|
383
|
|
|
'GLOBAL_APPROVE_NOTIFY_SUBJECT' => 'Notification item waiting for approvement', |
|
384
|
|
|
'GLOBAL_BROKEN_NOTIFY' => 'Item broken', |
|
385
|
|
|
'GLOBAL_BROKEN_NOTIFY_CAPTION' => 'Notify me about broken item', |
|
386
|
|
|
'GLOBAL_BROKEN_NOTIFY_SUBJECT' => 'Notification about broken item', |
|
387
|
|
|
|
|
388
|
|
|
//'CATEGORY_NOTIFY' => 'Category notification', |
|
389
|
|
|
//'CATEGORY_NOTIFY_DESC' => 'Category notification desc', |
|
390
|
|
|
//'CATEGORY_NOTIFY_CAPTION' => 'Category notification caption', |
|
391
|
|
|
//'CATEGORY_NOTIFY_SUBJECT' => 'Category notification Subject', |
|
392
|
|
|
//'CATEGORY_SUBMIT_NOTIFY' => 'Category submit notification', |
|
393
|
|
|
//'CATEGORY_SUBMIT_NOTIFY_CAPTION' => 'Category submit notification caption', |
|
394
|
|
|
//'CATEGORY_SUBMIT_NOTIFY_DESC' => 'Category submit notification desc', |
|
395
|
|
|
//'CATEGORY_SUBMIT_NOTIFY_SUBJECT' => 'Category submit notification subject', |
|
396
|
|
|
|
|
397
|
|
|
]; |
|
398
|
|
|
foreach ($getDefinesNotif as $defn => $descn) { |
|
399
|
|
|
$ret .= $df->getDefine($language, $defn, $descn); |
|
400
|
|
|
} |
|
401
|
|
|
|
|
402
|
|
|
return $ret; |
|
403
|
|
|
} |
|
404
|
|
|
|
|
405
|
|
|
/** |
|
406
|
|
|
* @private function getLanguageNotificationsTable |
|
407
|
|
|
* @param $language |
|
408
|
|
|
* @param mixed $tableSoleName |
|
409
|
|
|
* |
|
410
|
|
|
* @return string |
|
411
|
|
|
*/ |
|
412
|
|
|
private function getLanguageNotificationsTable($language, $tableName, $tableSoleName) |
|
413
|
|
|
{ |
|
414
|
|
|
$df = LanguageDefines::getInstance(); |
|
415
|
|
|
$ret = $df->getAboveDefines('Notifications'); |
|
416
|
|
|
$stuTableSoleName = mb_strtoupper($tableSoleName); |
|
417
|
|
|
$ucfTableSoleName = ucfirst($tableSoleName); |
|
418
|
|
|
$getDefinesNotif = [ |
|
419
|
|
|
$stuTableSoleName . '_NOTIFY' => $ucfTableSoleName . ' notification', |
|
420
|
|
|
$stuTableSoleName . '_NOTIFY_CAPTION' => $ucfTableSoleName . ' notification caption', |
|
421
|
|
|
$stuTableSoleName . '_NOTIFY_SUBJECT' => $ucfTableSoleName . ' notification subject', |
|
422
|
|
|
$stuTableSoleName . '_NEW_NOTIFY' => "New {$tableSoleName}", |
|
423
|
|
|
$stuTableSoleName . '_NEW_NOTIFY_CAPTION' => "Notify me about new {$tableName}", |
|
424
|
|
|
$stuTableSoleName . '_NEW_NOTIFY_SUBJECT' => "Notification new {$tableSoleName}", |
|
425
|
|
|
$stuTableSoleName . '_MODIFY_NOTIFY' => "{$ucfTableSoleName} modification", |
|
426
|
|
|
$stuTableSoleName . '_MODIFY_NOTIFY_CAPTION' => "Notify me about {$tableSoleName} modification", |
|
427
|
|
|
$stuTableSoleName . '_MODIFY_NOTIFY_SUBJECT' => "Notification about modification", |
|
428
|
|
|
$stuTableSoleName . '_DELETE_NOTIFY' => "{$ucfTableSoleName} deleted", |
|
429
|
|
|
$stuTableSoleName . '_DELETE_NOTIFY_CAPTION' => "Notify me about deleted {$tableName}", |
|
430
|
|
|
$stuTableSoleName . '_DELETE_NOTIFY_SUBJECT' => "Notification delete {$tableSoleName}", |
|
431
|
|
|
$stuTableSoleName . '_APPROVE_NOTIFY' => "{$ucfTableSoleName} approve", |
|
432
|
|
|
$stuTableSoleName . '_APPROVE_NOTIFY_CAPTION' => "Notify me about {$tableName} waiting for approvement", |
|
433
|
|
|
$stuTableSoleName . '_APPROVE_NOTIFY_SUBJECT' => "Notification {$tableSoleName} waiting for approvement", |
|
434
|
|
|
$stuTableSoleName . '_BROKEN_NOTIFY' => "{$ucfTableSoleName} broken", |
|
435
|
|
|
$stuTableSoleName . '_BROKEN_NOTIFY_CAPTION' => "Notify me about broken {$tableSoleName}", |
|
436
|
|
|
$stuTableSoleName . '_BROKEN_NOTIFY_SUBJECT' => "Notification about broken {$tableSoleName}", |
|
437
|
|
|
]; |
|
438
|
|
|
foreach ($getDefinesNotif as $defn => $descn) { |
|
439
|
|
|
$ret .= $df->getDefine($language, $defn, $descn); |
|
440
|
|
|
} |
|
441
|
|
|
|
|
442
|
|
|
return $ret; |
|
443
|
|
|
} |
|
444
|
|
|
/** |
|
445
|
|
|
* @private function getLanguagePermissionsGroups |
|
446
|
|
|
* @param $language |
|
447
|
|
|
* |
|
448
|
|
|
* @return string |
|
449
|
|
|
*/ |
|
450
|
|
|
private function getLanguagePermissionsGroups($language) |
|
451
|
|
|
{ |
|
452
|
|
|
$df = LanguageDefines::getInstance(); |
|
453
|
|
|
$ret = $df->getAboveDefines('Permissions Groups'); |
|
454
|
|
|
$ret .= $df->getDefine($language, 'GROUPS', 'Groups access'); |
|
455
|
|
|
$ret .= $df->getDefine($language, 'GROUPS_DESC', 'Select general access permission for groups.'); |
|
456
|
|
|
$ret .= $df->getDefine($language, 'ADMIN_GROUPS', 'Admin Group Permissions'); |
|
457
|
|
|
$ret .= $df->getDefine($language, 'ADMIN_GROUPS_DESC', 'Which groups have access to tools and permissions page'); |
|
458
|
|
|
$ret .= $df->getDefine($language, 'UPLOAD_GROUPS', 'Upload Group Permissions'); |
|
459
|
|
|
$ret .= $df->getDefine($language, 'UPLOAD_GROUPS_DESC', 'Which groups have permissions to upload files'); |
|
460
|
|
|
|
|
461
|
|
|
return $ret; |
|
462
|
|
|
} |
|
463
|
|
|
|
|
464
|
|
|
/** |
|
465
|
|
|
* @private function getFooter |
|
466
|
|
|
* @param null |
|
467
|
|
|
* @return string |
|
468
|
|
|
*/ |
|
469
|
|
|
private function getLanguageFooter() |
|
470
|
|
|
{ |
|
471
|
|
|
$df = LanguageDefines::getInstance(); |
|
472
|
|
|
$ret = $df->getBelowDefines('End'); |
|
473
|
|
|
$ret .= $df->getBlankLine(); |
|
474
|
|
|
|
|
475
|
|
|
return $ret; |
|
476
|
|
|
} |
|
477
|
|
|
|
|
478
|
|
|
/** |
|
479
|
|
|
* @public function render |
|
480
|
|
|
* @param null |
|
481
|
|
|
* @return bool|string |
|
482
|
|
|
*/ |
|
483
|
|
|
public function render() |
|
484
|
|
|
{ |
|
485
|
|
|
$module = $this->getModule(); |
|
486
|
|
|
$tables = $this->getTableTables($module->getVar('mod_id')); |
|
487
|
|
|
$filename = $this->getFileName(); |
|
488
|
|
|
$moduleDirname = $module->getVar('mod_dirname'); |
|
489
|
|
|
$language = $this->getLanguage($moduleDirname, 'MI'); |
|
490
|
|
|
$tableAdmin = []; |
|
491
|
|
|
$tableUser = []; |
|
492
|
|
|
$tableSubmenu = []; |
|
493
|
|
|
$tableBlocks = []; |
|
494
|
|
|
$tableNotifications = []; |
|
495
|
|
|
$tablePermissions = []; |
|
496
|
|
|
$tableSoleName = ''; |
|
|
|
|
|
|
497
|
|
|
$notifTable = ''; |
|
498
|
|
|
foreach (array_keys($tables) as $t) { |
|
499
|
|
|
$tableName = $tables[$t]->getVar('table_name'); |
|
500
|
|
|
$tableSoleName = $tables[$t]->getVar('table_solename'); |
|
501
|
|
|
$tableAdmin[] = $tables[$t]->getVar('table_admin'); |
|
502
|
|
|
$tableUser[] = $tables[$t]->getVar('table_user'); |
|
503
|
|
|
$tableSubmenu[] = $tables[$t]->getVar('table_submenu'); |
|
504
|
|
|
$tableBlocks[] = $tables[$t]->getVar('table_blocks'); |
|
505
|
|
|
$tableNotifications[] = $tables[$t]->getVar('table_notifications'); |
|
506
|
|
|
if (1 === (int)$tables[$t]->getVar('table_notifications')) { |
|
507
|
|
|
$notifTable .= $this->getLanguageNotificationsTable($language, $tableName, $tableSoleName); |
|
508
|
|
|
} |
|
509
|
|
|
$tablePermissions[] = $tables[$t]->getVar('table_permissions'); |
|
510
|
|
|
} |
|
511
|
|
|
|
|
512
|
|
|
$content = $this->getHeaderFilesComments($module); |
|
513
|
|
|
$content .= $this->getLanguageMain($language, $module); |
|
514
|
|
|
$content .= $this->getLanguageMenu($module, $language); |
|
515
|
|
|
if (in_array(1, $tableAdmin)) { |
|
516
|
|
|
$content .= $this->getLanguageAdmin($language); |
|
517
|
|
|
} |
|
518
|
|
|
if (in_array(1, $tableUser)) { |
|
519
|
|
|
$content .= $this->getLanguageUser($language); |
|
520
|
|
|
} |
|
521
|
|
|
if (in_array(1, $tableSubmenu)) { |
|
522
|
|
|
$content .= $this->getLanguageSubmenu($language, $tables); |
|
523
|
|
|
} |
|
524
|
|
|
//if (in_array(1, $tableBlocks)) { |
|
525
|
|
|
$content .= $this->getLanguageBlocks($tables, $language); |
|
526
|
|
|
//} |
|
527
|
|
|
$content .= $this->getLanguageConfig($language, $tables); |
|
528
|
|
|
if (in_array(1, $tableNotifications)) { |
|
529
|
|
|
$content .= $this->getLanguageNotificationsGlobal($language); |
|
530
|
|
|
$content .= $notifTable; |
|
531
|
|
|
} |
|
532
|
|
|
if (in_array(1, $tablePermissions)) { |
|
533
|
|
|
$content .= $this->getLanguagePermissionsGroups($language); |
|
534
|
|
|
} |
|
535
|
|
|
$content .= $this->getLanguageFooter(); |
|
536
|
|
|
|
|
537
|
|
|
$this->create($moduleDirname, 'language/' . $GLOBALS['xoopsConfig']['language'], $filename, $content, _AM_MODULEBUILDER_FILE_CREATED, _AM_MODULEBUILDER_FILE_NOTCREATED); |
|
538
|
|
|
|
|
539
|
|
|
return $this->renderFile(); |
|
540
|
|
|
} |
|
541
|
|
|
} |
|
542
|
|
|
|