Completed
Pull Request — master (#144)
by Michael
03:02
created

CreateArchitecture::setBaseFoldersFiles()   F

Complexity

Conditions 17
Paths 4352

Size

Total Lines 108
Code Lines 71

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 17
eloc 71
nc 4352
nop 1
dl 0
loc 108
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
        $targetImage = 'logoModule.png';
127
        $this->copyFile('assets/images', TDMC_UPLOAD_IMGMOD_PATH . '/' . $modImage, $targetImage);
128
129
        // Copy of 'module_author_logo.png' file in uploads dir
130
        $logoPng     = $stlModuleAuthor . '_logo.png';
131
        $logoGifFrom = TDMC_UPLOAD_IMGMOD_PATH . '/' . $logoPng;
132
        // If file exists
133
        if (!file_exists($logoGifFrom)) {
134
            // Rename file
135
            $copyFile    = TDMC_IMAGES_LOGOS_URL . '/xoopsdevelopmentteam_logo.gif';
136
            $copyNewFile = $logoGifFrom;
137
            copy($copyFile, $copyNewFile);
138
        } else {
139
            // Copy file
140
            $copyFile    = TDMC_IMAGES_LOGOS_URL . '/' . $logoPng;
141
            $copyNewFile = $logoGifFrom;
142
            copy($copyFile, $copyNewFile);
143
        }
144
145
        // Creation of 'module_author_logo.gif' file
146
        $this->copyFile('assets/images', $copyNewFile, $logoPng);
147
        $docs = [
148
            '/credits.txt' => 'credits.txt',
149
            '/install.txt' => 'install.txt',
150
            '/lang.diff'   => 'lang.diff',
151
            '/license.txt' => 'license.txt',
152
            '/readme.txt'  => 'readme.txt',
153
        ];
154
        foreach ($docs as $k => $v) {
155
            // Creation of folder docs and .txt files
156
            $this->makeDirAndCopyFile('docs', TDMC_DOCS_PATH . $k, $v);
157
        }
158
        if (!empty($tableName)) {
159
            if (1 == $module->getVar('mod_admin') || 1 == $module->getVar('mod_user')) {
160
                // Creation of "templates" folder and index.html file
161
                $this->makeDirAndCopyFile('templates', $indexFile, 'index.html');
162
            }
163
            if (1 == $module->getVar('mod_admin')) {
164
                // Creation of "templates/admin" folder and index.html file
165
                $this->makeDirAndCopyFile('templates/admin', $indexFile, 'index.html');
166
            }
167
            if ((1 == $module->getVar('mod_blocks')) && (1 == $table->getVar('table_blocks'))) {
168
                // Creation of "templates/blocks" folder and index.html file
169
                $this->makeDirAndCopyFile('templates/blocks', $indexFile, 'index.html');
170
            }
171
            // Creation of "sql" folder and index.html file
172
            $this->makeDirAndCopyFile('sql', $indexFile, 'index.html');
173
            if ((1 == $module->getVar('mod_notifications')) && (1 == $table->getVar('table_notifications'))) {
174
                // Creation of "language/local_language/mail_template" folder and index.html file
175
                $this->makeDirAndCopyFile('language/' . $language . '/mail_template', $indexFile, 'index.html');
176
            }
177
        }
178
    }
179
180
    /**
181
     * @public function setFilesToBuilding
182
     *
183
     * @param string $module
184
     *
185
     * @return array
186
     */
187
    public function setFilesToBuilding($module)
188
    {
189
        $helper = Tdmcreate\Helper::getInstance();
190
        $tf     = Tdmcreate\Files\CreateFile::getInstance();
191
        // Module
192
        $modId         = $module->getVar('mod_id');
193
        $moduleDirname = $module->getVar('mod_dirname');
194
        $icon32        = 'assets/icons/32';
195
        $tables        = $tf->getTableTables($modId);
196
        $files         = $tf->getTableMoreFiles($modId);
197
        $ret           = [];
198
199
        $table              = [];
200
        $tableCategory      = [];
201
        $tableName          = [];
0 ignored issues
show
Unused Code introduced by
The assignment to $tableName is dead and can be removed.
Loading history...
202
        $tableAdmin         = [];
203
        $tableUser          = [];
204
        $tableBlocks        = [];
205
        $tableSearch        = [];
206
        $tableComments      = [];
207
        $tableNotifications = [];
208
        $tablePermissions   = [];
209
        $tableBroken        = [];
210
        $tablePdf           = [];
211
        $tablePrint         = [];
212
        $tableRate          = [];
213
        $tableRss           = [];
214
        $tableSingle        = [];
215
        $tableSubmit        = [];
216
        $tableVisit         = [];
217
        $tableTag           = [];
218
        foreach (array_keys($tables) as $t) {
219
            $tableId              = $tables[$t]->getVar('table_id');
220
            $tableName            = $tables[$t]->getVar('table_name');
221
            $tableCategory[]      = $tables[$t]->getVar('table_category');
222
            $tableImage           = $tables[$t]->getVar('table_image');
223
            $tableAdmin[]         = $tables[$t]->getVar('table_admin');
224
            $tableUser[]          = $tables[$t]->getVar('table_user');
225
            $tableBlocks[]        = $tables[$t]->getVar('table_blocks');
226
            $tableSearch[]        = $tables[$t]->getVar('table_search');
227
            $tableComments[]      = $tables[$t]->getVar('table_comments');
228
            $tableNotifications[] = $tables[$t]->getVar('table_notifications');
229
            $tablePermissions[]   = $tables[$t]->getVar('table_permissions');
230
            $tableBroken[]        = $tables[$t]->getVar('table_broken');
231
            $tablePdf[]           = $tables[$t]->getVar('table_pdf');
232
            $tablePrint[]         = $tables[$t]->getVar('table_print');
233
            $tableRate[]          = $tables[$t]->getVar('table_rate');
234
            $tableRss[]           = $tables[$t]->getVar('table_rss');
235
            $tableSingle[]        = $tables[$t]->getVar('table_single');
236
            $tableSubmit[]        = $tables[$t]->getVar('table_submit');
237
            $tableVisit[]         = $tables[$t]->getVar('table_visit');
238
            $tableTag[]           = $tables[$t]->getVar('table_tag');
239
            // Get Table Object
240
            $table = $helper->getHandler('Tables')->get($tableId);
241
            // Copy of tables images file
242
            if (file_exists($uploadTableImage = TDMC_UPLOAD_IMGTAB_PATH . '/' . $tableImage)) {
243
                $this->copyFile($icon32, $uploadTableImage, $tableImage);
244
            } elseif (file_exists($uploadTableImage = XOOPS_ICONS32_PATH . '/' . $tableImage)) {
245
                $this->copyFile($icon32, $uploadTableImage, $tableImage);
246
            }
247
            // Creation of admin files
248
            if (in_array(1, $tableAdmin)) {
249
                // Admin Pages File
250
                $adminPages = Tdmcreate\Files\Admin\AdminPages::getInstance();
251
                $adminPages->write($module, $table, $tableName . '.php');
252
                $ret[] = $adminPages->render();
253
                // Admin Templates File
254
                $adminTemplatesPages = Tdmcreate\Files\Templates\Admin\TemplatesAdminPages::getInstance();
255
                $adminTemplatesPages->write($module, $table, $moduleDirname . '_admin_' . $tableName . '.tpl');
256
                $ret[] = $adminTemplatesPages->render();
257
            }
258
            // Creation of blocks
259
            if (in_array(1, $tableBlocks)) {
260
                // Blocks Files
261
                $blocksFiles = Tdmcreate\Files\Blocks\BlocksFiles::getInstance();
262
                $blocksFiles->write($module, $table, $tableName . '.php');
263
                $ret[] = $blocksFiles->render();
264
                // Templates Blocks Files
265
                $templatesBlocks = Tdmcreate\Files\Templates\Blocks\TemplatesBlocks::getInstance();
266
                $templatesBlocks->write($module, $table, $moduleDirname . '_block_' . $tableName . '.tpl');
267
                $ret[] = $templatesBlocks->render();
268
            }
269
            // Creation of classes
270
            if (in_array(1, $tableAdmin, true) || in_array(1, $tableUser)) {
271
                // Class Files
272
                $classFiles = Tdmcreate\Files\Classes\ClassFiles::getInstance();
273
                $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

273
                $classFiles->write($module, /** @scrutinizer ignore-type */ $table, $tables, $tableName . '.php');
Loading history...
274
                $ret[] = $classFiles->render();
275
            }
276
            // Creation of user files
277
            if (in_array(1, $tableUser)) {
278
                // User Pages File
279
                $userPages = Tdmcreate\Files\User\UserPages::getInstance();
280
                $userPages->write($module, $table, $tableName . '.php');
281
                $ret[] = $userPages->render();
282
                if (in_array(0, $tableCategory)) {
283
                    // User Templates File
284
                    $userTemplatesPages = Tdmcreate\Files\Templates\User\Pages::getInstance();
285
                    $userTemplatesPages->write($module, $table, $moduleDirname . '_' . $tableName . '.tpl');
286
                    $ret[] = $userTemplatesPages->render();
287
                    // User List Templates File
288
                    $userTemplatesPagesList = Tdmcreate\Files\Templates\User\PagesList::getInstance();
289
                    $userTemplatesPagesList->write($module, $table, $tables, $moduleDirname . '_' . $tableName . '_list' . '.tpl');
290
                    $ret[] = $userTemplatesPagesList->render();
291
                }
292
                if (in_array(1, $tableCategory)) {
293
                    // User List Templates File
294
                    $userTemplatesCategories = Templates\User\Categories::getInstance();
295
                    $userTemplatesCategories->write($module, $table, $moduleDirname . '_' . $tableName . '.tpl');
296
                    $ret[] = $userTemplatesCategories->render();
297
                    // User List Templates File
298
                    $userTemplatesCategoriesList = Templates\User\CategoriesList::getInstance();
299
                    $userTemplatesCategoriesList->write($module, $table, $moduleDirname . '_' . $tableName . '_list' . '.tpl');
300
                    $ret[] = $userTemplatesCategoriesList->render();
301
                }
302
            }
303
        }
304
        foreach (array_keys($files) as $t) {
305
            $fileName      = $files[$t]->getVar('file_name');
306
            $fileExtension = $files[$t]->getVar('file_extension');
307
            $fileInfolder  = $files[$t]->getVar('file_infolder');
308
            // More File
309
            $moreFiles = Tdmcreate\MoreFiles::getInstance();
310
            $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

310
            $moreFiles->/** @scrutinizer ignore-call */ 
311
                        write($module, $fileName, $fileInfolder, $fileExtension);
Loading history...
311
            $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

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