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 / apiusers / tmpl / default.php
vikappointments / admin / views / apiusers / tmpl Last commit date
default.php 4 days ago index.html 4 days ago
default.php
397 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 $canEdit = JFactory::getUser()->authorise('core.edit', 'com_vikappointments');
27 $canEditState = JFactory::getUser()->authorise('core.edit.state', 'com_vikappointments');
28
29 $is_searching = $this->hasFilters();
30
31 /**
32 * Trigger event to display custom HTML.
33 * In case it is needed to include any additional fields,
34 * it is possible to create a plugin and attach it to an event
35 * called "onDisplayViewApiusersList". The event method receives the
36 * view instance as argument.
37 *
38 * @since 1.7
39 */
40 $forms = $this->onDisplayListView($is_searching);
41
42 ?>
43
44 <form action="index.php?option=com_vikappointments" method="post" name="adminForm" id="adminForm">
45
46 <div class="btn-toolbar" style="height: 32px;">
47 <div class="btn-group pull-left input-append">
48 <input type="text" name="keysearch" id="vapkeysearch" size="32"
49 value="<?php echo $this->escape($filters['keysearch']); ?>" placeholder="<?php echo $this->escape(JText::translate('JSEARCH_FILTER_SUBMIT')); ?>" />
50
51 <button type="submit" class="btn">
52 <i class="fas fa-search"></i>
53 </button>
54 </div>
55
56 <!-- Define role to detect the supported hook -->
57 <!-- {"rule":"customizer","event":"onDisplayViewApiusersList","type":"search","key":"search"} -->
58
59 <?php
60 // plugins can use the "search" key to introduce custom
61 // filters within the search bar
62 if (isset($forms['search']))
63 {
64 echo $forms['search'];
65 }
66 ?>
67
68 <div class="btn-group pull-left">
69 <button type="button" class="btn <?php echo ($is_searching ? 'btn-primary' : ''); ?>" onclick="vapToggleSearchToolsButton(this);">
70 <?php echo JText::translate('JSEARCH_TOOLS'); ?>&nbsp;<i class="fas fa-caret-<?php echo ($is_searching ? 'up' : 'down'); ?>" id="vap-tools-caret"></i>
71 </button>
72 </div>
73
74 <div class="btn-group pull-left">
75 <button type="button" class="btn" onclick="clearFilters();">
76 <?php echo JText::translate('JSEARCH_FILTER_CLEAR'); ?>
77 </button>
78 </div>
79
80 <div class="btn-group pull-right">
81 <a href="index.php?option=com_vikappointments&amp;view=apibans" class="btn">
82 <i class="fas fa-ban"></i>&nbsp;
83 <?php echo JText::translate('VAPMANAGEAPIUSER16'); ?>
84 </a>
85
86 <a href="index.php?option=com_vikappointments&amp;view=apilogs" class="btn">
87 <i class="fas fa-tasks"></i>&nbsp;
88 <?php echo JText::translate('VAPMANAGEAPIUSER12'); ?>
89 </a>
90 </div>
91 </div>
92
93 <div class="btn-toolbar" id="vap-search-tools" style="height: 32px;<?php echo ($is_searching ? '' : 'display: none;'); ?>">
94
95 <?php
96 $options = array(
97 JHtml::fetch('select.option', -1, 'JOPTION_SELECT_PUBLISHED'),
98 JHtml::fetch('select.option', 1, 'JPUBLISHED'),
99 JHtml::fetch('select.option', 0, 'JUNPUBLISHED'),
100 );
101 ?>
102 <div class="btn-group pull-left">
103 <select name="active" id="vap-active-sel" class="<?php echo ($filters['active'] != -1 ? 'active' : ''); ?>" onchange="document.adminForm.submit();">
104 <?php echo JHtml::fetch('select.options', $options, 'value', 'text', $filters['active'], true); ?>
105 </select>
106 </div>
107
108 <!-- Define role to detect the supported hook -->
109 <!-- {"rule":"customizer","event":"onDisplayViewApiusersList","type":"search","key":"filters"} -->
110
111 <?php
112 // plugins can use the "filters" key to introduce custom
113 // filters within the search bar
114 if (isset($forms['filters']))
115 {
116 echo $forms['filters'];
117 }
118 ?>
119
120 </div>
121
122 <?php
123 if (count($rows) == 0)
124 {
125 echo $vik->alert(JText::translate('JGLOBAL_NO_MATCHING_RESULTS'));
126 }
127 else
128 {
129 /**
130 * Trigger event to display custom columns.
131 *
132 * @since 1.7
133 */
134 $columns = $this->onDisplayTableColumns();
135 ?>
136
137 <!-- Define role to detect the supported hook -->
138 <!-- {"rule":"customizer","event":"onDisplayApiusersTableTH","type":"th"} -->
139
140 <!-- Define role to detect the supported hook -->
141 <!-- {"rule":"customizer","event":"onDisplayApiusersTableTD","type":"td"} -->
142
143 <table cellpadding="4" cellspacing="0" border="0" width="100%" class="<?php echo $vik->getAdminTableClass(); ?>">
144
145 <?php echo $vik->openTableHead(); ?>
146 <tr>
147
148 <th width="1%">
149 <?php echo $vik->getAdminToggle(count($rows)); ?>
150 </th>
151
152 <!-- ID -->
153
154 <th class="<?php echo $vik->getAdminThClass('left hidden-phone nowrap'); ?>" width="1%" style="text-align: left;">
155 <?php echo JHtml::fetch('vaphtml.admin.sort', 'VAPMANAGEGROUP1', 'a.id', $this->orderDir, $this->ordering); ?>
156 </th>
157
158 <!-- APPLICATION -->
159
160 <th class="<?php echo $vik->getAdminThClass('left'); ?>" width="15%" style="text-align: left;">
161 <?php echo JHtml::fetch('vaphtml.admin.sort', 'VAPMANAGEAPIUSER2', 'a.application', $this->orderDir, $this->ordering); ?>
162 </th>
163
164 <!-- USERNAME -->
165
166 <th class="<?php echo $vik->getAdminThClass('left hidden-phone'); ?>" width="15%" style="text-align: left;">
167 <?php echo JHtml::fetch('vaphtml.admin.sort', 'VAPMANAGEAPIUSER3', 'a.username', $this->orderDir, $this->ordering); ?>
168 </th>
169
170 <!-- CUSTOM -->
171
172 <?php
173 foreach ($columns as $k => $col)
174 {
175 ?>
176 <th data-id="<?php echo $this->escape($k); ?>" class="<?php echo $vik->getAdminThClass('left hidden-phone'); ?>">
177 <?php echo $col->th; ?>
178 </th>
179 <?php
180 }
181 ?>
182
183 <!-- IP RESTRICTIONS -->
184
185 <th class="<?php echo $vik->getAdminThClass('hidden-phone'); ?>" width="8%" style="text-align: center;">
186 <?php echo JText::translate('VAPMANAGEAPIUSER5'); ?>
187 </th>
188
189 <!-- STATUS -->
190
191 <th class="<?php echo $vik->getAdminThClass(); ?>" width="8%" style="text-align: center;">
192 <?php echo JText::translate('VAPACTIVE'); ?>
193 </th>
194
195 <!-- LOGS -->
196
197 <th class="<?php echo $vik->getAdminThClass(); ?>" width="8%" style="text-align: center;">
198 <?php echo JText::translate('VAPMANAGECRONJOB5'); ?>
199 </th>
200
201 <!-- LAST LOGIN -->
202
203 <th class="<?php echo $vik->getAdminThClass('left hidden-phone'); ?>" width="12%" style="text-align: left;">
204 <?php echo JHtml::fetch('vaphtml.admin.sort', 'VAPMANAGEAPIUSER7', 'a.last_login', $this->orderDir, $this->ordering); ?>
205 </th>
206
207 </tr>
208 <?php echo $vik->closeTableHead(); ?>
209
210 <?php
211 $kk = 0;
212 for ($i = 0; $i < count($rows); $i++)
213 {
214 $row = $rows[$i];
215
216 $ips = (array) json_decode($row['ips']);
217
218 $name = strlen($row['application']) ? $row['application'] : $row['username'];
219
220 ?>
221 <tr class="row<?php echo $kk; ?>">
222
223 <td>
224 <input type="checkbox" id="cb<?php echo $i;?>" name="cid[]" value="<?php echo $row['id']; ?>" onClick="<?php echo $vik->checkboxOnClick(); ?>">
225 </td>
226
227 <!-- ID -->
228
229 <td class="hidden-phone">
230 <?php echo $row['id']; ?>
231 </td>
232
233 <!-- APPLICATION -->
234
235 <td>
236 <div class="td-primary">
237 <?php
238 if ($canEdit)
239 {
240 ?>
241 <a href="index.php?option=com_vikappointments&amp;task=apiuser.edit&amp;cid[]=<?php echo $row['id']; ?>"><?php echo $name; ?></a>
242 <?php
243 }
244 else
245 {
246 echo $name;
247 }
248 ?>
249 </div>
250 </td>
251
252 <!-- USERNAME -->
253
254 <td class="hidden-phone">
255 <?php echo $row['username']; ?>
256 </td>
257
258 <!-- CUSTOM -->
259
260 <?php
261 foreach ($columns as $k => $col)
262 {
263 ?>
264 <td data-id="<?php echo $this->escape($k); ?>" class="hidden-phone">
265 <?php echo isset($col->td[$i]) ? $col->td[$i] : ''; ?>
266 </td>
267 <?php
268 }
269 ?>
270
271 <!-- IP RESTRICTIONS -->
272
273 <td style="text-align: center;" class="hidden-phone">
274 <?php
275 if ($ips)
276 {
277 ?>
278 <a href="javascript:void(0)">
279 <i class="fas fa-globe-americas big hasTooltip" title="<?php echo $this->escape(implode('<br />', $ips)); ?>"></i>
280 </a>
281 <?php
282 }
283 else
284 {
285 ?>
286 <a class="disabled">
287 <i class="fas fa-globe-americas big"></i>
288 </a>
289 <?php
290 }
291 ?>
292 </td>
293
294 <!-- STATUS -->
295
296 <td style="text-align: center;">
297 <?php echo JHtml::fetch('vaphtml.admin.stateaction', $row['active'], $row['id'], 'apiuser.activate', $canEditState); ?>
298 </td>
299
300 <!-- LOGS -->
301
302 <td style="text-align: center;">
303 <?php
304 if ($row['log'] !== null)
305 {
306 ?>
307 <a href="index.php?option=com_vikappointments&amp;view=apilogs&amp;id_login=<?php echo $row['id']; ?>">
308 <i class="fas fa-file-alt big"></i>
309 </a>
310 <?php
311 }
312 else
313 {
314 ?>
315 <a class="disabled">
316 <i class="fas fa-file-alt big"></i>
317 </a>
318 <?php
319 }
320 ?>
321 </td>
322
323 <!-- LAST LOGIN -->
324
325 <td class="hidden-phone">
326 <span style="float: left;margin-left: 10px;">
327 <?php
328 if ($row['last_login'] > 0)
329 {
330 echo JHtml::fetch('date.relative', $row['last_login'], null, null, JText::translate('DATE_FORMAT_LC2'));
331 }
332 else
333 {
334 echo JText::translate('VAPMANAGEAPIUSER10');
335 }
336 ?>
337 </span>
338
339 <span style="float: right;margin-right: 10px;">
340 <?php
341 if ($row['log'] === null && VAPDateHelper::isNull($row['last_login']))
342 {
343 // no activity
344 $color = '999';
345 }
346 else if ($row['log'] === null || $row['log']['status'])
347 {
348 // success
349 $color = '090';
350 }
351 else
352 {
353 // failure
354 $color = '900';
355 }
356 ?>
357
358 <i class="fas fa-circle big" style="color: #<?php echo $color; ?>;"></i>
359 </span>
360 </td>
361
362 </tr>
363 <?php
364 $kk = 1 - $kk;
365 }
366 ?>
367 </table>
368 <?php
369 }
370 ?>
371
372 <input type="hidden" name="boxchecked" value="0" />
373 <input type="hidden" name="task" value="" />
374 <input type="hidden" name="view" value="apiusers" />
375
376 <input type="hidden" name="filter_order" value="<?php echo $this->ordering; ?>" />
377 <input type="hidden" name="filter_order_Dir" value="<?php echo $this->orderDir; ?>" />
378
379 <?php echo JHtml::fetch('form.token'); ?>
380 <?php echo $this->navbut; ?>
381 </form>
382
383 <script>
384
385 jQuery(function($) {
386 VikRenderer.chosen('.btn-toolbar');
387 });
388
389 function clearFilters() {
390 jQuery('#vapkeysearch').val('');
391 jQuery('#vap-active-sel').updateChosen(-1);
392
393 document.adminForm.submit();
394 }
395
396 </script>
397