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

CreateArchitecture::setBaseFoldersFiles()   F

Complexity

Conditions 17
Paths 4352

Size

Total Lines 104
Code Lines 69

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 17
eloc 69
c 0
b 0
f 0
nc 4352
nop 1
dl 0
loc 104
rs 1.0499

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
 * @version         $Id: Architecture.php 12258 2014-01-02 09:33:29Z timgno $
27
 */
28
29
//include dirname(__DIR__) . '/autoload.php';
30
31
/**
32
 * Class Architecture.
33
 */
34
class CreateArchitecture extends CreateStructure
35
{
36
    /**
37
     * @public function constructor class
38
     *
39
     * @param null
40
     */
41
    public function __construct()
42
    {
43
        parent::__construct();
44
        $this->setUploadPath(TDMC_UPLOAD_REPOSITORY_PATH);
45
    }
46
47
    /**
48
     * @static function getInstance
49
     *
50
     * @param null
51
     *
52
     * @return Tdmcreate\Files\CreateArchitecture
53
     */
54
    public static function getInstance()
55
    {
56
        static $instance = false;
57
        if (!$instance) {
58
            $instance = new self();
59
        }
60
61
        return $instance;
62
    }
63
64
    /**
65
     * @public function setBaseFoldersFiles
66
     *
67
     * @param $module
68
     */
69
    public function setBaseFoldersFiles($module)
70
    {
71
        $helper = Tdmcreate\Helper::getInstance();
72
        $tf     = Tdmcreate\Files\CreateFile::getInstance();
73
        // Module
74
        $modId = $module->getVar('mod_id');
75
        // Id of tables
76
        $tables = $tf->getTableTables($modId);
77
78
        $table = null;
79
        foreach (array_keys($tables) as $t) {
80
            $tableId   = $tables[$t]->getVar('table_id');
81
            $tableName = $tables[$t]->getVar('table_name');
82
            $table     = $helper->getHandler('Tables')->get($tableId);
83
        }
84
85
        $indexFile       = XOOPS_UPLOAD_PATH . '/index.html';
86
        $stlModuleAuthor = str_replace(' ', '', mb_strtolower($module->getVar('mod_author')));
87
        $this->setModuleName($module->getVar('mod_dirname'));
88
        $uploadPath = $this->getUploadPath();
89
        // Creation of "module" folder in the Directory repository
90
        $this->makeDir($uploadPath . '/' . $this->getModuleName());
91
        if (1 != $module->getVar('mod_user')) {
92
            // Copied of index.html file in "root module" folder
93
            $this->copyFile('', $indexFile, 'index.html');
94
        }
95
        if (1 == $module->getVar('mod_admin')) {
96
            // Creation of "admin" folder and index.html file
97
            $this->makeDirAndCopyFile('admin', $indexFile, 'index.html');
98
        }
99
        if (1 == $module->getVar('mod_blocks')) {
100
            // Creation of "blocks" folder and index.html file
101
            $this->makeDirAndCopyFile('blocks', $indexFile, 'index.html');
102
        }
103
        $language  = ('english' !== $GLOBALS['xoopsConfig']['language']) ? $GLOBALS['xoopsConfig']['language'] : 'english';
104
        $copyFiles = ['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
        // Creation of 'module_author_logo.gif' file
143
        $this->copyFile('assets/images', $copyNewFile, $logoPng);
144
        $docs = [
145
            '/credits.txt' => 'credits.txt',
146
            '/install.txt' => 'install.txt',
147
            '/lang.diff'   => 'lang.diff',
148
            '/license.txt' => 'license.txt',
149
            '/readme.txt'  => 'readme.txt',
150
        ];
151
        foreach ($docs as $k => $v) {
152
            // Creation of folder docs and .txt files
153
            $this->makeDirAndCopyFile('docs', TDMC_DOCS_PATH . $k, $v);
154
        }
155
        if (!empty($tableName)) {
156
            if (1 == $module->getVar('mod_admin') || 1 == $module->getVar('mod_user')) {
157
                // Creation of "templates" folder and index.html file
158
                $this->makeDirAndCopyFile('templates', $indexFile, 'index.html');
159
            }
160
            if (1 == $module->getVar('mod_admin')) {
161
                // Creation of "templates/admin" folder and index.html file
162
                $this->makeDirAndCopyFile('templates/admin', $indexFile, 'index.html');
163
            }
164
            if ((1 == $module->getVar('mod_blocks')) && (1 == $table->getVar('table_blocks'))) {
165
                // Creation of "templates/blocks" folder and index.html file
166
                $this->makeDirAndCopyFile('templates/blocks', $indexFile, 'index.html');
167
            }
168
            // Creation of "sql" folder and index.html file
169
            $this->makeDirAndCopyFile('sql', $indexFile, 'index.html');
170
            if ((1 == $module->getVar('mod_notifications')) && (1 == $table->getVar('table_notifications'))) {
171
                // Creation of "language/local_language/mail_template" folder and index.html file
172
                $this->makeDirAndCopyFile('language/' . $language . '/mail_template', $indexFile, 'index.html');
173
            }
174
        }
175
    }
176
177
    /**
178
     * @public function setFilesToBuilding
179
     *
180
     * @param string $module
181
     *
182
     * @return array
183
     */
184
    public function setFilesToBuilding($module)
185
    {
186
        $helper = Tdmcreate\Helper::getInstance();
187
        $tf     = Tdmcreate\Files\CreateFile::getInstance();
188
        // Module
189
        $modId         = $module->getVar('mod_id');
190
        $moduleDirname = $module->getVar('mod_dirname');
191
        $icon32        = 'assets/icons/32';
192
        $tables        = $tf->getTableTables($modId);
193
        $files         = $tf->getTableMoreFiles($modId);
194
        $ret           = [];
195
196
        $table              = [];
197
        $tableCategory      = [];
198
        $tableName          = [];
0 ignored issues
show
Unused Code introduced by
The assignment to $tableName is dead and can be removed.
Loading history...
199
        $tableAdmin         = [];
200
        $tableUser          = [];
201
        $tableBlocks        = [];
202
        $tableSearch        = [];
203
        $tableComments      = [];
204
        $tableNotifications = [];
205
        $tablePermissions   = [];
206
        $tableBroken        = [];
207
        $tablePdf           = [];
208
        $tablePrint         = [];
209
        $tableRate          = [];
210
        $tableRss           = [];
211
        $tableSingle        = [];
212
        $tableSubmit        = [];
213
        $tableVisit         = [];
214
        $tableTag           = [];
215
        foreach (array_keys($tables) as $t) {
216
            $tableId              = $tables[$t]->getVar('table_id');
217
            $tableName            = $tables[$t]->getVar('table_name');
218
            $tableCategory[]      = $tables[$t]->getVar('table_category');
219
            $tableImage           = $tables[$t]->getVar('table_image');
220
            $tableAdmin[]         = $tables[$t]->getVar('table_admin');
221
            $tableUser[]          = $tables[$t]->getVar('table_user');
222
            $tableBlocks[]        = $tables[$t]->getVar('table_blocks');
223
            $tableSearch[]        = $tables[$t]->getVar('table_search');
224
            $tableComments[]      = $tables[$t]->getVar('table_comments');
225
            $tableNotifications[] = $tables[$t]->getVar('table_notifications');
226
            $tablePermissions[]   = $tables[$t]->getVar('table_permissions');
227
            $tableBroken[]        = $tables[$t]->getVar('table_broken');
228
            $tablePdf[]           = $tables[$t]->getVar('table_pdf');
229
            $tablePrint[]         = $tables[$t]->getVar('table_print');
230
            $tableRate[]          = $tables[$t]->getVar('table_rate');
231
            $tableRss[]           = $tables[$t]->getVar('table_rss');
232
            $tableSingle[]        = $tables[$t]->getVar('table_single');
233
            $tableSubmit[]        = $tables[$t]->getVar('table_submit');
234
            $tableVisit[]         = $tables[$t]->getVar('table_visit');
235
            $tableTag[]           = $tables[$t]->getVar('table_tag');
236
            // Get Table Object
237
            $table = $helper->getHandler('Tables')->get($tableId);
238
            // Copy of tables images file
239
            if (file_exists($uploadTableImage = TDMC_UPLOAD_IMGTAB_PATH . '/' . $tableImage)) {
240
                $this->copyFile($icon32, $uploadTableImage, $tableImage);
241
            } elseif (file_exists($uploadTableImage = XOOPS_ICONS32_PATH . '/' . $tableImage)) {
242
                $this->copyFile($icon32, $uploadTableImage, $tableImage);
243
            }
244
            // Creation of admin files
245
            if (in_array(1, $tableAdmin)) {
246
                // Admin Pages File
247
                $adminPages = Tdmcreate\Files\Admin\AdminPages::getInstance();
248
                $adminPages->write($module, $table, $tableName . '.php');
249
                $ret[] = $adminPages->render();
250
                // Admin Templates File
251
                $adminTemplatesPages = Tdmcreate\Files\Templates\Admin\TemplatesAdminPages::getInstance();
252
                $adminTemplatesPages->write($module, $table, $moduleDirname . '_admin_' . $tableName . '.tpl');
253
                $ret[] = $adminTemplatesPages->render();
254
            }
255
            // Creation of blocks
256
            if (in_array(1, $tableBlocks)) {
257
                // Blocks Files
258
                $blocksFiles = Tdmcreate\Files\Blocks\BlocksFiles::getInstance();
259
                $blocksFiles->write($module, $table, $tableName . '.php');
260
                $ret[] = $blocksFiles->render();
261
                // Templates Blocks Files
262
                $templatesBlocks = Tdmcreate\Files\Templates\Blocks\TemplatesBlocks::getInstance();
263
                $templatesBlocks->write($module, $table, $moduleDirname . '_block_' . $tableName . '.tpl');
264
                $ret[] = $templatesBlocks->render();
265
            }
266
            // Creation of classes
267
            if (in_array(1, $tableAdmin, true) || in_array(1, $tableUser)) {
268
                // Class Files
269
                $classFiles = Tdmcreate\Files\Classes\ClassFiles::getInstance();
270
                $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

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

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

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