LanguageModinfo::getLanguageConfig()   F
last analyzed

Complexity

Conditions 13
Paths 608

Size

Total Lines 92
Code Lines 67

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 13
eloc 67
nc 608
nop 2
dl 0
loc 92
rs 3.1155
c 0
b 0
f 0

How to fix   Long Method    Complexity   

Long Method

Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.

For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.

Commonly applied refactorings include:

1
<?php
2
3
namespace XoopsModules\Tdmcreate\Files\Language;
4
5
use XoopsModules\Tdmcreate;
6
use XoopsModules\Tdmcreate\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
 * tdmcreate 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  = Tdmcreate\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               = Tdmcreate\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
        foreach (array_keys($tables) as $i) {
115
            ++$menu;
116
            $tablePermissions[] = $tables[$i]->getVar('table_permissions');
117
            $ucfTableName       = ucfirst($tables[$i]->getVar('table_name'));
118
            $ret                .= $df->getDefine($language, "ADMENU{$menu}", $ucfTableName);
119
        }
120
        if (in_array(1, $tablePermissions)) {
121
            ++$menu;
122
            $ret .= $df->getDefine($language, "ADMENU{$menu}", 'Permissions');
123
        }
124
        ++$menu;
125
        $ret .= $df->getDefine($language, "ADMENU{$menu}", 'Feedback');
126
        $ret .= $df->getDefine($language, 'ABOUT', 'About');
127
        unset($menu, $tablePermissions);
128
129
        return $ret;
130
    }
131
132
    /**
133
     * @private function getLanguageAdmin
134
     * @param $language
135
     *
136
     * @return string
137
     */
138
    private function getLanguageAdmin($language)
139
    {
140
        $df  = LanguageDefines::getInstance();
141
        $ret = $df->getAboveHeadDefines('Admin Nav');
142
        $ret .= $df->getDefine($language, 'ADMIN_PAGER', 'Admin pager');
143
        $ret .= $df->getDefine($language, 'ADMIN_PAGER_DESC', 'Admin per page list');
144
145
        return $ret;
146
    }
147
148
    /**
149
     * @private function getLanguageSubmenu
150
     * @param       $language
151
     * @param array $tables
152
     *
153
     * @return string
154
     */
155
    private function getLanguageSubmenu($language, $tables)
156
    {
157
        $df          = LanguageDefines::getInstance();
158
        $ret         = $df->getAboveDefines('Submenu');
159
        $ret         .= $df->getDefine($language, 'SMNAME1', 'Index page');
160
        $i           = 1;
161
        $tableSubmit = [];
162
        $tableSearch = [];
163
        foreach (array_keys($tables) as $t) {
164
            $tableName     = $tables[$t]->getVar('table_name');
165
            $tableSubmit[] = $tables[$t]->getVar('table_submit');
166
            $tableSearch[] = $tables[$t]->getVar('table_search');
167
            $desc          = ucfirst(mb_strtolower($tableName));
168
            if (1 == $tables[$t]->getVar('table_submenu')) {
169
                $ret .= $df->getDefine($language, "SMNAME{$i}", $desc);
170
            }
171
            ++$i;
172
        }
173
        if (in_array(1, $tableSubmit)) {
174
            $ret .= $df->getDefine($language, "SMNAME{$i}", 'Submit');
175
            ++$i;
176
        }
177
        if (in_array(1, $tableSearch)) {
178
            $ret .= $df->getDefine($language, "SMNAME{$i}", 'Search');
179
        }
180
        unset($i, $tableSubmit);
181
182
        return $ret;
183
    }
184
185
    /**
186
     * @private function getLanguageBlocks
187
     * @param       $language
188
     * @param array $tables
189
     *
190
     * @return string
191
     */
192
    private function getLanguageBlocks($tables, $language)
193
    {
194
        $df  = LanguageDefines::getInstance();
195
        $ret = $df->getAboveDefines('Blocks');
196
        foreach (array_keys($tables) as $i) {
197
            $tableName        = $tables[$i]->getVar('table_name');
198
            $stuTableName     = mb_strtoupper($tableName);
199
            $tableSoleName    = $tables[$i]->getVar('table_solename');
200
            $stuTableSoleName = mb_strtoupper($tableSoleName);
201
            $ucfTableName     = ucfirst($tableName);
202
            $ucfTableSoleName = ucfirst($stuTableSoleName);
203
204
            $ret .= $df->getDefine($language, "{$stuTableName}_BLOCK", "{$ucfTableName} block");
205
            $ret .= $df->getDefine($language, "{$stuTableName}_BLOCK_DESC", "{$ucfTableName} block description");
206
            if (1 == $tables[$i]->getVar('table_category')) {
207
                $ret .= $df->getDefine($language, "{$stuTableName}_BLOCK_{$stuTableSoleName}", "{$ucfTableName} block {$ucfTableSoleName}");
208
                $ret .= $df->getDefine($language, "{$stuTableName}_BLOCK_{$stuTableSoleName}_DESC", "{$ucfTableName} block {$ucfTableSoleName} description");
209
            } else {
210
                $ret .= $df->getDefine($language, "{$stuTableName}_BLOCK_{$stuTableSoleName}", "{$ucfTableName} block  {$ucfTableSoleName}");
211
                $ret .= $df->getDefine($language, "{$stuTableName}_BLOCK_{$stuTableSoleName}_DESC", "{$ucfTableName} block  {$ucfTableSoleName} description");
212
                $ret .= $df->getDefine($language, "{$stuTableName}_BLOCK_LAST", "{$ucfTableName} block last");
213
                $ret .= $df->getDefine($language, "{$stuTableName}_BLOCK_LAST_DESC", "{$ucfTableName} block last description");
214
                $ret .= $df->getDefine($language, "{$stuTableName}_BLOCK_NEW", "{$ucfTableName} block new");
215
                $ret .= $df->getDefine($language, "{$stuTableName}_BLOCK_NEW_DESC", "{$ucfTableName} block new description");
216
                $ret .= $df->getDefine($language, "{$stuTableName}_BLOCK_HITS", "{$ucfTableName} block hits");
217
                $ret .= $df->getDefine($language, "{$stuTableName}_BLOCK_HITS_DESC", "{$ucfTableName} block hits description");
218
                $ret .= $df->getDefine($language, "{$stuTableName}_BLOCK_TOP", "{$ucfTableName} block top");
219
                $ret .= $df->getDefine($language, "{$stuTableName}_BLOCK_TOP_DESC", "{$ucfTableName} block top description");
220
                $ret .= $df->getDefine($language, "{$stuTableName}_BLOCK_RANDOM", "{$ucfTableName} block random");
221
                $ret .= $df->getDefine($language, "{$stuTableName}_BLOCK_RANDOM_DESC", "{$ucfTableName} block random description");
222
            }
223
        }
224
225
        return $ret;
226
    }
227
228
    /**
229
     * @private function getLanguageUser
230
     * @param $language
231
     *
232
     * @return string
233
     */
234
    private function getLanguageUser($language)
235
    {
236
        $df  = LanguageDefines::getInstance();
237
        $ret = $df->getAboveDefines('User');
238
        $ret .= $df->getDefine($language, 'USER_PAGER', 'User pager');
239
        $ret .= $df->getDefine($language, 'USER_PAGER_DESC', 'User per page list');
240
241
        return $ret;
242
    }
243
244
    /**
245
     * @private function getLanguageConfig
246
     * @param $language
247
     * @param $tables
248
     *
249
     * @return string
250
     */
251
    private function getLanguageConfig($language, $tables)
252
    {
253
        $df         = LanguageDefines::getInstance();
254
        $ret        = $df->getAboveDefines('Config');
255
        $fieldImage = false;
256
        $fieldFile  = false;
257
        $useTag     = false;
258
        // $usePermissions = false;
259
        foreach (array_keys($tables) as $i) {
260
            $fields = $this->getTableFields($tables[$i]->getVar('table_mid'), $tables[$i]->getVar('table_id'));
261
            foreach (array_keys($fields) as $f) {
262
                $fieldElement = $fields[$f]->getVar('field_element');
263
                if (4 == $fieldElement) {
264
                    $fieldName    = $fields[$f]->getVar('field_name');
265
                    $rpFieldName  = $this->getRightString($fieldName);
266
                    $ucfFieldName = ucfirst($rpFieldName);
267
                    $stuFieldName = mb_strtoupper($rpFieldName);
268
                    $ret          .= $df->getDefine($language, 'EDITOR_' . $stuFieldName, 'Editor');
269
                    $ret          .= $df->getDefine($language, 'EDITOR_' . $stuFieldName . '_DESC', 'Select the Editor ' . $ucfFieldName . ' to use');
270
                }
271
                if (13 == $fieldElement) {
272
                    $fieldImage = true;
273
                }
274
				if (14 == $fieldElement) {
275
                    $fieldFile = true;
276
                }
277
            }
278
            if (0 != $tables[$i]->getVar('table_tag')) {
279
                $useTag = true;
280
            }
281
            // if (0 != $tables[$i]->getVar('table_permissions')) {$usePermissions = true;}
282
        }
283
        $ret .= $df->getDefine($language, 'KEYWORDS', 'Keywords');
284
        $ret .= $df->getDefine($language, 'KEYWORDS_DESC', 'Insert here the keywords (separate by comma)');
285
        /*if (usePermissions) {
286
            $ret .= $df->getDefine($language, "GROUPS", "Groups");
287
            $ret .= $df->getDefine($language, "GROUPS_DESC", "Groups to have permissions");
288
            $ret .= $df->getDefine($language, "ADMIN_GROUPS", "Admin Groups");
289
            $ret .= $df->getDefine($language, "ADMIN_GROUPS_DESC", "Admin Groups to have permissions access");
290
        }*/
291
292
        if ($fieldImage || $fieldFile) {
293
            $ret .= $df->getDefine($language, 'SIZE_MB', 'MB');
294
        }
295
        if ($fieldImage) {
296
            $ret .= $df->getDefine($language, 'MAXSIZE_IMAGE', 'Max size image');
297
            $ret .= $df->getDefine($language, 'MAXSIZE_IMAGE_DESC', 'Define the max size for uploading images');
298
            $ret .= $df->getDefine($language, 'MIMETYPES_IMAGE', 'Mime types image');
299
            $ret .= $df->getDefine($language, 'MIMETYPES_IMAGE_DESC', 'Define the allowed mime types for uploading images');
300
            $ret .= $df->getDefine($language, 'MAXWIDTH_IMAGE', 'Max width image');
301
            $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');
302
            $ret .= $df->getDefine($language, 'MAXHEIGHT_IMAGE', 'Max height image');
303
            $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');
304
			//MB define
305
        }
306
		if ($fieldFile) {
307
            $ret .= $df->getDefine($language, 'MAXSIZE_FILE', 'Max size file');
308
            $ret .= $df->getDefine($language, 'MAXSIZE_FILE_DESC', 'Define the max size for uploading files');
309
            $ret .= $df->getDefine($language, 'MIMETYPES_FILE', 'Mime types file');
310
            $ret .= $df->getDefine($language, 'MIMETYPES_FILE_DESC', 'Define the allowed mime types for uploading files');
311
        }
312
        if ($useTag) {
313
            $ret .= $df->getDefine($language, 'USE_TAG', 'Use TAG');
314
            $ret .= $df->getDefine($language, 'USE_TAG_DESC', 'If you use tag module, check this option to yes');
315
        }
316
        $getDefinesConf = [
317
            'NUMB_COL'               => 'Number Columns',
318
            'NUMB_COL_DESC'          => 'Number Columns to View.',
319
            'DIVIDEBY'               => 'Divide By',
320
            'DIVIDEBY_DESC'          => 'Divide by columns number.',
321
            'TABLE_TYPE'             => 'Table Type',
322
            'TABLE_TYPE_DESC'        => 'Table Type is the bootstrap html table.',
323
            'PANEL_TYPE'             => 'Panel Type',
324
            'PANEL_TYPE_DESC'        => 'Panel Type is the bootstrap html div.',
325
            'IDPAYPAL'               => 'Paypal ID',
326
            'IDPAYPAL_DESC'          => 'Insert here your PayPal ID for donactions.',
327
            'ADVERTISE'              => 'Advertisement Code',
328
            'ADVERTISE_DESC'         => 'Insert here the advertisement code',
329
            'MAINTAINEDBY'           => 'Maintained By',
330
            'MAINTAINEDBY_DESC'      => 'Allow url of support site or community',
331
            'BOOKMARKS'              => 'Social Bookmarks',
332
            'BOOKMARKS_DESC'         => 'Show Social Bookmarks in the single page',
333
            'FACEBOOK_COMMENTS'      => 'Facebook comments',
334
            'FACEBOOK_COMMENTS_DESC' => 'Allow Facebook comments in the single page',
335
            'DISQUS_COMMENTS'        => 'Disqus comments',
336
            'DISQUS_COMMENTS_DESC'   => 'Allow Disqus comments in the single page',
337
        ];
338
        foreach ($getDefinesConf as $defc => $descc) {
339
            $ret .= $df->getDefine($language, $defc, $descc);
340
        }
341
342
        return $ret;
343
    }
344
345
    /**
346
     * @private function getLanguageNotifications
347
     * @param       $language
348
     * @param mixed $tableSoleName
349
     *
350
     * @return string
351
     */
352
    private function getLanguageNotifications($language, $tableSoleName)
353
    {
354
        $df               = LanguageDefines::getInstance();
355
        $ret              = $df->getAboveDefines('Notifications');
356
        $stuTableSoleName = mb_strtoupper($tableSoleName);
357
        $ucfTableSoleName = ucfirst($tableSoleName);
358
        $getDefinesNotif  = [
359
            'GLOBAL_NOTIFY'                  => 'Global notify',
360
            'GLOBAL_NOTIFY_DESC'             => 'Global notify desc',
361
            'GLOBAL_MODIFY_NOTIFY'           => 'Global modify notify',
362
            'GLOBAL_MODIFY_NOTIFY_CAPTION'   => 'Global modify notify caption',
363
            'GLOBAL_MODIFY_NOTIFY_DESC'      => 'Global modify notify desc',
364
            'GLOBAL_MODIFY_NOTIFY_SUBJECT'   => 'Global modify notify subject',
365
            'GLOBAL_BROKEN_NOTIFY'           => 'Global broken notify',
366
            'GLOBAL_BROKEN_NOTIFY_CAPTION'   => 'Global broken notify caption',
367
            'GLOBAL_BROKEN_NOTIFY_DESC'      => 'Global broken notify desc',
368
            'GLOBAL_BROKEN_NOTIFY_SUBJECT'   => 'Global broken notify subject',
369
            'GLOBAL_SUBMIT_NOTIFY'           => 'Global submit notify',
370
            'GLOBAL_SUBMIT_NOTIFY_CAPTION'   => 'Global submit notify caption',
371
            'GLOBAL_SUBMIT_NOTIFY_DESC'      => 'Global submit notify desc',
372
            'GLOBAL_SUBMIT_NOTIFY_SUBJECT'   => 'Global submit notify subject',
373
            'GLOBAL_NEW_NOTIFY'              => 'Global new notify',
374
            'GLOBAL_NEW_NOTIFY_CAPTION'      => 'Global new notify caption',
375
            'GLOBAL_NEW_NOTIFY_DESC'         => 'Global new notify desc',
376
            'GLOBAL_NEW_NOTIFY_SUBJECT'      => 'Global new notify subject',
377
            'CATEGORY_NOTIFY'                => 'Category notify',
378
            'CATEGORY_NOTIFY_DESC'           => 'Category notify desc',
379
            'CATEGORY_NOTIFY_CAPTION'        => 'Category notify caption',
380
            'CATEGORY_NOTIFY_SUBJECT'        => 'Category notify Subject',
381
            'CATEGORY_SUBMIT_NOTIFY'         => 'Category submit notify',
382
            'CATEGORY_SUBMIT_NOTIFY_CAPTION' => 'Category submit notify caption',
383
            'CATEGORY_SUBMIT_NOTIFY_DESC'    => 'Category submit notify desc',
384
            'CATEGORY_SUBMIT_NOTIFY_SUBJECT' => 'Category submit notify subject',
385
            $stuTableSoleName . '_NOTIFY'         => $ucfTableSoleName . ' notify',
386
            $stuTableSoleName . '_NOTIFY_DESC'    => $ucfTableSoleName . ' notify desc',
387
            $stuTableSoleName . '_NOTIFY_CAPTION' => $ucfTableSoleName . ' notify caption',
388
            $stuTableSoleName . '_NOTIFY_SUBJECT' => $ucfTableSoleName . ' notify subject',
389
            'GLOBAL_NEW_CATEGORY_NOTIFY'          => 'Global newcategory notify',
390
            'GLOBAL_NEW_CATEGORY_NOTIFY_CAPTION'  => 'Global newcategory notify caption',
391
            'GLOBAL_NEW_CATEGORY_NOTIFY_DESC'     => 'Global newcategory notify desc',
392
            'GLOBAL_NEW_CATEGORY_NOTIFY_SUBJECT'  => 'Global newcategory notify subject',
393
            'GLOBAL_' . $stuTableSoleName . '_MODIFY_NOTIFY'           => 'Global ' . $tableSoleName . ' modify notify',
394
            'GLOBAL_' . $stuTableSoleName . '_MODIFY_NOTIFY_CAPTION'   => 'Global ' . $tableSoleName . ' modify notify caption',
395
            'GLOBAL_' . $stuTableSoleName . '_MODIFY_NOTIFY_DESC'      => 'Global ' . $tableSoleName . ' modify notify desc',
396
            'GLOBAL_' . $stuTableSoleName . '_MODIFY_NOTIFY_SUBJECT'   => 'Global ' . $tableSoleName . ' modify notify subject',
397
            'GLOBAL_' . $stuTableSoleName . '_BROKEN_NOTIFY'           => 'Global ' . $tableSoleName . ' broken notify',
398
            'GLOBAL_' . $stuTableSoleName . '_BROKEN_NOTIFY_CAPTION'   => 'Global ' . $tableSoleName . ' broken notify caption',
399
            'GLOBAL_' . $stuTableSoleName . '_BROKEN_NOTIFY_DESC'      => 'Global ' . $tableSoleName . ' broken notify desc',
400
            'GLOBAL_' . $stuTableSoleName . '_BROKEN_NOTIFY_SUBJECT'   => 'Global ' . $tableSoleName . ' broken notify subject',
401
            'GLOBAL_' . $stuTableSoleName . '_SUBMIT_NOTIFY'           => 'Global ' . $tableSoleName . ' submit notify',
402
            'GLOBAL_' . $stuTableSoleName . '_SUBMIT_NOTIFY_CAPTION'   => 'Global ' . $tableSoleName . ' submit notify caption',
403
            'GLOBAL_' . $stuTableSoleName . '_SUBMIT_NOTIFY_DESC'      => 'Global ' . $tableSoleName . ' submit notify desc',
404
            'GLOBAL_' . $stuTableSoleName . '_SUBMIT_NOTIFY_SUBJECT'   => 'Global ' . $tableSoleName . ' submit notify subject',
405
            'GLOBAL_NEW_' . $stuTableSoleName . '_NOTIFY'              => 'Global new ' . $tableSoleName . ' notify',
406
            'GLOBAL_NEW_' . $stuTableSoleName . '_NOTIFY_CAPTION'      => 'Global new ' . $tableSoleName . ' notify caption',
407
            'GLOBAL_NEW_' . $stuTableSoleName . '_NOTIFY_DESC'         => 'Global new ' . $tableSoleName . ' notify desc',
408
            'GLOBAL_NEW_' . $stuTableSoleName . '_NOTIFY_SUBJECT'      => 'Global new ' . $tableSoleName . ' notify subject',
409
            'CATEGORY_' . $stuTableSoleName . '_SUBMIT_NOTIFY'         => 'Category ' . $tableSoleName . ' submit notify',
410
            'CATEGORY_' . $stuTableSoleName . '_SUBMIT_NOTIFY_CAPTION' => 'Category ' . $tableSoleName . ' submit notify caption',
411
            'CATEGORY_' . $stuTableSoleName . '_SUBMIT_NOTIFY_DESC'    => 'Category ' . $tableSoleName . ' submit notify desc',
412
            'CATEGORY_' . $stuTableSoleName . '_SUBMIT_NOTIFY_SUBJECT' => 'Category ' . $tableSoleName . ' submit notify subject',
413
            'CATEGORY_NEW_' . $stuTableSoleName . '_NOTIFY'            => 'Category new ' . $tableSoleName . ' notify',
414
            'CATEGORY_NEW_' . $stuTableSoleName . '_NOTIFY_CAPTION'    => 'Category new ' . $tableSoleName . ' notify caption',
415
            'CATEGORY_NEW_' . $stuTableSoleName . '_NOTIFY_DESC'       => 'Category new ' . $tableSoleName . ' notify desc',
416
            'CATEGORY_NEW_' . $stuTableSoleName . '_NOTIFY_SUBJECT'    => 'Category new ' . $tableSoleName . ' notify subject',
417
            'APPROVE_NOTIFY'                      => $ucfTableSoleName . ' approve notify',
418
            'APPROVE_NOTIFY_CAPTION'              => $ucfTableSoleName . ' approve notify caption',
419
            'APPROVE_NOTIFY_DESC'                 => $ucfTableSoleName . ' approve notify desc',
420
            'APPROVE_NOTIFY_SUBJECT'              => $ucfTableSoleName . ' approve notify subject',
421
        ];
422
        foreach ($getDefinesNotif as $defn => $descn) {
423
            $ret .= $df->getDefine($language, $defn, $descn);
424
        }
425
426
        return $ret;
427
    }
428
429
    /**
430
     * @private function getLanguagePermissionsGroups
431
     * @param $language
432
     *
433
     * @return string
434
     */
435
    private function getLanguagePermissionsGroups($language)
436
    {
437
        $df  = LanguageDefines::getInstance();
438
        $ret = $df->getAboveDefines('Permissions Groups');
439
        $ret .= $df->getDefine($language, 'GROUPS', 'Groups access');
440
        $ret .= $df->getDefine($language, 'GROUPS_DESC', 'Select general access permission for groups.');
441
        $ret .= $df->getDefine($language, 'ADMIN_GROUPS', 'Admin Group Permissions');
442
        $ret .= $df->getDefine($language, 'ADMIN_GROUPS_DESC', 'Which groups have access to tools and permissions page');
443
        $ret .= $df->getDefine($language, 'UPLOAD_GROUPS', 'Upload Group Permissions');
444
        $ret .= $df->getDefine($language, 'UPLOAD_GROUPS_DESC', 'Which groups have permissions to upload files');
445
446
        return $ret;
447
    }
448
449
    /**
450
     * @private function getFooter
451
     * @param null
452
     * @return string
453
     */
454
    private function getLanguageFooter()
455
    {
456
        $df  = LanguageDefines::getInstance();
457
        $ret = $df->getBelowDefines('End');
458
        $ret .= $df->getBlankLine();
459
460
        return $ret;
461
    }
462
463
    /**
464
     * @public function render
465
     * @param null
466
     * @return bool|string
467
     */
468
    public function render()
469
    {
470
        $module             = $this->getModule();
471
        $tables             = $this->getTableTables($module->getVar('mod_id'));
472
        $tableAdmin         = [];
473
        $tableUser          = [];
474
        $tableSubmenu       = [];
475
        $tableBlocks        = [];
476
        $tableNotifications = [];
477
        $tablePermissions   = [];
478
        $tableSoleName      = '';
479
        foreach (array_keys($tables) as $t) {
480
            $tableSoleName        = $tables[$t]->getVar('table_solename');
481
            $tableAdmin[]         = $tables[$t]->getVar('table_admin');
482
            $tableUser[]          = $tables[$t]->getVar('table_user');
483
            $tableSubmenu[]       = $tables[$t]->getVar('table_submenu');
484
            $tableBlocks[]        = $tables[$t]->getVar('table_blocks');
485
            $tableNotifications[] = $tables[$t]->getVar('table_notifications');
486
            $tablePermissions[]   = $tables[$t]->getVar('table_permissions');
487
        }
488
        $filename      = $this->getFileName();
489
        $moduleDirname = $module->getVar('mod_dirname');
490
        $language      = $this->getLanguage($moduleDirname, 'MI');
491
        $content       = $this->getHeaderFilesComments($module);
492
        $content       .= $this->getLanguageMain($language, $module);
493
        $content       .= $this->getLanguageMenu($module, $language);
494
        if (in_array(1, $tableAdmin)) {
495
            $content .= $this->getLanguageAdmin($language);
496
        }
497
        if (in_array(1, $tableUser)) {
498
            $content .= $this->getLanguageUser($language);
499
        }
500
        if (in_array(1, $tableSubmenu)) {
501
            $content .= $this->getLanguageSubmenu($language, $tables);
502
        }
503
        //if (in_array(1, $tableBlocks)) {
504
        $content .= $this->getLanguageBlocks($tables, $language);
505
        //}
506
        $content .= $this->getLanguageConfig($language, $tables);
507
        if (in_array(1, $tableNotifications)) {
508
            $content .= $this->getLanguageNotifications($language, $tableSoleName);
509
        }
510
        if (in_array(1, $tablePermissions)) {
511
            $content .= $this->getLanguagePermissionsGroups($language);
512
        }
513
        $content .= $this->getLanguageFooter();
514
515
        $this->create($moduleDirname, 'language/' . $GLOBALS['xoopsConfig']['language'], $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED);
516
517
        return $this->renderFile();
518
    }
519
}
520