PluginProbe ʕ •ᴥ•ʔ
VikAppointments Services Booking Calendar / 1.2.21
VikAppointments Services Booking Calendar v1.2.21
1.2.21 1.2.20 trunk 1.2.17 1.2.18 1.2.19
vikappointments / admin / views / apibans / tmpl / default.php
vikappointments / admin / views / apibans / tmpl Last commit date
default.php 5 days ago index.html 5 days ago
default.php
323 lines
1 <?php
2 /**
3 * @package VikAppointments
4 * @subpackage core
5 * @author E4J s.r.l.
6 * @copyright Copyright (C) 2021 E4J s.r.l. All Rights Reserved.
7 * @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
8 * @link https://vikwp.com
9 */
10
11 // No direct access
12 defined('ABSPATH') or die('No script kiddies please!');
13
14 JHtml::fetch('formbehavior.chosen');
15 JHtml::fetch('bootstrap.tooltip', '.hasTooltip');
16 JHtml::fetch('vaphtml.assets.fontawesome');
17
18 $rows = $this->rows;
19
20 $filters = $this->filters;
21
22 $ordering = $this->ordering;
23
24 $vik = VAPApplication::getInstance();
25
26 $config = VAPFactory::getConfig();
27
28 $max_fail = $config->getUint('apimaxfail');
29
30 $is_searching = $this->hasFilters();
31
32 /**
33 * Trigger event to display custom HTML.
34 * In case it is needed to include any additional fields,
35 * it is possible to create a plugin and attach it to an event
36 * called "onDisplayViewApibansList". The event method receives the
37 * view instance as argument.
38 *
39 * @since 1.7
40 */
41 $forms = $this->onDisplayListView($is_searching);
42
43 ?>
44
45 <form action="index.php?option=com_vikappointments" method="post" name="adminForm" id="adminForm">
46
47 <div class="btn-toolbar" style="height: 32px;">
48 <div class="btn-group pull-left input-append">
49 <input type="text" name="keysearch" id="vapkeysearch" size="32"
50 value="<?php echo $this->escape($filters['keysearch']); ?>" placeholder="<?php echo $this->escape(JText::translate('JSEARCH_FILTER_SUBMIT')); ?>" />
51
52 <button type="submit" class="btn">
53 <i class="fas fa-search"></i>
54 </button>
55 </div>
56
57 <!-- Define role to detect the supported hook -->
58 <!-- {"rule":"customizer","event":"onDisplayViewApibansList","type":"search","key":"search"} -->
59
60 <?php
61 // plugins can use the "search" key to introduce custom
62 // filters within the search bar
63 if (isset($forms['search']))
64 {
65 echo $forms['search'];
66 }
67
68 // in case a plugin needs to use the filter bar, display the button
69 if (isset($forms['filters']))
70 {
71 ?>
72 <div class="btn-group pull-left">
73 <button type="button" class="btn <?php echo ($is_searching ? 'btn-primary' : ''); ?>" onclick="vapToggleSearchToolsButton(this);">
74 <?php echo JText::translate('JSEARCH_TOOLS'); ?>&nbsp;<i class="fas fa-caret-<?php echo ($is_searching ? 'up' : 'down'); ?>" id="vap-tools-caret"></i>
75 </button>
76 </div>
77 <?php
78 }
79 ?>
80
81 <div class="btn-group pull-left">
82 <button type="button" class="btn" onclick="clearFilters();">
83 <?php echo JText::translate('JSEARCH_FILTER_CLEAR'); ?>
84 </button>
85 </div>
86
87 <?php
88 $options = array(
89 JHtml::fetch('select.option', 1, JText::translate('VAPAPIBANOPT1')),
90 JHtml::fetch('select.option', 2, JText::translate('VAPAPIBANOPT2')),
91 );
92 ?>
93 <div class="btn-group pull-right">
94 <select name="type" id="vap-type-sel" onchange="document.adminForm.submit();">
95 <?php echo JHtml::fetch('select.options', $options, 'value', 'text', $filters['type']); ?>
96 </select>
97 </div>
98 </div>
99
100 <div class="btn-toolbar" id="vap-search-tools" style="height: 32px;<?php echo ($is_searching ? '' : 'display: none;'); ?>">
101
102 <!-- Define role to detect the supported hook -->
103 <!-- {"rule":"customizer","event":"onDisplayViewApibansList","type":"search","key":"filters"} -->
104
105 <?php
106 // plugins can use the "filters" key to introduce custom
107 // filters within the search bar
108 if (isset($forms['filters']))
109 {
110 echo $forms['filters'];
111 }
112 ?>
113
114 </div>
115
116 <?php
117 if (count($rows) == 0)
118 {
119 echo $vik->alert(JText::translate('JGLOBAL_NO_MATCHING_RESULTS'));
120 }
121 else
122 {
123 /**
124 * Trigger event to display custom columns.
125 *
126 * @since 1.7
127 */
128 $columns = $this->onDisplayTableColumns();
129 ?>
130
131 <!-- Define role to detect the supported hook -->
132 <!-- {"rule":"customizer","event":"onDisplayApibansTableTH","type":"th"} -->
133
134 <!-- Define role to detect the supported hook -->
135 <!-- {"rule":"customizer","event":"onDisplayApibansTableTD","type":"td"} -->
136
137 <table cellpadding="4" cellspacing="0" border="0" width="100%" class="<?php echo $vik->getAdminTableClass(); ?>">
138
139 <?php echo $vik->openTableHead(); ?>
140 <tr>
141
142 <th width="1%">
143 <?php echo $vik->getAdminToggle(count($rows)); ?>
144 </th>
145
146 <!-- ID -->
147
148 <th class="<?php echo $vik->getAdminThClass('left hidden-phone nowrap'); ?>" width="1%" style="text-align: left;">
149 <?php echo JHtml::fetch('vaphtml.admin.sort', 'VAPMANAGEGROUP1', 'b.id', $this->orderDir, $this->ordering); ?>
150 </th>
151
152 <!-- IP ADDRESS -->
153
154 <th class="<?php echo $vik->getAdminThClass('left'); ?>" width="15%" style="text-align: left;">
155 <?php echo JText::translate('VAPMANAGEAPIUSER17'); ?>
156 </th>
157
158 <!-- CUSTOM -->
159
160 <?php
161 foreach ($columns as $k => $col)
162 {
163 ?>
164 <th data-id="<?php echo $this->escape($k); ?>" class="<?php echo $vik->getAdminThClass('left hidden-phone'); ?>">
165 <?php echo $col->th; ?>
166 </th>
167 <?php
168 }
169 ?>
170
171 <!-- LAST UPDATE -->
172
173 <th class="<?php echo $vik->getAdminThClass('left'); ?>" width="20%" style="text-align: left;">
174 <?php echo JHtml::fetch('vaphtml.admin.sort', 'VAPMANAGEAPIUSER18', 'b.last_update', $this->orderDir, $this->ordering); ?>
175 </th>
176
177 <!-- FAILS COUNT -->
178
179 <th class="<?php echo $vik->getAdminThClass(); ?>" width="10%" style="text-align: center;">
180 <?php echo JHtml::fetch('vaphtml.admin.sort', 'VAPMANAGEAPIUSER19', 'b.fail_count', $this->orderDir, $this->ordering); ?>
181 </th>
182
183 <!-- STATUS -->
184
185 <th class="<?php echo $vik->getAdminThClass('hidden-phone'); ?>" width="15%" style="text-align: center;">&nbsp;</th>
186
187 </tr>
188 <?php echo $vik->closeTableHead(); ?>
189
190 <?php
191 $kk = 0;
192 for ($i = 0; $i < count($rows); $i++)
193 {
194 $row = $rows[$i];
195 ?>
196 <tr class="row<?php echo $kk; ?>">
197
198 <td>
199 <input type="checkbox" id="cb<?php echo $i;?>" name="cid[]" value="<?php echo $row['id']; ?>" onClick="<?php echo $vik->checkboxOnClick(); ?>">
200 </td>
201
202 <!-- ID -->
203
204 <td class="hidden-phone">
205 <?php echo $row['id']; ?>
206 </td>
207
208 <!-- IP ADDRESS -->
209
210 <td>
211 <div class="td-primary">
212 <?php echo $row['ip']; ?>
213 </div>
214 </td>
215
216 <!-- CUSTOM -->
217
218 <?php
219 foreach ($columns as $k => $col)
220 {
221 ?>
222 <td data-id="<?php echo $this->escape($k); ?>" class="hidden-phone">
223 <?php echo isset($col->td[$i]) ? $col->td[$i] : ''; ?>
224 </td>
225 <?php
226 }
227 ?>
228
229 <!-- LAST UPDATE -->
230
231 <td>
232 <span class="hasTooltip" title="<?php echo $this->escape(JHtml::fetch('date', $row['last_update'], JText::translate('DATE_FORMAT_LC2'))); ?>">
233 <?php echo JHtml::fetch('date.relative', $row['last_update'], null, null, JText::translate('DATE_FORMAT_LC2')); ?>
234 </span>
235 </td>
236
237 <!-- FAILS COUNT -->
238
239 <td style="text-align: center;<?php echo ($row['fail_count'] >= $max_fail ? 'color:#900;' : ''); ?>">
240 <?php
241 if ($row['fail_count'] == 0)
242 {
243 $badge = 'success';
244 }
245 else if ($row['fail_count'] >= $max_fail)
246 {
247 $badge = 'important';
248 }
249 else
250 {
251 $badge = 'warning';
252 }
253 ?>
254 <span class="badge badge-<?php echo $badge; ?>">
255 <?php echo $row['fail_count'] . ' / ' . $max_fail; ?>
256 </span>
257 </td>
258
259 <!-- STATUS -->
260
261 <td style="text-align: center;" class="hidden-phone">
262 <?php
263 if ($row['fail_count'] < $max_fail)
264 {
265 ?>
266 <span style="color: #090;">
267 <i class="fas fa-check-circle"></i>
268 <b style="text-transform: uppercase;margin-left: 2px;">
269 <?php echo JText::translate('VAPACTIVE'); ?>
270 </b>
271 </span>
272 <?php
273 }
274 else
275 {
276 ?>
277 <span style="color: #900;">
278 <i class="fas fa-ban"></i>
279 <b style="text-transform: uppercase;margin-left: 2px;">
280 <?php echo JText::translate('VAPMANAGEAPIUSER20'); ?>
281 </b>
282 </span>
283 <?php
284 }
285 ?>
286 </td>
287
288 </tr>
289 <?php
290 $kk = 1 - $kk;
291 }
292 ?>
293 </table>
294 <?php
295 }
296 ?>
297
298 <input type="hidden" name="boxchecked" value="0" />
299 <input type="hidden" name="task" value="" />
300 <input type="hidden" name="view" value="apibans" />
301
302 <input type="hidden" name="filter_order" value="<?php echo $this->ordering; ?>" />
303 <input type="hidden" name="filter_order_Dir" value="<?php echo $this->orderDir; ?>" />
304
305 <?php echo JHtml::fetch('form.token'); ?>
306 <?php echo $this->navbut; ?>
307 </form>
308
309 <script>
310
311 jQuery(function($) {
312 VikRenderer.chosen('.btn-toolbar');
313 });
314
315 function clearFilters() {
316 jQuery('#vapkeysearch').val('');
317 jQuery('#vap-type-sel').updateChosen(1);
318
319 document.adminForm.submit();
320 }
321
322 </script>
323