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 / webhooks / tmpl / default.php
vikappointments / admin / views / webhooks / tmpl Last commit date
default.php 3 days ago index.html 3 days ago
default.php
339 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('bootstrap.tooltip', '.hasTooltip');
15 JHtml::fetch('formbehavior.chosen');
16 JHtml::fetch('vaphtml.assets.fontawesome');
17
18 $rows = $this->rows;
19
20 $filters = $this->filters;
21
22 $vik = VAPApplication::getInstance();
23
24 $user = JFactory::getUser();
25
26 $canEdit = $user->authorise('core.edit', 'com_vikappointments');
27 $canEditState = $user->authorise('core.edit.state', 'com_vikappointments');
28
29 $config = VAPFactory::getConfig();
30
31 $is_searching = $this->hasFilters();
32
33 /**
34 * Trigger event to display custom HTML.
35 * In case it is needed to include any additional fields,
36 * it is possible to create a plugin and attach it to an event
37 * called "onDisplayViewWebhooksList". The event method receives the
38 * view instance as argument.
39 *
40 * @since 1.7
41 */
42 $forms = $this->onDisplayListView($is_searching);
43
44 ?>
45
46 <form action="index.php?option=com_vikappointments" method="post" name="adminForm" id="adminForm">
47
48 <div class="btn-toolbar" style="height: 32px;">
49
50 <div class="btn-group pull-left input-append">
51 <input type="text" name="keys" id="vapkeysearch" size="32"
52 value="<?php echo $this->escape($filters['keys']); ?>" placeholder="<?php echo $this->escape(JText::translate('JSEARCH_FILTER_SUBMIT')); ?>" />
53
54 <button type="submit" class="btn">
55 <i class="fas fa-search"></i>
56 </button>
57 </div>
58
59 <!-- Define role to detect the supported hook -->
60 <!-- {"rule":"customizer","event":"onDisplayViewWebhooksList","type":"search","key":"search"} -->
61
62 <?php
63 // plugins can use the "search" key to introduce custom
64 // filters within the search bar
65 if (isset($forms['search']))
66 {
67 echo $forms['search'];
68 }
69 ?>
70
71 <div class="btn-group pull-left">
72 <button type="button" class="btn <?php echo ($is_searching ? 'btn-primary' : ''); ?>" onclick="vapToggleSearchToolsButton(this);">
73 <?php echo JText::translate('JSEARCH_TOOLS'); ?>&nbsp;<i class="fas fa-caret-<?php echo ($is_searching ? 'up' : 'down'); ?>" id="vap-tools-caret"></i>
74 </button>
75 </div>
76
77 <div class="btn-group pull-left">
78 <button type="button" class="btn" onclick="clearFilters();">
79 <?php echo JText::translate('JSEARCH_FILTER_CLEAR'); ?>
80 </button>
81 </div>
82
83 </div>
84
85 <div class="btn-toolbar" id="vap-search-tools" style="height: 32px;<?php echo ($is_searching ? '' : 'display: none;'); ?>">
86
87 <?php
88 $options = array(
89 JHtml::fetch('select.option', '', JText::translate('VAPFILTERSELECTSTATUS')),
90 JHtml::fetch('select.option', 1, JText::translate('JPUBLISHED')),
91 JHtml::fetch('select.option', 0, JText::translate('JUNPUBLISHED')),
92 );
93 ?>
94 <div class="btn-group pull-left">
95 <select name="status" id="vap-status-sel" class="<?php echo (strlen($filters['status']) ? 'active' : ''); ?>" onchange="document.adminForm.submit();">
96 <?php echo JHtml::fetch('select.options', $options, 'value', 'text', $filters['status']); ?>
97 </select>
98 </div>
99
100 <!-- Define role to detect the supported hook -->
101 <!-- {"rule":"customizer","event":"onDisplayViewWebhooksList","type":"search","key":"filters"} -->
102
103 <?php
104 // plugins can use the "filters" key to introduce custom
105 // filters within the search bar
106 if (isset($forms['filters']))
107 {
108 echo $forms['filters'];
109 }
110 ?>
111
112 </div>
113
114 <?php
115 if (count($rows) == 0)
116 {
117 echo $vik->alert(JText::translate('JGLOBAL_NO_MATCHING_RESULTS'));
118 }
119 else
120 {
121 /**
122 * Trigger event to display custom columns.
123 *
124 * @since 1.7
125 */
126 $columns = $this->onDisplayTableColumns();
127 ?>
128
129 <!-- Define role to detect the supported hook -->
130 <!-- {"rule":"customizer","event":"onDisplayWebhooksTableTH","type":"th"} -->
131
132 <!-- Define role to detect the supported hook -->
133 <!-- {"rule":"customizer","event":"onDisplayWebhooksTableTD","type":"td"} -->
134
135 <table cellpadding="4" cellspacing="0" border="0" width="100%" class="<?php echo $vik->getAdminTableClass(); ?>">
136
137 <?php echo $vik->openTableHead(); ?>
138 <tr>
139
140 <th width="1%">
141 <?php echo $vik->getAdminToggle(count($rows)); ?>
142 </th>
143
144 <!-- ID -->
145
146 <th class="<?php echo $vik->getAdminThClass('left hidden-phone nowrap'); ?>" width="1%" style="text-align: left;">
147 <?php echo JHtml::fetch('vaphtml.admin.sort', 'VAPMANAGESERVICE1', 'w.id', $this->orderDir, $this->ordering); ?>
148 </th>
149
150 <!-- NAME -->
151
152 <th class="<?php echo $vik->getAdminThClass('left'); ?>" width="20%" style="text-align: left;">
153 <?php echo JHtml::fetch('vaphtml.admin.sort', 'VAPMANAGESERVICE2', 'w.name', $this->orderDir, $this->ordering); ?>
154 </th>
155
156 <!-- HOOK -->
157
158 <th class="<?php echo $vik->getAdminThClass('left nowrap'); ?>" width="10%" style="text-align: left;">
159 <?php echo JText::translate('VAPWEBHOOKACTION'); ?>
160 </th>
161
162 <!-- STATUS -->
163
164 <th class="<?php echo $vik->getAdminThClass(); ?>" width="8%" style="text-align: center;">
165 <?php echo JText::translate('VAPMANAGESERVICE6'); ?>
166 </th>
167
168 <!-- CUSTOM -->
169
170 <?php
171 foreach ($columns as $k => $col)
172 {
173 ?>
174 <th data-id="<?php echo $this->escape($k); ?>" class="<?php echo $vik->getAdminThClass('left hidden-phone'); ?>">
175 <?php echo $col->th; ?>
176 </th>
177 <?php
178 }
179 ?>
180
181 <!-- CREATION DATE -->
182
183 <th class="<?php echo $vik->getAdminThClass('hidden-phone left'); ?>" width="10%" style="text-align: left;">
184 <?php echo JHtml::fetch('vaphtml.admin.sort', JText::translate('VAPMANAGEMEDIA14'), 'w.createdon', $this->orderDir, $this->ordering); ?>
185 </th>
186
187 <!-- MODIFICATION DATE -->
188
189 <th class="<?php echo $vik->getAdminThClass('hidden-phone left'); ?>" width="10%" style="text-align: left;">
190 <?php echo JHtml::fetch('vaphtml.admin.sort', JText::translate('VAPMANAGEMEDIA19'), 'w.modifiedon', $this->orderDir, $this->ordering); ?>
191 </th>
192
193 <!-- LAST PING -->
194
195 <th class="<?php echo $vik->getAdminThClass('hidden-phone left'); ?>" width="10%" style="text-align: left;">
196 <?php echo JHtml::fetch('vaphtml.admin.sort', JText::translate('VAPWEBHOOKLASTCALL'), 'w.lastping', $this->orderDir, $this->ordering); ?>
197 </th>
198
199 </tr>
200 <?php echo $vik->closeTableHead(); ?>
201
202 <?php
203 for ($i = 0, $n = count($rows); $i < $n; $i++)
204 {
205 $row = $rows[$i];
206 ?>
207 <tr class="row<?php echo ($i % 2); ?>">
208
209 <td>
210 <input type="checkbox" id="cb<?php echo $i;?>" name="cid[]" value="<?php echo $row['id']; ?>" onClick="<?php echo $vik->checkboxOnClick(); ?>">
211 </td>
212
213 <!-- ID -->
214
215 <td class="hidden-phone">
216 <?php echo $row['id']; ?>
217 </td>
218
219 <!-- NAME -->
220
221 <td>
222 <div class="td-primary">
223 <?php
224 if ($canEdit)
225 {
226 ?>
227 <a href="index.php?option=com_vikappointments&amp;task=webhook.edit&amp;cid[]=<?php echo $row['id']; ?>">
228 <?php echo $row['name']; ?>
229 </a>
230 <?php
231 }
232 else
233 {
234 echo $row['name'];
235 }
236 ?>
237 </div>
238
239 <div class="td-secondary">
240 <?php echo $row['url']; ?>
241 </div>
242 </td>
243
244 <!-- EVENT -->
245
246 <td class="nowrap">
247 <?php echo $row['hook']; ?>
248 </td>
249
250 <!-- STATUS -->
251
252 <td style="text-align: center;">
253 <?php echo JHtml::fetch('vaphtml.admin.stateaction', $row['published'], $row['id'], 'webhook.publish', $canEditState); ?>
254 </td>
255
256 <!-- CUSTOM -->
257
258 <?php
259 foreach ($columns as $k => $col)
260 {
261 ?>
262 <td data-id="<?php echo $this->escape($k); ?>" class="hidden-phone">
263 <?php echo isset($col->td[$i]) ? $col->td[$i] : ''; ?>
264 </td>
265 <?php
266 }
267 ?>
268
269 <!-- CREATION DATE -->
270
271 <td class="hidden-phone">
272 <?php echo JHtml::fetch('date', $row['createdon'], $config->get('dateformat') . ' ' . $config->get('timeformat')); ?>
273 </td>
274
275 <!-- MODIFICATION DATE -->
276
277 <td class="hidden-phone">
278 <?php
279 if (!VAPDateHelper::isNull($row['modifiedon']))
280 {
281 echo JHtml::fetch('date', $row['modifiedon'], $config->get('dateformat') . ' ' . $config->get('timeformat'));
282 }
283 else
284 {
285 echo '--';
286 }
287 ?>
288 </td>
289
290 <!-- LAST PING -->
291
292 <td class="hidden-phone">
293 <?php
294 if (!VAPDateHelper::isNull($row['lastping']))
295 {
296 echo JHtml::fetch('date', $row['lastping'], $config->get('dateformat') . ' ' . $config->get('timeformat'));
297 }
298 else
299 {
300 echo '--';
301 }
302 ?>
303 </td>
304
305 </tr>
306 <?php
307 }
308 ?>
309 </table>
310 <?php
311 }
312 ?>
313
314 <input type="hidden" name="boxchecked" value="0" />
315 <input type="hidden" name="task" value="" />
316 <input type="hidden" name="view" value="webhooks" />
317
318 <input type="hidden" name="filter_order" value="<?php echo $this->ordering; ?>" />
319 <input type="hidden" name="filter_order_Dir" value="<?php echo $this->orderDir; ?>" />
320
321 <?php echo JHtml::fetch('form.token'); ?>
322 <?php echo $this->navbut; ?>
323 </form>
324
325 <script>
326
327 jQuery(function($) {
328 VikRenderer.chosen('.btn-toolbar');
329 });
330
331 function clearFilters() {
332 jQuery('#vapkeysearch').val('');
333 jQuery('#vap-status-sel').updateChosen('');
334
335 document.adminForm.submit();
336 }
337
338 </script>
339