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 / coupongroups / tmpl / default.php
vikappointments / admin / views / coupongroups / tmpl Last commit date
default.php 4 days ago index.html 4 days ago
default.php
306 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 $rows = $this->rows;
15
16 $filters = $this->filters;
17
18 $vik = VAPApplication::getInstance();
19
20 $canEdit = JFactory::getUser()->authorise('core.edit', 'com_vikappointments');
21 $canEditState = JFactory::getUser()->authorise('core.edit.state', 'com_vikappointments');
22 $canOrder = $this->ordering == 'g.ordering';
23
24 if ($canOrder && $canEditState)
25 {
26 $saveOrderingUrl = 'index.php?option=com_vikappointments&task=coupongroup.saveOrderAjax&tmpl=component';
27 JHtml::fetch('vaphtml.scripts.sortablelist', 'coupongroupsList', 'adminForm', $this->orderDir, $saveOrderingUrl);
28 }
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 "onDisplayViewCoupongroupsList". 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 vapgroup-keyfilter-block" id="filter-bar">
48
49 <div class="btn-group pull-left input-append">
50 <input type="text" name="keysearch" id="vapkeysearch" class="vapkeysearch" size="32"
51 value="<?php echo $this->escape($filters['keysearch']); ?>" placeholder="<?php echo $this->escape(JText::translate('JSEARCH_FILTER_SUBMIT')); ?>" />
52
53 <button type="submit" class="btn">
54 <i class="fas fa-search"></i>
55 </button>
56 </div>
57
58 <!-- Define role to detect the supported hook -->
59 <!-- {"rule":"customizer","event":"onDisplayViewCoupongroupsList","type":"search","key":"search"} -->
60
61 <?php
62 // plugins can use the "search" key to introduce custom
63 // filters within the search bar
64 if (isset($forms['search']))
65 {
66 echo $forms['search'];
67 }
68
69 // in case a plugin needs to use the filter bar, display the button
70 if (isset($forms['filters']))
71 {
72 ?>
73 <div class="btn-group pull-left">
74 <button type="button" class="btn <?php echo ($is_searching ? 'btn-primary' : ''); ?>" onclick="vapToggleSearchToolsButton(this);">
75 <?php echo JText::translate('JSEARCH_TOOLS'); ?>&nbsp;<i class="fas fa-caret-<?php echo ($is_searching ? 'up' : 'down'); ?>" id="vap-tools-caret"></i>
76 </button>
77 </div>
78 <?php
79 }
80 ?>
81
82 <div class="btn-group pull-left">
83 <button type="button" class="btn" onclick="clearFilters();">
84 <?php echo JText::translate('JSEARCH_FILTER_CLEAR'); ?>
85 </button>
86 </div>
87
88 </div>
89
90 <div class="btn-toolbar" id="vap-search-tools" style="height: 32px;<?php echo ($is_searching ? '' : 'display: none;'); ?>">
91
92 <!-- Define role to detect the supported hook -->
93 <!-- {"rule":"customizer","event":"onDisplayViewCoupongroupsList","type":"search","key":"filters"} -->
94
95 <?php
96 // plugins can use the "filters" key to introduce custom
97 // filters within the search bar
98 if (isset($forms['filters']))
99 {
100 echo $forms['filters'];
101 }
102 ?>
103
104 </div>
105
106 <?php
107 if (count($rows) == 0)
108 {
109 echo $vik->alert(JText::translate('JGLOBAL_NO_MATCHING_RESULTS'));
110 }
111 else
112 {
113 /**
114 * Trigger event to display custom columns.
115 *
116 * @since 1.7
117 */
118 $columns = $this->onDisplayTableColumns();
119 ?>
120
121 <!-- Define role to detect the supported hook -->
122 <!-- {"rule":"customizer","event":"onDisplayCoupongroupsTableTH","type":"th"} -->
123
124 <!-- Define role to detect the supported hook -->
125 <!-- {"rule":"customizer","event":"onDisplayCoupongroupsTableTD","type":"td"} -->
126
127 <table cellpadding="4" cellspacing="0" border="0" width="100%" class="<?php echo $vik->getAdminTableClass(); ?>" id="coupongroupsList">
128
129 <?php echo $vik->openTableHead(); ?>
130 <tr>
131
132 <th width="1%">
133 <?php echo $vik->getAdminToggle(count($rows)); ?>
134 </th>
135
136 <!-- ID -->
137
138 <th class="<?php echo $vik->getAdminThClass('left hidden-phone nowrap'); ?>" width="1%" style="text-align: left;">
139 <?php echo JHtml::fetch('vaphtml.admin.sort', 'VAPMANAGEGROUP1', 'g.id', $this->orderDir, $this->ordering); ?>
140 </th>
141
142 <!-- NAME -->
143
144 <th class="<?php echo $vik->getAdminThClass('left'); ?>" width="20%" style="text-align: left;">
145 <?php echo JHtml::fetch('vaphtml.admin.sort', 'VAPMANAGEGROUP2', 'g.name', $this->orderDir, $this->ordering); ?>
146 </th>
147
148 <!-- DESCRIPTION -->
149
150 <th class="<?php echo $vik->getAdminThClass('left hidden-phone'); ?>" width="45%" style="text-align: left;">
151 <?php echo JText::translate('VAPMANAGEGROUP3'); ?>
152 </th>
153
154 <!-- CUSTOM -->
155
156 <?php
157 foreach ($columns as $k => $col)
158 {
159 ?>
160 <th data-id="<?php echo $this->escape($k); ?>" class="<?php echo $vik->getAdminThClass('left hidden-phone'); ?>">
161 <?php echo $col->th; ?>
162 </th>
163 <?php
164 }
165 ?>
166
167 <!-- COUNT -->
168
169 <th class="<?php echo $vik->getAdminThClass(); ?>" width="10%" style="text-align: center;">
170 <?php echo JHtml::fetch('vaphtml.admin.sort', JText::translate('VAPMENUCOUPONS'), 'count', $this->orderDir, $this->ordering); ?>
171 </th>
172
173 <!-- ORDERING -->
174
175 <th class="<?php echo $vik->getAdminThClass('hidden-phone nowrap'); ?>" width="1%" style="text-align: center;">
176 <?php echo JHtml::fetch('vaphtml.admin.sort', '<i class="fas fa-sort"></i>', 'g.ordering', $this->orderDir, $this->ordering); ?>
177 </th>
178
179 </tr>
180 <?php echo $vik->closeTableHead(); ?>
181
182 <?php
183 for ($i = 0, $n = count($rows); $i < $n; $i++)
184 {
185 $row = $rows[$i];
186
187 $desc = strip_tags((string) $row['description']);
188
189 if (strlen($desc) > 256)
190 {
191 $desc = mb_substr($desc, 0, 250, 'UTF-8') . "...";
192 }
193 ?>
194 <tr class="row<?php echo ($i % 2); ?>">
195
196 <td>
197 <input type="checkbox" id="cb<?php echo $i;?>" name="cid[]" value="<?php echo $row['id']; ?>" onClick="<?php echo $vik->checkboxOnClick(); ?>">
198 </td>
199
200 <!-- ID -->
201
202 <td class="hidden-phone">
203 <?php echo $row['id']; ?>
204 </td>
205
206 <!-- NAME -->
207
208 <td style="text-align: left;">
209 <div class="td-primary">
210 <?php
211 if ($canEdit)
212 {
213 ?>
214 <a href="index.php?option=com_vikappointments&amp;task=coupongroup.edit&amp;cid[]=<?php echo $row['id']; ?>">
215 <?php echo $row['name']; ?>
216 </a>
217 <?php
218 }
219 else
220 {
221 echo $row['name'];
222 }
223 ?>
224 </div>
225
226 <div class="btn-group">
227 <?php
228 if ($row['count'])
229 {
230 ?>
231 <a href="index.php?option=com_vikappointments&amp;view=coupons&amp;id_group=<?php echo $row['id']; ?>" class="btn btn-mini">
232 <i class="fas fa-filter"></i>
233 <span class="hidden-phone"><?php echo JText::plural('VAP_DISPLAY_N_COUPONS', $row['count']); ?></span>
234 </a>
235 <?php
236 }
237 ?>
238
239 <a href="index.php?option=com_vikappointments&amp;task=coupon.add&amp;id_group=<?php echo $row['id']; ?>" class="btn btn-mini">
240 <i class="fas fa-plus-circle"></i>
241 <span class="hidden-phone"><?php echo JText::translate('VAP_ADD_COUPON'); ?></span>
242 </a>
243 </div>
244 </td>
245
246 <!-- DESCRIPTION -->
247
248 <td class="hidden-phone">
249 <?php echo $desc; ?>
250 </td>
251
252 <!-- CUSTOM -->
253
254 <?php
255 foreach ($columns as $k => $col)
256 {
257 ?>
258 <td data-id="<?php echo $this->escape($k); ?>" class="hidden-phone">
259 <?php echo isset($col->td[$i]) ? $col->td[$i] : ''; ?>
260 </td>
261 <?php
262 }
263 ?>
264
265 <!-- COUNT -->
266
267 <td style="text-align: center;">
268 <?php echo $row['count']; ?>
269 </td>
270
271 <!-- ORDERING -->
272
273 <td class="order nowrap center hidden-phone">
274 <?php echo JHtml::fetch('vaphtml.admin.sorthandle', $row['ordering'], $canEditState, $canOrder); ?>
275 </td>
276
277 </tr>
278 <?php
279 }
280 ?>
281 </table>
282 <?php
283 }
284 ?>
285
286 <input type="hidden" name="boxchecked" value="0" />
287 <input type="hidden" name="task" value="" />
288 <input type="hidden" name="view" value="coupongroups" />
289
290 <input type="hidden" name="filter_order" value="<?php echo $this->ordering; ?>" />
291 <input type="hidden" name="filter_order_Dir" value="<?php echo $this->orderDir; ?>" />
292
293 <?php echo JHtml::fetch('form.token'); ?>
294 <?php echo $this->navbut; ?>
295 </form>
296
297 <script>
298
299 function clearFilters() {
300 jQuery('#vapkeysearch').val('');
301
302 document.adminForm.submit();
303 }
304
305 </script>
306