Passed
Push — master ( 7331d1...59e477 )
by Goffy
05:28
created

class/Files/Language/LanguageModinfo.php (1 issue)

Labels
Severity
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
                }
238
            }
239
        }
240
241
        return $ret;
242
    }
243
244
    /**
245
     * @private function getLanguageUser
246
     * @param $language
247
     *
248
     * @return string
249
     */
250
    private function getLanguageUser($language)
251
    {
252
        $ret = $this->ld->getAboveDefines('User');
253
        $ret .= $this->ld->getDefine($language, 'USER_PAGER', 'User pager');
254
        $ret .= $this->ld->getDefine($language, 'USER_PAGER_DESC', 'User per page list');
255
256
        return $ret;
257
    }
258
259
    /**
260
     * @private function getLanguageConfig
261
     * @param $language
262
     * @param $tables
263
     *
264
     * @return string
265
     */
266
    private function getLanguageConfig($language, $tables)
267
    {
268
        $ret         = $this->ld->getAboveDefines('Config');
269
        $fieldImage  = false;
270
        $fieldFile   = false;
271
        $useTag      = false;
272
        $fieldEditor = false;
273
        // $usePermissions = false;
274
        foreach (\array_keys($tables) as $i) {
275
            $fields = $this->getTableFields($tables[$i]->getVar('table_mid'), $tables[$i]->getVar('table_id'));
276
            foreach (\array_keys($fields) as $f) {
277
                $fieldElement = $fields[$f]->getVar('field_element');
278
                if (3 == $fieldElement) {
279
                    $fieldEditor = true;
280
                }
281
                if (4 == $fieldElement) {
282
                    $fieldEditor = true;
283
                }
284
                if (10 == $fieldElement) {
285
                    $fieldImage = true;
286
                }
287
                if (13 == $fieldElement) {
288
                    $fieldImage = true;
289
                }
290
				if (14 == $fieldElement) {
291
                    $fieldFile = true;
292
                }
293
            }
294
            if (0 != $tables[$i]->getVar('table_tag')) {
295
                $useTag = true;
296
            }
297
        }
298
        if ($fieldEditor) {
299
            $ret .= $this->ld->getDefine($language, 'EDITOR_ADMIN', 'Editor admin');
300
            $ret .= $this->ld->getDefine($language, 'EDITOR_ADMIN_DESC', 'Select the editor which should be used in admin area for text area fields');
301
            $ret .= $this->ld->getDefine($language, 'EDITOR_USER', 'Editor user');
302
            $ret .= $this->ld->getDefine($language, 'EDITOR_USER_DESC', 'Select the editor which should be used in user area for text area fields');
303
            $ret .= $this->ld->getDefine($language, 'EDITOR_MAXCHAR', 'Text max characters');
304
            $ret .= $this->ld->getDefine($language, 'EDITOR_MAXCHAR_DESC', 'Max characters for showing text of a textarea or editor field in admin area');
305
        }
306
        $ret .= $this->ld->getDefine($language, 'KEYWORDS', 'Keywords');
307
        $ret .= $this->ld->getDefine($language, 'KEYWORDS_DESC', 'Insert here the keywords (separate by comma)');
308
309
        if ($fieldImage || $fieldFile) {
310
            $ret .= $this->ld->getDefine($language, 'SIZE_MB', 'MB');
311
        }
312
        if ($fieldImage) {
313
            $ret .= $this->ld->getDefine($language, 'MAXSIZE_IMAGE', 'Max size image');
314
            $ret .= $this->ld->getDefine($language, 'MAXSIZE_IMAGE_DESC', 'Define the max size for uploading images');
315
            $ret .= $this->ld->getDefine($language, 'MIMETYPES_IMAGE', 'Mime types image');
316
            $ret .= $this->ld->getDefine($language, 'MIMETYPES_IMAGE_DESC', 'Define the allowed mime types for uploading images');
317
            $ret .= $this->ld->getDefine($language, 'MAXWIDTH_IMAGE', 'Max width image');
318
            $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.');
319
            $ret .= $this->ld->getDefine($language, 'MAXHEIGHT_IMAGE', 'Max height image');
320
            $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');
321
        }
322
		if ($fieldFile) {
323
            $ret .= $this->ld->getDefine($language, 'MAXSIZE_FILE', 'Max size file');
324
            $ret .= $this->ld->getDefine($language, 'MAXSIZE_FILE_DESC', 'Define the max size for uploading files');
325
            $ret .= $this->ld->getDefine($language, 'MIMETYPES_FILE', 'Mime types file');
326
            $ret .= $this->ld->getDefine($language, 'MIMETYPES_FILE_DESC', 'Define the allowed mime types for uploading files');
327
        }
328
        if ($useTag) {
329
            $ret .= $this->ld->getDefine($language, 'USE_TAG', 'Use TAG');
330
            $ret .= $this->ld->getDefine($language, 'USE_TAG_DESC', 'If you use tag module, check this option to yes');
331
        }
332
        $getDefinesConf = [
333
            'NUMB_COL'               => 'Number Columns',
334
            'NUMB_COL_DESC'          => 'Number Columns to View',
335
            'DIVIDEBY'               => 'Divide By',
336
            'DIVIDEBY_DESC'          => 'Divide by columns number',
337
            'TABLE_TYPE'             => 'Table Type',
338
            'TABLE_TYPE_DESC'        => 'Table Type is the bootstrap html table',
339
            'PANEL_TYPE'             => 'Panel Type',
340
            'PANEL_TYPE_DESC'        => 'Panel Type is the bootstrap html div',
341
            'IDPAYPAL'               => 'Paypal ID',
342
            'IDPAYPAL_DESC'          => 'Insert here your PayPal ID for donations',
343
            'SHOW_BREADCRUMBS'       => 'Show breadcrumb navigation',
344
            'SHOW_BREADCRUMBS_DESC'  => 'Show breadcrumb navigation which displays the current page in context within the site structure',
345
            'ADVERTISE'              => 'Advertisement Code',
346
            'ADVERTISE_DESC'         => 'Insert here the advertisement code',
347
            'MAINTAINEDBY'           => 'Maintained By',
348
            'MAINTAINEDBY_DESC'      => 'Allow url of support site or community',
349
            'BOOKMARKS'              => 'Social Bookmarks',
350
            'BOOKMARKS_DESC'         => 'Show Social Bookmarks in the single page',
351
            //'FACEBOOK_COMMENTS'      => 'Facebook comments',
352
            //'FACEBOOK_COMMENTS_DESC' => 'Allow Facebook comments in the single page',
353
            //'DISQUS_COMMENTS'        => 'Disqus comments',
354
            //'DISQUS_COMMENTS_DESC'   => 'Allow Disqus comments in the single page',
355
        ];
356
        foreach ($getDefinesConf as $defc => $descc) {
357
            $ret .= $this->ld->getDefine($language, $defc, $descc);
358
        }
359
360
        return $ret;
361
    }
362
363
    /**
364
     * @private function getLanguageNotificationsGlobal
365
     * @param       $language
366
     * @param $tableBroken
367
     * @param $tableComment
368
     * @return string
369
     */
370
    private function getLanguageNotificationsGlobal($language, $tableBroken, $tableComment)
371
    {
372
        $ret              = $this->ld->getAboveDefines('Global notifications');
373
        $getDefinesNotif  = [
374
            'NOTIFY_GLOBAL'                  => 'Global notification',
375
            'NOTIFY_GLOBAL_NEW'              => 'Any new item',
376
            'NOTIFY_GLOBAL_NEW_CAPTION'      => 'Notify me about any new item',
377
            'NOTIFY_GLOBAL_NEW_SUBJECT'      => 'Notification about new item',
378
            'NOTIFY_GLOBAL_MODIFY'           => 'Any modified item',
379
            'NOTIFY_GLOBAL_MODIFY_CAPTION'   => 'Notify me about any item modification',
380
            'NOTIFY_GLOBAL_MODIFY_SUBJECT'   => 'Notification about modification',
381
            'NOTIFY_GLOBAL_DELETE'           => 'Any deleted item',
382
            'NOTIFY_GLOBAL_DELETE_CAPTION'   => 'Notify me about any deleted item',
383
            'NOTIFY_GLOBAL_DELETE_SUBJECT'   => 'Notification about deleted item',
384
            'NOTIFY_GLOBAL_APPROVE'          => 'Any item to approve',
385
            'NOTIFY_GLOBAL_APPROVE_CAPTION'  => 'Notify me about any item waiting for approvement',
386
            'NOTIFY_GLOBAL_APPROVE_SUBJECT'  => 'Notification about item waiting for approvement',
387
            //'CATEGORY_NOTIFY'                => 'Category notification',
388
            //'CATEGORY_NOTIFY_DESC'           => 'Category notification desc',
389
            //'CATEGORY_NOTIFY_CAPTION'        => 'Category notification caption',
390
            //'CATEGORY_NOTIFY_SUBJECT'        => 'Category notification Subject',
391
            //'CATEGORY_SUBMIT_NOTIFY'         => 'Category submit notification',
392
            //'CATEGORY_SUBMIT_NOTIFY_CAPTION' => 'Category submit notification caption',
393
            //'CATEGORY_SUBMIT_NOTIFY_DESC'    => 'Category submit notification desc',
394
            //'CATEGORY_SUBMIT_NOTIFY_SUBJECT' => 'Category submit notification subject',
395
        ];
396
        if ($tableBroken) {
397
            $getDefinesNotif['NOTIFY_GLOBAL_BROKEN']         = 'Any broken item';
398
            $getDefinesNotif['NOTIFY_GLOBAL_BROKEN_CAPTION'] = 'Notify me about any broken item';
399
            $getDefinesNotif['NOTIFY_GLOBAL_BROKEN_SUBJECT'] = 'Notification about broken item';
400
        }
401
        if ($tableComment) {
402
            $getDefinesNotif['NOTIFY_GLOBAL_COMMENT']         = 'Any comments';
403
            $getDefinesNotif['NOTIFY_GLOBAL_COMMENT_CAPTION'] = 'Notify me about any comment';
404
            $getDefinesNotif['NOTIFY_GLOBAL_COMMENT_SUBJECT'] = 'Notification about any comment';
405
        }
406
        foreach ($getDefinesNotif as $defn => $descn) {
407
            $ret .= $this->ld->getDefine($language, $defn, $descn);
408
        }
409
410
        return $ret;
411
    }
412
413
    /**
414
     * @private function getLanguageNotificationsTable
415
     * @param       $language
416
     * @param $tableName
417
     * @param mixed $tableSoleName
418
     *
419
     * @param $tableBroken
420
     * @param $tableComment
421
     * @return string
422
     */
423
    private function getLanguageNotificationsTable($language, $tableName, $tableSoleName, $tableBroken, $tableComment)
424
    {
425
        $stuTableSoleName = \mb_strtoupper($tableSoleName);
426
        $ucfTableSoleName = \ucfirst($tableSoleName);
427
		$ret              = $this->ld->getAboveDefines($ucfTableSoleName . ' notifications');
428
        $getDefinesNotif  = [
429
            'NOTIFY_' . $stuTableSoleName                       => $ucfTableSoleName . ' notification',
430
            'NOTIFY_' . $stuTableSoleName . '_MODIFY'           => "{$ucfTableSoleName} modification",
431
            'NOTIFY_' . $stuTableSoleName . '_MODIFY_CAPTION'   => "Notify me about {$tableSoleName} modification",
432
            'NOTIFY_' . $stuTableSoleName . '_MODIFY_SUBJECT'   => "Notification about modification",
433
            'NOTIFY_' . $stuTableSoleName . '_DELETE'           => "{$ucfTableSoleName} deleted",
434
            'NOTIFY_' . $stuTableSoleName . '_DELETE_CAPTION'   => "Notify me about deleted {$tableName}",
435
            'NOTIFY_' . $stuTableSoleName . '_DELETE_SUBJECT'   => "Notification delete {$tableSoleName}",
436
            'NOTIFY_' . $stuTableSoleName . '_APPROVE'          => "{$ucfTableSoleName} approve",
437
            'NOTIFY_' . $stuTableSoleName . '_APPROVE_CAPTION'  => "Notify me about {$tableName} waiting for approvement",
438
            'NOTIFY_' . $stuTableSoleName . '_APPROVE_SUBJECT'  => "Notification {$tableSoleName} waiting for approvement",
439
        ];
440
        if (1 == $tableBroken) {
441
            $getDefinesNotif['NOTIFY_' . $stuTableSoleName . '_BROKEN']         = "{$ucfTableSoleName} broken";
442
            $getDefinesNotif['NOTIFY_' . $stuTableSoleName . '_BROKEN_CAPTION'] = "Notify me about broken {$tableSoleName}";
443
            $getDefinesNotif['NOTIFY_' . $stuTableSoleName . '_BROKEN_SUBJECT'] = "Notification about broken {$tableSoleName}";
444
        }
445
        if (1 == $tableComment) {
446
            $getDefinesNotif['NOTIFY_' . $stuTableSoleName . '_COMMENT']         = "{$ucfTableSoleName} comment";
447
            $getDefinesNotif['NOTIFY_' . $stuTableSoleName . '_COMMENT_CAPTION'] = "Notify me about comments for {$tableSoleName}";
448
            $getDefinesNotif['NOTIFY_' . $stuTableSoleName . '_COMMENT_SUBJECT'] = "Notification about comments for {$tableSoleName}";
449
        }
450
        foreach ($getDefinesNotif as $defn => $descn) {
451
            $ret .= $this->ld->getDefine($language, $defn, $descn);
452
        }
453
454
        return $ret;
455
    }
456
457
    /**
458
     * @private function getLanguagePermissionsGroups
459
     * @param $language
460
     *
461
     * @return string
462
     */
463
    private function getLanguagePermissionsGroups($language)
464
    {
465
        $ret = $this->ld->getAboveDefines('Permissions Groups');
466
        $ret .= $this->ld->getDefine($language, 'GROUPS', 'Groups access');
467
        $ret .= $this->ld->getDefine($language, 'GROUPS_DESC', 'Select general access permission for groups.');
468
        $ret .= $this->ld->getDefine($language, 'ADMIN_GROUPS', 'Admin Group Permissions');
469
        $ret .= $this->ld->getDefine($language, 'ADMIN_GROUPS_DESC', 'Which groups have access to tools and permissions page');
470
        $ret .= $this->ld->getDefine($language, 'UPLOAD_GROUPS', 'Upload Group Permissions');
471
        $ret .= $this->ld->getDefine($language, 'UPLOAD_GROUPS_DESC', 'Which groups have permissions to upload files');
472
473
        return $ret;
474
    }
475
476
477
    /**
478
     * @private function getLanguagePermissionsGroups
479
     * @param $language
480
     *
481
     * @return string
482
     */
483
    private function getLanguageRatingbars($language)
484
    {
485
        $ret = $this->ld->getAboveDefines('Rating bars');
486
        $ret .= $this->ld->getDefine($language, 'RATINGBAR_GROUPS', 'Groups with rating rights');
487
        $ret .= $this->ld->getDefine($language, 'RATINGBAR_GROUPS_DESC', 'Select groups which should have the right to rate');
488
        $ret .= $this->ld->getDefine($language, 'RATINGBARS', 'Allow rating');
489
        $ret .= $this->ld->getDefine($language, 'RATINGBARS_DESC', 'Define whether rating should be possible and which kind of rating should be used');
490
        $ret .= $this->ld->getDefine($language, 'RATING_NONE', 'Do not use rating');
491
        $ret .= $this->ld->getDefine($language, 'RATING_5STARS', 'Rating with 5 stars');
492
        $ret .= $this->ld->getDefine($language, 'RATING_10STARS', 'Rating with 10 stars');
493
        $ret .= $this->ld->getDefine($language, 'RATING_LIKES', 'Rating with likes and dislikes');
494
        $ret .= $this->ld->getDefine($language, 'RATING_10NUM', 'Rating with 10 points');
495
496
        return $ret;
497
    }
498
499
    /**
500
     * @private function getFooter
501
     * @param null
502
     * @return string
503
     */
504
    private function getLanguageFooter()
505
    {
506
        $ret = $this->ld->getBelowDefines('End');
507
        $ret .= $this->ld->getBlankLine();
508
509
        return $ret;
510
    }
511
512
    /**
513
     * @public function render
514
     * @param null
515
     * @return bool|string
516
     */
517
    public function render()
518
    {
519
        $module             = $this->getModule();
520
        $tables             = $this->getTableTables($module->getVar('mod_id'));
521
        $filename           = $this->getFileName();
522
        $moduleDirname      = $module->getVar('mod_dirname');
523
        $language           = $this->getLanguage($moduleDirname, 'MI', '', false);
0 ignored issues
show
false of type false is incompatible with the type string expected by parameter $addFq of XoopsModules\Modulebuild...eateFile::getLanguage(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

523
        $language           = $this->getLanguage($moduleDirname, 'MI', '', /** @scrutinizer ignore-type */ false);
Loading history...
524
        $tableAdmin         = [];
525
        $tableUser          = [];
526
        $tableSubmenu       = [];
527
        $tableBlocks        = [];
528
        $tableNotifications = [];
529
        $tablePermissions   = [];
530
        $notifTable         = '';
531
        $tableBrokens       = [];
532
        $tableComments      = [];
533
        $tableRate          = [];
534
        foreach (\array_keys($tables) as $t) {
535
            $tableName            = $tables[$t]->getVar('table_name');
536
            $tableSoleName        = $tables[$t]->getVar('table_solename');
537
            $tableAdmin[]         = $tables[$t]->getVar('table_admin');
538
            $tableUser[]          = $tables[$t]->getVar('table_user');
539
            $tableSubmenu[]       = $tables[$t]->getVar('table_submenu');
540
            $tableBlocks[]        = $tables[$t]->getVar('table_blocks');
541
            $tableNotifications[] = $tables[$t]->getVar('table_notifications');
542
            $tableBroken          = $tables[$t]->getVar('table_broken');
543
            $tableBrokens[]       = $tables[$t]->getVar('table_broken');
544
            $tableComment         = $tables[$t]->getVar('table_comments');
545
            $tableComments[]      = $tables[$t]->getVar('table_comments');
546
            $tableRate[]          = $tables[$t]->getVar('table_rate');
547
            $tablePermissions[]   = $tables[$t]->getVar('table_permissions');
548
            if (1 === (int)$tables[$t]->getVar('table_notifications')) {
549
                $notifTable .= $this->getLanguageNotificationsTable($language, $tableName, $tableSoleName, $tableBroken, $tableComment);
550
            }
551
552
        }
553
554
        $content       = $this->getHeaderFilesComments($module);
555
        $content       .= $this->getLanguageMain($language, $module);
556
        $content       .= $this->getLanguageMenu($module, $language);
557
        if (\in_array(1, $tableAdmin)) {
558
            $content .= $this->getLanguageAdmin($language);
559
        }
560
        if (\in_array(1, $tableUser)) {
561
            $content .= $this->getLanguageUser($language);
562
        }
563
        if (\in_array(1, $tableSubmenu)) {
564
            $content .= $this->getLanguageSubmenu($language, $tables);
565
        }
566
        if (\in_array(1, $tableRate)) {
567
            $content .= $this->getLanguageRatingbars($language);
568
        }
569
570
        if (\in_array(1, $tableBlocks)) {
571
            $content .= $this->getLanguageBlocks($tables, $language);
572
        }
573
        $content .= $this->getLanguageConfig($language, $tables);
574
        if (\in_array(1, $tableNotifications)) {
575
            $content .= $this->getLanguageNotificationsGlobal($language, \in_array(1, $tableBrokens), \in_array(1, $tableComments));
576
            $content .= $notifTable;
577
        }
578
        if (\in_array(1, $tablePermissions)) {
579
            $content .= $this->getLanguagePermissionsGroups($language);
580
        }
581
        $content .= $this->getLanguageFooter();
582
583
        $this->create($moduleDirname, 'language/' . $GLOBALS['xoopsConfig']['language'], $filename, $content, \_AM_MODULEBUILDER_FILE_CREATED, \_AM_MODULEBUILDER_FILE_NOTCREATED);
584
585
        return $this->renderFile();
586
    }
587
}
588