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

CreateArchitecture::setFilesToBuilding()   F

Complexity

Conditions 34
Paths > 20000

Size

Total Lines 419
Code Lines 300

Duplication

Lines 0
Ratio 0 %

Importance

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

252
                $classFiles->write($module, /** @scrutinizer ignore-type */ $table, $tables, $tableName . '.php');
Loading history...
253
                $ret[] = $classFiles->render();
254
            }
255
            // Creation of user files
256
            if (in_array(1, $tableUser)) {
257
                // User Pages File
258
                $userPages = Tdmcreate\Files\User\UserPages::getInstance();
259
                $userPages->write($module, $table, $tableName . '.php');
260
                $ret[] = $userPages->render();
261
                if (in_array(0, $tableCategory)) {
262
                    // User Templates File
263
                    $userTemplatesPages = Tdmcreate\Files\Templates\User\Pages::getInstance();
264
                    $userTemplatesPages->write($module, $table, $moduleDirname . '_' . $tableName . '.tpl');
265
                    $ret[] = $userTemplatesPages->render();
266
                    // User List Templates File
267
                    $userTemplatesPagesList = Tdmcreate\Files\Templates\User\PagesList::getInstance();
268
                    $userTemplatesPagesList->write($module, $table, $tables, $moduleDirname . '_' . $tableName . '_list' . '.tpl');
269
                    $ret[] = $userTemplatesPagesList->render();
270
                }
271
                if (in_array(1, $tableCategory)) {
272
                    // User List Templates File
273
                    $userTemplatesCategories = Templates\User\Categories::getInstance();
274
                    $userTemplatesCategories->write($module, $table, $moduleDirname . '_' . $tableName . '.tpl');
275
                    $ret[] = $userTemplatesCategories->render();
276
                    // User List Templates File
277
                    $userTemplatesCategoriesList = Templates\User\CategoriesList::getInstance();
278
                    $userTemplatesCategoriesList->write($module, $table, $moduleDirname . '_' . $tableName . '_list' . '.tpl');
279
                    $ret[] = $userTemplatesCategoriesList->render();
280
                }
281
            }
282
        }
283
        foreach (array_keys($files) as $t) {
284
            $fileName = $files[$t]->getVar('file_name');
285
            $fileExtension = $files[$t]->getVar('file_extension');
286
            $fileInfolder = $files[$t]->getVar('file_infolder');
287
            // More File
288
            $moreFiles = Tdmcreate\MoreFiles::getInstance();
289
            $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

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

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