Passed
Push — master ( 320458...9267f6 )
by Michael
04:44
created

hideButtons()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 1
Metric Value
eloc 3
dl 0
loc 5
rs 10
c 2
b 0
f 1
cc 1
nc 1
nop 1
1
<?php
2
/*
3
 * You may not change or alter any portion of this comment or credits
4
 * of supporting developers from this source code or any supporting source code
5
 * which is considered copyrighted (c) material of the original comment or credit authors.
6
 *
7
 * This program is distributed in the hope that it will be useful,
8
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10
 */
11
12
/**
13
 * @copyright    {@link https://xoops.org/ XOOPS Project}
14
 * @license      {@link https://www.gnu.org/licenses/gpl-2.0.html GNU GPL 2 or later}
15
 * @package      extcal
16
 * @since
17
 * @author       XOOPS Development Team,
18
 */
19
20
use XoopsModules\Extcal\{Helper,
21
    Common,
22
    Common\TestdataButtons,
23
    Utility
24
};
25
use Xmf\Request;
26
use Xmf\Yaml;
27
28
/** @var Xmf\Module\Admin $adminObject */
29
/** @var Utility $utility */
30
/** @var Helper $helper */
31
32
require_once __DIR__ . '/admin_header.php';
33
// Display Admin header
34
xoops_cp_header();
35
36
$helper       = Helper::getInstance();
37
$configurator = new Common\Configurator();
38
39
//foreach (array_keys($configurator['uploadFolders']) as $i) {
40
//    $utility::createFolder($configurator['uploadFolders'][$i]);
41
//    $adminObject->addConfigBoxLine($configurator['uploadFolders'][$i], 'folder');
42
//    //    $adminObject->addConfigBoxLine(array($configurator['uploadFolders'][$i], '777'), 'chmod');
43
//}
44
45
//count "total categories"
46
/** @var \XoopsPersistableObjectHandler $categoryHandler */
47
$countCategory = $categoryHandler->getCount();
48
//count "total events"
49
/** @var \XoopsPersistableObjectHandler $eventHandler */
50
$countEvent = $eventHandler->getCount();
51
//count "total eventmembers"
52
/** @var \XoopsPersistableObjectHandler $eventmemberHandler */
53
$countEventmember = $eventmemberHandler->getCount();
54
//count "total eventnotmembers"
55
/** @var \XoopsPersistableObjectHandler $eventNotMemberHandler */
56
$countEventnotmember = $eventNotMemberHandler->getCount();
57
//count "total files"
58
/** @var \XoopsPersistableObjectHandler $fileHandler */
59
$countFile = $fileHandler->getCount();
60
//count "total location"
61
/** @var \XoopsPersistableObjectHandler $locationHandler */
62
$countLocation = $locationHandler->getCount();
63
// InfoBox Statistics
64
$adminObject->addInfoBox(AM_EXTCAL_STATISTICS);
65
66
// InfoBox extcal_cat
67
$adminObject->addInfoBoxLine(sprintf(AM_EXTCAL_THEREARE_EXTCAL_CAT, $countCategory));
68
69
// InfoBox extcal_event
70
$adminObject->addInfoBoxLine(sprintf(AM_EXTCAL_THEREARE_EXTCAL_EVENT, $countEvent));
71
72
// InfoBox extcal_eventmember
73
$adminObject->addInfoBoxLine(sprintf(AM_EXTCAL_THEREARE_EXTCAL_EVENTMEMBER, $countEventmember));
74
75
// InfoBox extcal_eventnotmember
76
$adminObject->addInfoBoxLine(sprintf(AM_EXTCAL_THEREARE_EXTCAL_EVENTNOTMEMBER, $countEventnotmember));
77
78
// InfoBox extcal_file
79
$adminObject->addInfoBoxLine(sprintf(AM_EXTCAL_THEREARE_EXTCAL_FILE, $countFile));
80
81
// InfoBox extcal_location
82
$adminObject->addInfoBoxLine(sprintf(AM_EXTCAL_THEREARE_EXTCAL_LOCATION, $countLocation));
83
// Render Index
84
$adminObject->displayNavigation(basename(__FILE__));
85
86
//check for latest release
87
//$newRelease = $utility::checkVerModule($helper);
88
//if (!empty($newRelease)) {
89
//    $adminObject->addItemButton($newRelease[0], $newRelease[1], 'download', 'style="color : Red"');
90
//}
91
92
93
//***************************************************************************************
94
$pendingEvent = $eventHandler->objectToArray($eventHandler->getPendingEvent(), ['cat_id']);
95
$eventHandler->formatEventsDate($pendingEvent, _SHORTDATESTRING);
96
97
echo '<fieldset><legend style="font-weight:bold; color:#990000;">' . _AM_EXTCAL_PENDING_EVENT . '</legend>';
98
echo '<fieldset><legend style="font-weight:bold; color:#0A3760;">' . _AM_EXTCAL_INFORMATION . '</legend>';
99
echo '<img src=' . $pathIcon16 . '/on.png>&nbsp;&nbsp;' . _AM_EXTCAL_INFO_APPROVE_PENDING_EVENT . '<br>';
100
echo '<img src=' . $pathIcon16 . '/edit.png>&nbsp;&nbsp;' . _AM_EXTCAL_INFO_EDIT_PENDING_EVENT . '<br>';
101
echo '<img src=' . $pathIcon16 . '/delete.png>&nbsp;&nbsp;' . _AM_EXTCAL_INFO_DELETE_PENDING_EVENT . '<br>';
102
echo '</fieldset><br>';
103
104
echo '<table class="outer" style="width:100%;">';
105
echo '<tr style="text-align:center;">';
106
echo '<th>' . _AM_EXTCAL_CATEGORY . '</th>';
107
echo '<th>' . _AM_EXTCAL_TITLE . '</th>';
108
echo '<th>' . _AM_EXTCAL_START_DATE . '</th>';
109
echo '<th>' . _AM_EXTCAL_ACTION . '</th>';
110
echo '</tr>';
111
112
if (count($pendingEvent) > 0) {
0 ignored issues
show
Bug introduced by
It seems like $pendingEvent can also be of type null; however, parameter $value of count() does only seem to accept Countable|array, maybe add an additional type check? ( Ignorable by Annotation )

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

112
if (count(/** @scrutinizer ignore-type */ $pendingEvent) > 0) {
Loading history...
113
    $i = 0;
114
    foreach ($pendingEvent as $event) {
115
        $class = (0 == ++$i % 2) ? 'even' : 'odd';
116
        echo '<tr style="text-align:center;" class="' . $class . '">';
117
        echo '<td>' . $event['cat']['cat_name'] . '</td>';
118
        echo '<td>' . $event['event_title'] . '</td>';
119
        echo '<td>' . $event['formated_event_start'] . '</td>';
120
        echo '<td style="width:10%; text-align:center;">';
121
        echo '<a href="event.php?op=modify&amp;event_id=' . $event['event_id'] . '"><img src=' . $pathIcon16 . '/on.png></a>&nbsp;&nbsp;';
122
        echo '<a href="event.php?op=modify&amp;event_id=' . $event['event_id'] . '"><img src=' . $pathIcon16 . '/edit.png></a>&nbsp;&nbsp;';
123
        echo '<a href="event.php?op=delete&amp;event_id=' . $event['event_id'] . '"><img src=' . $pathIcon16 . '/delete.png></a>';
124
        echo '</td>';
125
        echo '</tr>';
126
    }
127
} else {
128
    echo '<tr><td colspan="4">' . _AM_EXTCAL_NO_PENDING_EVENT . '</td></tr>';
129
}
130
131
echo '</table></fieldset><br>';
132
133
134
//------------- Test Data Buttons ----------------------------
135
if ($helper->getConfig('displaySampleButton')) {
136
    TestdataButtons::loadButtonConfig($adminObject);
137
    $adminObject->displayButton('left', '');;
138
}
139
$op = \Xmf\Request::getString('op', 0, 'GET');
140
switch ($op) {
141
    case 'hide_buttons':
142
        TestdataButtons::hideButtons();
143
        break;
144
    case 'show_buttons':
145
        TestdataButtons::showButtons();
146
        break;
147
}
148
//------------- End Test Data Buttons ----------------------------
149
150
151
$adminObject->displayIndex();
152
echo $utility::getServerStats();
153
154
//codeDump(__FILE__);
155
require __DIR__ . '/admin_footer.php';
156
157
158