Passed
Branch master (5b6d04)
by Michael
03:42
created

hideButtons()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 3
nc 1
nop 1
dl 0
loc 5
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
/*
5
 You may not change or alter any portion of this comment or credits
6
 of supporting developers from this source code or any supporting source code
7
 which is considered copyrighted (c) material of the original comment or credit authors.
8
9
 This program is distributed in the hope that it will be useful,
10
 but WITHOUT ANY WARRANTY; without even the implied warranty of
11
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12
*/
13
14
/**
15
 * Publisher
16
 *
17
 * @copyright    The XOOPS Project (https://xoops.org)
18
 * @license      GNU GPL (https://www.gnu.org/licenses/gpl-2.0.html/)
19
 * @since        1.0
20
 * @author       Mage, Mamba
21
 */
22
23
use Xmf\Module\Admin;
24
use Xmf\Request;
25
use Xmf\Yaml;
26
use XoopsModules\Publisher\{Common,
27
    Common\TestdataButtons,
28
    Helper,
29
    Utility
30
};
31
32
require_once __DIR__ . '/admin_header.php';
33
34
xoops_cp_header();
35
$adminObject  = Admin::getInstance();
36
$utility      = new Utility();
37
$configurator = new Common\Configurator();
38
$helper       = Helper::getInstance();
39
$helper->loadLanguage('main');
40
$helper->loadLanguage('admin');
41
42
/*
43
foreach (array_keys($GLOBALS['uploadFolders']) as $i) {
44
    Utility::createFolder($uploadFolders[$i]);
45
    $adminObject->addConfigBoxLine($uploadFolders[$i], 'folder');
46
    //    $adminObject->addConfigBoxLine(array($folder[$i], '777'), 'chmod');
47
}
48
49
//copy blank.png files, if needed
50
$file = PUBLISHER_ROOT_PATH . '/assets/images/blank.png';
51
foreach (array_keys($copyFiles) as $i) {
52
    $dest = $copyFiles[$i] . '/blank.png';
53
    Utility::copyFile($file, $dest);
54
}
55
*/
56
57
if (!is_file(XOOPS_ROOT_PATH . '/class/libraries/vendor/tecnickcom/tcpdf/tcpdf.php')) {
58
    $adminObject->addConfigBoxLine('<span style="color:#ff0000;"><img src="' . $pathIcon16 . '/0.png" alt="!">' . _MD_PUBLISHER_ERROR_NO_PDF . '</span>', 'default');
59
}
60
61
$modStats    = [];
62
$moduleStats = $utility::getModuleStats($configurator, $modStats);
63
64
$adminObject->addInfoBox(constant('CO_' . $moduleDirNameUpper . '_' . 'STATS_SUMMARY'));
65
if ($moduleStats && is_array($moduleStats)) {
66
    foreach ($moduleStats as $key => $value) {
67
        switch ($key) {
68
            case 'totalcategories':
69
                $ret = '<span style=\'font-weight: bold; color: green;\'>' . $value . '</span>';
70
                $adminObject->addInfoBoxLine(sprintf($ret . ' ' . _AM_PUBLISHER_TOTALCAT));
71
                break;
72
            case 'totalitems':
73
                $ret = '<span style=\'font-weight: bold; color: green;\'>' . $value . '</span>';
74
                $adminObject->addInfoBoxLine(sprintf($ret . ' ' . _AM_PUBLISHER_ITEMS));
75
                break;
76
            case 'totaloffline':
77
                $ret = '<span style=\'font-weight: bold; color: red;\'>' . $value . '</span>';
78
                $adminObject->addInfoBoxLine(sprintf($ret . ' ' . _AM_PUBLISHER_TOTAL_OFFLINE));
79
                break;
80
            case 'totalpublished':
81
                $ret = '<span style=\'font-weight: bold; color: green;\'>' . $value . '</span>';
82
                $adminObject->addInfoBoxLine(sprintf($ret . ' ' . _AM_PUBLISHER_TOTALPUBLISHED));
83
                break;
84
            case 'totalrejected':
85
                $ret = '<span style=\'font-weight: bold; color: red;\'>' . $value . '</span>';
86
                $adminObject->addInfoBoxLine(sprintf($ret . ' ' . _AM_PUBLISHER_REJECTED));
87
                break;
88
            case 'totalsubmitted':
89
                $ret = '<span style=\'font-weight: bold; color: green;\'>' . $value . '</span>';
90
                $adminObject->addInfoBoxLine(sprintf($ret . ' ' . _AM_PUBLISHER_TOTALSUBMITTED));
91
                break;
92
        }
93
    }
94
}
95
96
$adminObject->displayNavigation(basename(__FILE__));
97
98
//check for latest release
99
//$newRelease = $utility::checkVerModule($helper);
100
//if (!empty($newRelease)) {
101
//    $adminObject->addItemButton($newRelease[0], $newRelease[1], 'download', 'style="color : Red"');
102
//}
103
104
//------------- Test Data Buttons ----------------------------
105
if ($helper->getConfig('displaySampleButton')) {
106
    TestdataButtons::loadButtonConfig($adminObject);
107
    $adminObject->displayButton('left', '');;
108
}
109
$op = \Xmf\Request::getString('op', 0, 'GET');
110
switch ($op) {
111
    case 'hide_buttons':
112
        TestdataButtons::hideButtons();
113
        break;
114
    case 'show_buttons':
115
        TestdataButtons::showButtons();
116
        break;
117
}
118
//------------- End Test Data Buttons ----------------------------
119
120
$adminObject->displayIndex();
121
echo $utility::getServerStats();
122
123
//codeDump(__FILE__);
124
require __DIR__ . '/admin_footer.php';
125