Completed
Pull Request — master (#144)
by Michael
04:15
created

CreateArchitecture::setBaseFoldersFiles()   F

Complexity

Conditions 17
Paths 4352

Size

Total Lines 106
Code Lines 70

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 17
eloc 70
nc 4352
nop 1
dl 0
loc 106
rs 1.0499
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;
4
5
use XoopsModules\Tdmcreate;
6
7
/*
8
 You may not change or alter any portion of this comment or credits
9
 of supporting developers from this source code or any supporting source code
10
 which is considered copyrighted (c) material of the original comment or credit authors.
11
12
 This program is distributed in the hope that it will be useful,
13
 but WITHOUT ANY WARRANTY; without even the implied warranty of
14
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
15
 */
16
/**
17
 * tdmcreate module.
18
 *
19
 * @copyright       XOOPS Project (https://xoops.org)
20
 * @license         GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html)
21
 *
22
 * @since           2.5.0
23
 *
24
 * @author          Txmod Xoops http://www.txmodxoops.org
25
 *
26
 */
27
28
//include dirname(__DIR__) . '/autoload.php';
29
30
/**
31
 * Class Architecture.
32
 */
33
class CreateArchitecture extends CreateStructure
34
{
35
    /**
36
     * @public function constructor class
37
     *
38
     * @param null
39
     */
40
    public function __construct()
41
    {
42
        parent::__construct();
43
        $this->setUploadPath(TDMC_UPLOAD_REPOSITORY_PATH);
44
    }
45
46
    /**
47
     * @static function getInstance
48
     *
49
     * @param null
50
     *
51
     * @return Tdmcreate\Files\CreateArchitecture
52
     */
53
    public static function getInstance()
54
    {
55
        static $instance = false;
56
        if (!$instance) {
57
            $instance = new self();
58
        }
59
60
        return $instance;
61
    }
62
63
    /**
64
     * @public function setBaseFoldersFiles
65
     *
66
     * @param $module
67
     */
68
    public function setBaseFoldersFiles($module)
69
    {
70
        $helper = Tdmcreate\Helper::getInstance();
71
        $tf     = Tdmcreate\Files\CreateFile::getInstance();
72
        // Module
73
        $modId = $module->getVar('mod_id');
74
        // Id of tables
75
        $tables = $tf->getTableTables($modId);
76
77
        $table = null;
78
        foreach (array_keys($tables) as $t) {
79
            $tableId   = $tables[$t]->getVar('table_id');
80
            $tableName = $tables[$t]->getVar('table_name');
81
            $table     = $helper->getHandler('Tables')->get($tableId);
82
        }
83
84
        $indexFile       = XOOPS_UPLOAD_PATH . '/index.html';
85
        $stlModuleAuthor = str_replace(' ', '', mb_strtolower($module->getVar('mod_author')));
86
        $this->setModuleName($module->getVar('mod_dirname'));
87
        $uploadPath = $this->getUploadPath();
88
        // Creation of "module" folder in the Directory repository
89
        $this->makeDir($uploadPath . '/' . $this->getModuleName());
90
        if (1 != $module->getVar('mod_user')) {
91
            // Copied of index.html file in "root module" folder
92
            $this->copyFile('', $indexFile, 'index.html');
93
        }
94
        if (1 == $module->getVar('mod_admin')) {
95
            // Creation of "admin" folder and index.html file
96
            $this->makeDirAndCopyFile('admin', $indexFile, 'index.html');
97
        }
98
        if (1 == $module->getVar('mod_blocks')) {
99
            // Creation of "blocks" folder and index.html file
100
            $this->makeDirAndCopyFile('blocks', $indexFile, 'index.html');
101
        }
102
        $language  = ('english' !== $GLOBALS['xoopsConfig']['language']) ? $GLOBALS['xoopsConfig']['language'] : 'english';
103
        $copyFiles = [
104
            'class'                           => $indexFile,
105
            'include'                         => $indexFile,
106
            'language'                        => $indexFile,
107
            'assets'                          => $indexFile,
108
            'assets/css'                      => $indexFile,
109
            'assets/css/admin'                => $indexFile,
110
            'assets/icons'                    => $indexFile,
111
            'assets/icons/16'                 => $indexFile,
112
            'assets/icons/32'                 => $indexFile,
113
            'docs'                            => $indexFile,
114
            'assets/images'                   => $indexFile,
115
            'assets/js'                       => $indexFile,
116
            'language/' . $language           => $indexFile,
117
            'language/' . $language . '/help' => $indexFile,
118
            'preloads'                        => $indexFile,
119
        ];
120
        foreach ($copyFiles as $k => $v) {
121
            // Creation of folders and index.html file
122
            $this->makeDirAndCopyFile($k, $v, 'index.html');
123
        }
124
        //Copy the logo of the module
125
        $modImage = str_replace(' ', '', mb_strtolower($module->getVar('mod_image')));
126
        $this->copyFile('assets/images', TDMC_UPLOAD_IMGMOD_PATH . '/' . $modImage, $modImage);
127
        // Copy of 'module_author_logo.png' file in uploads dir
128
        $logoPng     = $stlModuleAuthor . '_logo.png';
129
        $logoGifFrom = TDMC_UPLOAD_IMGMOD_PATH . '/' . $logoPng;
130
        // If file exists
131
        if (!file_exists($logoGifFrom)) {
132
            // Rename file
133
            $copyFile    = TDMC_IMAGES_LOGOS_URL . '/xoopsdevelopmentteam_logo.gif';
134
            $copyNewFile = $logoGifFrom;
135
            copy($copyFile, $copyNewFile);
136
        } else {
137
            // Copy file
138
            $copyFile    = TDMC_IMAGES_LOGOS_URL . '/' . $logoPng;
139
            $copyNewFile = $logoGifFrom;
140
            copy($copyFile, $copyNewFile);
141
        }
142
143
        // Creation of 'module_author_logo.gif' file
144
        $this->copyFile('assets/images', $copyNewFile, $logoPng);
145
        $docs = [
146
            '/credits.txt' => 'credits.txt',
147
            '/install.txt' => 'install.txt',
148
            '/lang.diff'   => 'lang.diff',
149
            '/license.txt' => 'license.txt',
150
            '/readme.txt'  => 'readme.txt',
151
        ];
152
        foreach ($docs as $k => $v) {
153
            // Creation of folder docs and .txt files
154
            $this->makeDirAndCopyFile('docs', TDMC_DOCS_PATH . $k, $v);
155
        }
156
        if (!empty($tableName)) {
157
            if (1 == $module->getVar('mod_admin') || 1 == $module->getVar('mod_user')) {
158
                // Creation of "templates" folder and index.html file
159
                $this->makeDirAndCopyFile('templates', $indexFile, 'index.html');
160
            }
161
            if (1 == $module->getVar('mod_admin')) {
162
                // Creation of "templates/admin" folder and index.html file
163
                $this->makeDirAndCopyFile('templates/admin', $indexFile, 'index.html');
164
            }
165
            if ((1 == $module->getVar('mod_blocks')) && (1 == $table->getVar('table_blocks'))) {
166
                // Creation of "templates/blocks" folder and index.html file
167
                $this->makeDirAndCopyFile('templates/blocks', $indexFile, 'index.html');
168
            }
169
            // Creation of "sql" folder and index.html file
170
            $this->makeDirAndCopyFile('sql', $indexFile, 'index.html');
171
            if ((1 == $module->getVar('mod_notifications')) && (1 == $table->getVar('table_notifications'))) {
172
                // Creation of "language/local_language/mail_template" folder and index.html file
173
                $this->makeDirAndCopyFile('language/' . $language . '/mail_template', $indexFile, 'index.html');
174
            }
175
        }
176
    }
177
178
    /**
179
     * @public function setFilesToBuilding
180
     *
181
     * @param string $module
182
     *
183
     * @return array
184
     */
185
    public function setFilesToBuilding($module)
186
    {
187
        $helper = Tdmcreate\Helper::getInstance();
188
        $tf     = Tdmcreate\Files\CreateFile::getInstance();
189
        // Module
190
        $modId         = $module->getVar('mod_id');
191
        $moduleDirname = $module->getVar('mod_dirname');
192
        $icon32        = 'assets/icons/32';
193
        $tables        = $tf->getTableTables($modId);
194
        $files         = $tf->getTableMoreFiles($modId);
195
        $ret           = [];
196
197
        $table              = [];
198
        $tableCategory      = [];
199
        $tableName          = [];
0 ignored issues
show
Unused Code introduced by
The assignment to $tableName is dead and can be removed.
Loading history...
200
        $tableAdmin         = [];
201
        $tableUser          = [];
202
        $tableBlocks        = [];
203
        $tableSearch        = [];
204
        $tableComments      = [];
205
        $tableNotifications = [];
206
        $tablePermissions   = [];
207
        $tableBroken        = [];
208
        $tablePdf           = [];
209
        $tablePrint         = [];
210
        $tableRate          = [];
211
        $tableRss           = [];
212
        $tableSingle        = [];
213
        $tableSubmit        = [];
214
        $tableVisit         = [];
215
        $tableTag           = [];
216
        foreach (array_keys($tables) as $t) {
217
            $tableId              = $tables[$t]->getVar('table_id');
218
            $tableName            = $tables[$t]->getVar('table_name');
219
            $tableCategory[]      = $tables[$t]->getVar('table_category');
220
            $tableImage           = $tables[$t]->getVar('table_image');
221
            $tableAdmin[]         = $tables[$t]->getVar('table_admin');
222
            $tableUser[]          = $tables[$t]->getVar('table_user');
223
            $tableBlocks[]        = $tables[$t]->getVar('table_blocks');
224
            $tableSearch[]        = $tables[$t]->getVar('table_search');
225
            $tableComments[]      = $tables[$t]->getVar('table_comments');
226
            $tableNotifications[] = $tables[$t]->getVar('table_notifications');
227
            $tablePermissions[]   = $tables[$t]->getVar('table_permissions');
228
            $tableBroken[]        = $tables[$t]->getVar('table_broken');
229
            $tablePdf[]           = $tables[$t]->getVar('table_pdf');
230
            $tablePrint[]         = $tables[$t]->getVar('table_print');
231
            $tableRate[]          = $tables[$t]->getVar('table_rate');
232
            $tableRss[]           = $tables[$t]->getVar('table_rss');
233
            $tableSingle[]        = $tables[$t]->getVar('table_single');
234
            $tableSubmit[]        = $tables[$t]->getVar('table_submit');
235
            $tableVisit[]         = $tables[$t]->getVar('table_visit');
236
            $tableTag[]           = $tables[$t]->getVar('table_tag');
237
            // Get Table Object
238
            $table = $helper->getHandler('Tables')->get($tableId);
239
            // Copy of tables images file
240
            if (file_exists($uploadTableImage = TDMC_UPLOAD_IMGTAB_PATH . '/' . $tableImage)) {
241
                $this->copyFile($icon32, $uploadTableImage, $tableImage);
242
            } elseif (file_exists($uploadTableImage = XOOPS_ICONS32_PATH . '/' . $tableImage)) {
243
                $this->copyFile($icon32, $uploadTableImage, $tableImage);
244
            }
245
            // Creation of admin files
246
            if (in_array(1, $tableAdmin)) {
247
                // Admin Pages File
248
                $adminPages = Tdmcreate\Files\Admin\AdminPages::getInstance();
249
                $adminPages->write($module, $table, $tableName . '.php');
250
                $ret[] = $adminPages->render();
251
                // Admin Templates File
252
                $adminTemplatesPages = Tdmcreate\Files\Templates\Admin\TemplatesAdminPages::getInstance();
253
                $adminTemplatesPages->write($module, $table, $moduleDirname . '_admin_' . $tableName . '.tpl');
254
                $ret[] = $adminTemplatesPages->render();
255
            }
256
            // Creation of blocks
257
            if (in_array(1, $tableBlocks)) {
258
                // Blocks Files
259
                $blocksFiles = Tdmcreate\Files\Blocks\BlocksFiles::getInstance();
260
                $blocksFiles->write($module, $table, $tableName . '.php');
261
                $ret[] = $blocksFiles->render();
262
                // Templates Blocks Files
263
                $templatesBlocks = Tdmcreate\Files\Templates\Blocks\TemplatesBlocks::getInstance();
264
                $templatesBlocks->write($module, $table, $moduleDirname . '_block_' . $tableName . '.tpl');
265
                $ret[] = $templatesBlocks->render();
266
            }
267
            // Creation of classes
268
            if (in_array(1, $tableAdmin, true) || in_array(1, $tableUser)) {
269
                // Class Files
270
                $classFiles = Tdmcreate\Files\Classes\ClassFiles::getInstance();
271
                $classFiles->write($module, $table, $tables, $tableName . '.php');
0 ignored issues
show
Bug introduced by
$table of type XoopsObject is incompatible with the type string expected by parameter $table of XoopsModules\Tdmcreate\F...ses\ClassFiles::write(). ( Ignorable by Annotation )

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

271
                $classFiles->write($module, /** @scrutinizer ignore-type */ $table, $tables, $tableName . '.php');
Loading history...
272
                $ret[] = $classFiles->render();
273
            }
274
            // Creation of user files
275
            if (in_array(1, $tableUser)) {
276
                // User Pages File
277
                $userPages = Tdmcreate\Files\User\UserPages::getInstance();
278
                $userPages->write($module, $table, $tableName . '.php');
279
                $ret[] = $userPages->render();
280
                if (in_array(0, $tableCategory)) {
281
                    // User Templates File
282
                    $userTemplatesPages = Tdmcreate\Files\Templates\User\Pages::getInstance();
283
                    $userTemplatesPages->write($module, $table, $moduleDirname . '_' . $tableName . '.tpl');
284
                    $ret[] = $userTemplatesPages->render();
285
                    // User List Templates File
286
                    $userTemplatesPagesList = Tdmcreate\Files\Templates\User\PagesList::getInstance();
287
                    $userTemplatesPagesList->write($module, $table, $tables, $moduleDirname . '_' . $tableName . '_list' . '.tpl');
288
                    $ret[] = $userTemplatesPagesList->render();
289
                }
290
                if (in_array(1, $tableCategory)) {
291
                    // User List Templates File
292
                    $userTemplatesCategories = Templates\User\Categories::getInstance();
293
                    $userTemplatesCategories->write($module, $table, $moduleDirname . '_' . $tableName . '.tpl');
294
                    $ret[] = $userTemplatesCategories->render();
295
                    // User List Templates File
296
                    $userTemplatesCategoriesList = Templates\User\CategoriesList::getInstance();
297
                    $userTemplatesCategoriesList->write($module, $table, $moduleDirname . '_' . $tableName . '_list' . '.tpl');
298
                    $ret[] = $userTemplatesCategoriesList->render();
299
                }
300
            }
301
        }
302
        foreach (array_keys($files) as $t) {
303
            $fileName      = $files[$t]->getVar('file_name');
304
            $fileExtension = $files[$t]->getVar('file_extension');
305
            $fileInfolder  = $files[$t]->getVar('file_infolder');
306
            // More File
307
            $moreFiles = Tdmcreate\MoreFiles::getInstance();
308
            $moreFiles->write($module, $fileName, $fileInfolder, $fileExtension);
0 ignored issues
show
Bug introduced by
The method write() does not exist on XoopsModules\Tdmcreate\MoreFiles. Since you implemented __call, consider adding a @method annotation. ( Ignorable by Annotation )

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

308
            $moreFiles->/** @scrutinizer ignore-call */ 
309
                        write($module, $fileName, $fileInfolder, $fileExtension);
Loading history...
309
            $ret[] = $moreFiles->render();
0 ignored issues
show
Bug introduced by
The method render() does not exist on XoopsModules\Tdmcreate\MoreFiles. Since you implemented __call, consider adding a @method annotation. ( Ignorable by Annotation )

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

309
            /** @scrutinizer ignore-call */ 
310
            $ret[] = $moreFiles->render();
Loading history...
310
        }
311
        // Language Modinfo File
312
        $languageModinfo = Tdmcreate\Files\Language\LanguageModinfo::getInstance();
313
        $languageModinfo->write($module, $table, 'modinfo.php');
314
        $ret[] = $languageModinfo->render();
315
        if (1 == $module->getVar('mod_admin')) {
316
            // Admin Header File
317
            $adminHeader = Tdmcreate\Files\Admin\AdminHeader::getInstance();
318
            $adminHeader->write($module, $table, $tables, 'header.php');
319
            $ret[] = $adminHeader->render();
320
            // Admin Index File
321
            $adminIndex = Tdmcreate\Files\Admin\AdminIndex::getInstance();
322
            $adminIndex->write($module, $tables, 'index.php');
323
            $ret[] = $adminIndex->render();
324
            // Admin Menu File
325
            $adminObject = Tdmcreate\Files\Admin\AdminMenu::getInstance();
326
            $adminObject->write($module, 'menu.php');
327
            $ret[] = $adminObject->render();
328
            // Admin About File
329
            $adminAbout = Tdmcreate\Files\Admin\AdminAbout::getInstance();
330
            $adminAbout->write($module, 'about.php');
331
            $ret[] = $adminAbout->render();
332
            // Admin Footer File
333
            $adminFooter = Tdmcreate\Files\Admin\AdminFooter::getInstance();
334
            $adminFooter->write($module, 'footer.php');
335
            $ret[] = $adminFooter->render();
336
            // Templates Admin About File
337
            $adminTemplatesAbout = Tdmcreate\Files\Templates\Admin\TemplatesAdminAbout::getInstance();
338
            $adminTemplatesAbout->write($module, $moduleDirname . '_admin_about.tpl');
339
            $ret[] = $adminTemplatesAbout->render();
340
            // Templates Admin Index File
341
            $adminTemplatesIndex = Tdmcreate\Files\Templates\Admin\TemplatesAdminIndex::getInstance();
342
            $adminTemplatesIndex->write($module, $moduleDirname . '_admin_index.tpl');
343
            $ret[] = $adminTemplatesIndex->render();
344
            // Templates Admin Footer File
345
            $adminTemplatesFooter = Tdmcreate\Files\Templates\Admin\TemplatesAdminFooter::getInstance();
346
            $adminTemplatesFooter->write($module, $moduleDirname . '_admin_footer.tpl');
347
            $ret[] = $adminTemplatesFooter->render();
348
            // Templates Admin Header File
349
            $adminTemplatesHeader = Tdmcreate\Files\Templates\Admin\TemplatesAdminHeader::getInstance();
350
            $adminTemplatesHeader->write($module, $moduleDirname . '_admin_header.tpl');
351
            $ret[] = $adminTemplatesHeader->render();
352
            // Language Admin File
353
            $languageAdmin = Tdmcreate\Files\Language\LanguageAdmin::getInstance();
354
            $languageAdmin->write($module, $table, $tables, 'admin.php');
355
            $ret[] = $languageAdmin->render();
356
        }
357
        // Class Helper File
358
        $classHelper = Tdmcreate\Files\Classes\ClassHelper::getInstance();
359
        $classHelper->write($module, 'helper.php');
360
        $ret[] = $classHelper->render();
361
        // Include Functions File
362
        $includeFunctions = Tdmcreate\Files\Includes\IncludeFunctions::getInstance();
363
        $includeFunctions->write($module, 'functions.php');
364
        $ret[] = $includeFunctions->render();
365
        // Creation of blocks language file
366
        if (null != $table->getVar('table_name')) {
367
            // Include Install File
368
            $includeInstall = Tdmcreate\Files\Includes\IncludeInstall::getInstance();
369
            $includeInstall->write($module, $table, $tables, 'install.php');
370
            $ret[] = $includeInstall->render();
371
            if (in_array(1, $tableBlocks)) {
372
                // Language Blocks File
373
                $languageBlocks = Tdmcreate\Files\Language\LanguageBlocks::getInstance();
374
                $languageBlocks->write($module, $tables, 'blocks.php');
375
                $ret[] = $languageBlocks->render();
376
            }
377
            // Creation of admin permission files
378
            if (in_array(1, $tablePermissions)) {
379
                // Admin Permissions File
380
                $adminPermissions = Tdmcreate\Files\Admin\AdminPermissions::getInstance();
381
                $adminPermissions->write($module, $tables, 'permissions.php');
382
                $ret[] = $adminPermissions->render();
383
                // Templates Admin Permissions File
384
                $adminTemplatesPermissions = Tdmcreate\Files\Templates\Admin\TemplatesAdminPermissions::getInstance();
385
                $adminTemplatesPermissions->write($module, $moduleDirname . '_admin_permissions.tpl');
386
                $ret[] = $adminTemplatesPermissions->render();
387
            }
388
            // Creation of notifications files
389
            if (in_array(1, $tableNotifications)) {
390
                // Include Notifications File
391
                $includeNotifications = Tdmcreate\Files\Includes\IncludeNotifications::getInstance();
392
                $includeNotifications->write($module, $table, 'notifications.inc.php');
393
                $ret[] = $includeNotifications->render();
394
                // Language Mail Template Category File
395
                $languageMailTpl = Tdmcreate\Files\Language\LanguageMailTpl::getInstance();
396
                $languageMailTpl->write($module, 'category_new_notify.tpl');
397
                $ret[] = $languageMailTpl->render();
398
            }
399
            // Creation of sql file
400
            if (null != $table->getVar('table_name')) {
401
                // Sql File
402
                $sqlFile = Tdmcreate\Files\Sql\SqlFile::getInstance();
403
                $sqlFile->write($module, 'mysql.sql');
404
                $ret[] = $sqlFile->render();
405
                // Include Update File
406
                $includeUpdate = Tdmcreate\Files\Includes\IncludeUpdate::getInstance();
407
                $includeUpdate->write($module, 'update.php');
408
                $ret[] = $includeUpdate->render();
409
            }
410
            // Creation of search file
411
            if (in_array(1, $tableSearch)) {
412
                // Include Search File
413
                $includeSearch = Tdmcreate\Files\Includes\IncludeSearch::getInstance();
414
                $includeSearch->write($module, $table, 'search.inc.php');
415
                $ret[] = $includeSearch->render();
416
            }
417
            // Creation of comments files
418
            if (in_array(1, $tableComments)) {
419
                // Include Comments File
420
                $includeComments = Tdmcreate\Files\Includes\IncludeComments::getInstance();
421
                $includeComments->write($module, $table);
422
                $ret[] = $includeComments->renderCommentsIncludes($module, 'comment_edit');
423
                // Include Comments File
424
                $includeComments = Tdmcreate\Files\Includes\IncludeComments::getInstance();
425
                $includeComments->write($module, $table);
426
                $ret[] = $includeComments->renderCommentsIncludes($module, 'comment_delete');
427
                // Include Comments File
428
                $includeComments = Tdmcreate\Files\Includes\IncludeComments::getInstance();
429
                $includeComments->write($module, $table);
430
                $ret[] = $includeComments->renderCommentsIncludes($module, 'comment_post');
431
                // Include Comments File
432
                $includeComments = Tdmcreate\Files\Includes\IncludeComments::getInstance();
433
                $includeComments->write($module, $table);
434
                $ret[] = $includeComments->renderCommentsIncludes($module, 'comment_reply');
435
                // Include Comments File
436
                $includeComments = Tdmcreate\Files\Includes\IncludeComments::getInstance();
437
                $includeComments->write($module, $table);
438
                $ret[] = $includeComments->renderCommentsNew($module, 'comment_new');
439
                // Include Comment Functions File
440
                $includeCommentFunctions = Tdmcreate\Files\Includes\IncludeCommentFunctions::getInstance();
441
                $includeCommentFunctions->write($module, $table, 'comment_functions.php');
442
                $ret[] = $includeCommentFunctions->render();
443
            }
444
        }
445
        // Creation of admin files
446
        if (1 == $module->getVar('mod_admin')) {
447
            // Templates Index File
448
            $userTemplatesIndex = Tdmcreate\Files\Templates\User\Index::getInstance();
449
            $userTemplatesIndex->write($module, $table, $tables, $moduleDirname . '_index.tpl');
450
            $ret[] = $userTemplatesIndex->render();
451
            // Templates Footer File
452
            $userTemplatesFooter = Tdmcreate\Files\Templates\User\Footer::getInstance();
453
            $userTemplatesFooter->write($module, $table, $moduleDirname . '_footer.tpl');
454
            $ret[] = $userTemplatesFooter->render();
455
            // Templates Header File
456
            $userTemplatesHeader = Tdmcreate\Files\Templates\User\Header::getInstance();
457
            $userTemplatesHeader->write($module, $moduleDirname . '_header.tpl');
458
            $ret[] = $userTemplatesHeader->render();
459
        }
460
        // Creation of user files
461
        if ((1 == $module->getVar('mod_user')) && in_array(1, $tableUser)) {
462
            // User Footer File
463
            $userFooter = Tdmcreate\Files\User\UserFooter::getInstance();
464
            $userFooter->write($module, 'footer.php');
465
            $ret[] = $userFooter->render();
466
            // User Header File
467
            $userHeader = Tdmcreate\Files\User\UserHeader::getInstance();
468
            $userHeader->write($module, $table, $tables, 'header.php');
469
            $ret[] = $userHeader->render();
470
            // User Notification Update File
471
            if ((1 == $module->getVar('mod_notifications')) && in_array(1, $tableNotifications)) {
472
                $userNotificationUpdate = Tdmcreate\Files\User\UserNotificationUpdate::getInstance();
473
                $userNotificationUpdate->write($module, 'notification_update.php');
474
                $ret[] = $userNotificationUpdate->render();
475
            }
476
            // User Broken File
477
            if (in_array(1, $tableBroken)) {
478
                $userBroken = Tdmcreate\Files\User\UserBroken::getInstance();
479
                $userBroken->write($module, $table, 'broken.php');
480
                $ret[] = $userBroken->render();
481
                // User Templates Broken File
482
                $userTemplatesBroken = Templates\User\Broken::getInstance();
483
                $userTemplatesBroken->write($module, $table, $moduleDirname . '_broken.tpl');
484
                $ret[] = $userTemplatesBroken->render();
485
            }
486
            // User Pdf File
487
            if (in_array(1, $tablePdf)) {
488
                $userPdf = Tdmcreate\Files\User\UserPdf::getInstance();
489
                $userPdf->write($module, $table, 'pdf.php');
490
                $ret[] = $userPdf->render();
491
                // User Templates Pdf File
492
                $userTemplatesPdf = Tdmcreate\Files\Templates\User\Pdf::getInstance();
493
                $userTemplatesPdf->write($module, $moduleDirname . '_pdf.tpl');
494
                $ret[] = $userTemplatesPdf->render();
495
            }
496
            // User Print File
497
            if (in_array(1, $tablePrint)) {
498
                $userPrint = Tdmcreate\Files\User\UserPrint::getInstance();
499
                $userPrint->write($module, $table, 'print.php');
500
                $ret[] = $userPrint->render();
501
                // User Templates Print File
502
                $userTemplatesPrint = Tdmcreate\Files\Templates\User\UserPrint::getInstance();
503
                $userTemplatesPrint->write($module, $table, $moduleDirname . '_print.tpl');
504
                $ret[] = $userTemplatesPrint->render();
505
            }
506
            // User Rate File
507
            if (in_array(1, $tableRate)) {
508
                $userRate = Tdmcreate\Files\User\UserRate::getInstance();
509
                $userRate->write($module, $table, 'rate.php');
510
                $ret[] = $userRate->render();
511
                // User Templates Rate File
512
                $userTemplatesRate = Tdmcreate\Files\Templates\User\Rate::getInstance();
513
                $userTemplatesRate->write($module, $table, $moduleDirname . '_rate.tpl');
514
                $ret[] = $userTemplatesRate->render();
515
            }
516
            // User Rss File
517
            if (in_array(1, $tableRss)) {
518
                $userRss = Tdmcreate\Files\User\UserRss::getInstance();
519
                $userRss->write($module, $table, 'rss.php');
520
                $ret[] = $userRss->render();
521
                // User Templates Rss File
522
                $userTemplatesRss = Tdmcreate\Files\Templates\User\Rss::getInstance();
523
                $userTemplatesRss->write($module, $moduleDirname . '_rss.tpl');
524
                $ret[] = $userTemplatesRss->render();
525
            }
526
            // User Single File
527
            if (in_array(1, $tableSingle)) {
528
                $userSingle = Tdmcreate\Files\User\UserSingle::getInstance();
529
                $userSingle->write($module, $table, 'single.php');
530
                $ret[] = $userSingle->render();
531
                // User Templates Single File
532
                $userTemplatesSingle = Tdmcreate\Files\Templates\User\Single::getInstance();
533
                $userTemplatesSingle->write($module, $table, $moduleDirname . '_single.tpl');
534
                $ret[] = $userTemplatesSingle->render();
535
            }
536
            // User Submit File
537
            if (in_array(1, $tableSubmit)) {
538
                $userSubmit = Tdmcreate\Files\User\UserSubmit::getInstance();
539
                $userSubmit->write($module, $table, 'submit.php');
540
                $ret[] = $userSubmit->render();
541
                // User Templates Submit File
542
                $userTemplatesSubmit = Tdmcreate\Files\Templates\User\Submit::getInstance();
543
                $userTemplatesSubmit->write($module, $table, $moduleDirname . '_submit.tpl');
544
                $ret[] = $userTemplatesSubmit->render();
545
            }// User Visit File
546
            if (in_array(1, $tableVisit)) {
547
                $userVisit = Tdmcreate\Files\User\UserVisit::getInstance();
548
                $userVisit->write($module, $table, 'visit.php');
549
                $ret[] = $userVisit->render();
550
            }
551
            // User Tag Files
552
            if (in_array(1, $tableTag)) {
553
                $userListTag = Tdmcreate\Files\User\UserListTag::getInstance();
554
                $userListTag->write($module, 'list.tag.php');
555
                $ret[]       = $userListTag->render();
556
                $userViewTag = Tdmcreate\Files\User\UserViewTag::getInstance();
557
                $userViewTag->write($module, 'view.tag.php');
558
                $ret[] = $userViewTag->render();
559
            }
560
            // User Index File
561
            $userIndex = Tdmcreate\Files\User\UserIndex::getInstance();
562
            $userIndex->write($module, $table, 'index.php');
563
            $ret[] = $userIndex->render();
564
            // Language Main File
565
            $languageMain = Tdmcreate\Files\Language\LanguageMain::getInstance();
566
            $languageMain->write($module, $tables, 'main.php');
567
            $ret[] = $languageMain->render();
568
            // User Templates Submit File
569
            $userTemplatesUserBreadcrumbs = Templates\User\Breadcrumbs::getInstance();
570
            $userTemplatesUserBreadcrumbs->write($module, $moduleDirname . '_breadcrumbs.tpl');
571
            $ret[] = $userTemplatesUserBreadcrumbs->render();
572
        }
573
        // Css Admin Styles File
574
        $cssStyles = Tdmcreate\Files\Assets\Css\Admin\CssAdminStyles::getInstance();
575
        $cssStyles->write($module, 'style.css');
576
        $ret[] = $cssStyles->render();
577
        // Css Styles File
578
        $cssStyles = Tdmcreate\Files\Assets\Css\CssStyles::getInstance();
579
        $cssStyles->write($module, 'style.css');
580
        $ret[] = $cssStyles->render();
581
        // Include Jquery File
582
        $JavascriptJQuery = Tdmcreate\Files\Assets\Js\JavascriptJQuery::getInstance();
583
        $JavascriptJQuery->write($module, 'functions.js');
584
        $ret[] = $JavascriptJQuery->render();
585
        // Include Common File
586
        $includeCommon = Tdmcreate\Files\Includes\IncludeCommon::getInstance();
587
        $includeCommon->write($module, $table, 'common.php');
588
        $ret[] = $includeCommon->render();
589
        // Docs Changelog File
590
        $docsChangelog = Tdmcreate\Files\Docs\DocsChangelog::getInstance();
591
        $docsChangelog->write($module, 'changelog.txt');
592
        $ret[] = $docsChangelog->render();
593
        // Language Help File
594
        $languageHelp = Tdmcreate\Files\Language\LanguageHelp::getInstance();
595
        $languageHelp->write($module, 'help.html');
596
        $ret[] = $languageHelp->render();
597
        // User Xoops Version File
598
        $userXoopsVersion = Tdmcreate\Files\User\UserXoopsVersion::getInstance();
599
        $userXoopsVersion->write($module, $table, $tables, 'xoops_version.php');
600
        $ret[] = $userXoopsVersion->render();
601
602
        // Return Array
603
        return $ret;
604
    }
605
}
606