PluginProbe ʕ •ᴥ•ʔ
VikAppointments Services Booking Calendar / trunk
VikAppointments Services Booking Calendar vtrunk
trunk 1.2.17 1.2.18 1.2.19
vikappointments / admin / views / groups / tmpl / default.php
vikappointments / admin / views / groups / tmpl Last commit date
default.php 3 years ago index.html 6 years ago
default.php
387 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 $multi_lang = VikAppointments::isMultilanguage();
21
22 $canEdit = JFactory::getUser()->authorise('core.edit', 'com_vikappointments');
23 $canEditState = JFactory::getUser()->authorise('core.edit.state', 'com_vikappointments');
24 $canOrder = $this->ordering == 'g.ordering';
25
26 if ($canOrder && $canEditState)
27 {
28 $saveOrderingUrl = 'index.php?option=com_vikappointments&task=group.saveOrderAjax&tmpl=component';
29 JHtml::fetch('vaphtml.scripts.sortablelist', 'groupsList', 'adminForm', $this->orderDir, $saveOrderingUrl);
30 }
31
32 if ($this->pageType == 1)
33 {
34 $filterView = 'services';
35 $filterText = 'VAP_DISPLAY_N_SERVICES';
36 $addTask = 'service.add';
37 $addText = 'VAP_ADD_SERVICE';
38 }
39 else
40 {
41 $filterView = 'employees';
42 $filterText = 'VAP_DISPLAY_N_EMPLOYEES';
43 $addTask = 'employee.add';
44 $addText = 'VAP_ADD_EMPLOYEE';
45 }
46
47 $is_searching = $this->hasFilters();
48
49 /**
50 * Trigger event to display custom HTML.
51 * In case it is needed to include any additional fields,
52 * it is possible to create a plugin and attach it to an event
53 * called "onDisplayViewGroupsList". The event method receives the
54 * view instance as argument.
55 *
56 * @since 1.7
57 */
58 $forms = $this->onDisplayListView($is_searching, array('page' => $this->pageType == 1 ? 'services' : 'employees'));
59
60 ?>
61
62 <form action="index.php?option=com_vikappointments" method="post" name="adminForm" id="adminForm">
63
64 <div class="btn-toolbar vapgroup-keyfilter-block" id="filter-bar">
65
66 <div class="btn-group pull-left input-append">
67 <input type="text" name="keysearch" id="vapkeysearch" class="vapkeysearch" size="32"
68 value="<?php echo $this->escape($filters['keysearch']); ?>" placeholder="<?php echo $this->escape(JText::translate('JSEARCH_FILTER_SUBMIT')); ?>" />
69
70 <button type="submit" class="btn">
71 <i class="fas fa-search"></i>
72 </button>
73 </div>
74
75 <!-- Define role to detect the supported hook -->
76 <!-- {"rule":"customizer","event":"onDisplayViewGroupsList","type":"search","key":"search"} -->
77
78 <?php
79 // plugins can use the "search" key to introduce custom
80 // filters within the search bar
81 if (isset($forms['search']))
82 {
83 echo $forms['search'];
84 }
85
86 // in case a plugin needs to use the filter bar, display the button
87 if (isset($forms['filters']))
88 {
89 ?>
90 <div class="btn-group pull-left">
91 <button type="button" class="btn <?php echo ($is_searching ? 'btn-primary' : ''); ?>" onclick="vapToggleSearchToolsButton(this);">
92 <?php echo JText::translate('JSEARCH_TOOLS'); ?>&nbsp;<i class="fas fa-caret-<?php echo ($is_searching ? 'up' : 'down'); ?>" id="vap-tools-caret"></i>
93 </button>
94 </div>
95 <?php
96 }
97 ?>
98
99 <div class="btn-group pull-left">
100 <button type="button" class="btn" onclick="clearFilters();">
101 <?php echo JText::translate('JSEARCH_FILTER_CLEAR'); ?>
102 </button>
103 </div>
104
105 <div class="btn-group pull-right">
106 <a class="btn" href="index.php?option=com_vikappointments&view=groups&type=<?php echo ($this->pageType % 2) + 1; ?>">
107 <?php echo JText::translate('VAPGROUPSWITCHPAGE' . $this->pageType); ?>
108 </a>
109 </div>
110
111 </div>
112
113 <div class="btn-toolbar" id="vap-search-tools" style="height: 32px;<?php echo ($is_searching ? '' : 'display: none;'); ?>">
114
115 <!-- Define role to detect the supported hook -->
116 <!-- {"rule":"customizer","event":"onDisplayViewGroupsList","type":"search","key":"filters"} -->
117
118 <?php
119 // plugins can use the "filters" key to introduce custom
120 // filters within the search bar
121 if (isset($forms['filters']))
122 {
123 echo $forms['filters'];
124 }
125 ?>
126
127 </div>
128
129 <?php
130 if (count($rows) == 0)
131 {
132 echo $vik->alert(JText::translate('JGLOBAL_NO_MATCHING_RESULTS'));
133 }
134 else
135 {
136 /**
137 * Trigger event to display custom columns.
138 *
139 * @since 1.7
140 */
141 $columns = $this->onDisplayTableColumns();
142 ?>
143
144 <!-- Define role to detect the supported hook -->
145 <!-- {"rule":"customizer","event":"onDisplayGroupsTableTH","type":"th"} -->
146
147 <!-- Define role to detect the supported hook -->
148 <!-- {"rule":"customizer","event":"onDisplayGroupsTableTD","type":"td"} -->
149
150 <table cellpadding="4" cellspacing="0" border="0" width="100%" class="<?php echo $vik->getAdminTableClass(); ?>" id="groupsList">
151
152 <?php echo $vik->openTableHead(); ?>
153 <tr>
154
155 <th width="1%">
156 <?php echo $vik->getAdminToggle(count($rows)); ?>
157 </th>
158
159 <!-- ID -->
160
161 <th class="<?php echo $vik->getAdminThClass('left hidden-phone nowrap'); ?>" width="1%" style="text-align: left;">
162 <?php echo JHtml::fetch('vaphtml.admin.sort', 'VAPMANAGEGROUP1', 'g.id', $this->orderDir, $this->ordering); ?>
163 </th>
164
165 <!-- NAME -->
166
167 <th class="<?php echo $vik->getAdminThClass('left'); ?>" width="20%" style="text-align: left;">
168 <?php echo JHtml::fetch('vaphtml.admin.sort', 'VAPMANAGEGROUP2', 'g.name', $this->orderDir, $this->ordering); ?>
169 </th>
170
171 <!-- DESCRIPTION -->
172
173 <th class="<?php echo $vik->getAdminThClass('left hidden-phone'); ?>" width="45%" style="text-align: left;">
174 <?php echo JText::translate('VAPMANAGEGROUP3'); ?>
175 </th>
176
177 <!-- CUSTOM -->
178
179 <?php
180 foreach ($columns as $k => $col)
181 {
182 ?>
183 <th data-id="<?php echo $this->escape($k); ?>" class="<?php echo $vik->getAdminThClass('left hidden-phone'); ?>">
184 <?php echo $col->th; ?>
185 </th>
186 <?php
187 }
188 ?>
189
190 <!-- COUNT -->
191
192 <th class="<?php echo $vik->getAdminThClass(); ?>" width="10%" style="text-align: center;">
193 <?php
194 $title = JText::translate($this->pageType == 1 ? 'VAPMANAGEGROUP4' : 'VAPMANAGEGROUP5');
195
196 echo JHtml::fetch('vaphtml.admin.sort', $title, 'count', $this->orderDir, $this->ordering);
197 ?>
198 </th>
199
200 <!-- LANGUAGES -->
201
202 <?php
203 if ($multi_lang && $canEdit)
204 {
205 ?>
206 <th class="<?php echo $vik->getAdminThClass(); ?>" width="5%" style="text-align: center;">
207 <?php echo JText::translate('VAPLANGUAGES');?>
208 </th>
209 <?php
210 }
211 ?>
212
213 <!-- ORDERING -->
214
215 <th class="<?php echo $vik->getAdminThClass('hidden-phone nowrap'); ?>" width="1%" style="text-align: center;">
216 <?php echo JHtml::fetch('vaphtml.admin.sort', '<i class="fas fa-sort"></i>', 'g.ordering', $this->orderDir, $this->ordering); ?>
217 </th>
218
219 </tr>
220 <?php echo $vik->closeTableHead(); ?>
221
222 <?php
223 for ($i = 0, $n = count($rows); $i < $n; $i++)
224 {
225 $row = $rows[$i];
226
227 $desc = strip_tags((string) $row['description']);
228
229 if (strlen($desc) > 256)
230 {
231 $desc = trim(mb_substr($desc, 0, 250, 'UTF-8')) . "...";
232 }
233 ?>
234 <tr class="row<?php echo ($i % 2); ?>">
235
236 <td>
237 <input type="checkbox" id="cb<?php echo $i;?>" name="cid[]" value="<?php echo $row['id']; ?>" onClick="<?php echo $vik->checkboxOnClick(); ?>">
238 </td>
239
240 <!-- ID -->
241
242 <td class="hidden-phone">
243 <?php echo $row['id']; ?>
244 </td>
245
246 <!-- NAME -->
247
248 <td style="text-align: left;">
249 <div class="td-primary">
250 <?php
251 if ($canEdit)
252 {
253 ?>
254 <a href="index.php?option=com_vikappointments&amp;task=group.edit&amp;cid[]=<?php echo $row['id']; ?>&amp;type=<?php echo $this->pageType; ?>">
255 <?php echo $row['name']; ?>
256 </a>
257 <?php
258 }
259 else
260 {
261 echo $row['name'];
262 }
263 ?>
264 </div>
265
266 <div class="btn-group">
267 <?php
268 if ($row['count'])
269 {
270 ?>
271 <a href="index.php?option=com_vikappointments&amp;view=<?php echo $filterView; ?>&amp;id_group=<?php echo $row['id']; ?>" class="btn btn-mini">
272 <i class="fas fa-filter"></i>
273 <span class="hidden-phone"><?php echo JText::plural($filterText, $row['count']); ?></span>
274 </a>
275 <?php
276 }
277 ?>
278
279 <a href="index.php?option=com_vikappointments&amp;task=<?php echo $addTask; ?>&amp;id_group=<?php echo $row['id']; ?>" class="btn btn-mini">
280 <i class="fas fa-plus-circle"></i>
281 <span class="hidden-phone"><?php echo JText::translate($addText); ?></span>
282 </a>
283 </div>
284 </td>
285
286 <!-- DESCRIPTION -->
287
288 <td class="hidden-phone">
289 <?php echo $desc; ?>
290 </td>
291
292 <!-- CUSTOM -->
293
294 <?php
295 foreach ($columns as $k => $col)
296 {
297 ?>
298 <td data-id="<?php echo $this->escape($k); ?>" class="hidden-phone">
299 <?php echo isset($col->td[$i]) ? $col->td[$i] : ''; ?>
300 </td>
301 <?php
302 }
303 ?>
304
305 <!-- COUNT -->
306
307 <td style="text-align: center;">
308 <?php echo $row['count']; ?>
309 </td>
310
311 <!-- LANGUAGES -->
312
313 <?php
314 if ($multi_lang && $canEdit)
315 {
316 ?>
317 <td style="text-align: center;">
318 <a href="index.php?option=com_vikappointments&amp;view=langgroups&amp;id_group=<?php echo $row['id']; ?>&amp;type=<?php echo $this->pageType; ?>">
319 <?php
320 foreach ($row['languages'] as $lang)
321 {
322 echo ' ' . JHtml::fetch('vaphtml.site.flag', $lang) . ' ';
323 }
324 ?>
325 </a>
326 </td>
327 <?php
328 }
329 ?>
330
331 <!-- ORDERING -->
332
333 <td class="order nowrap center hidden-phone">
334 <?php echo JHtml::fetch('vaphtml.admin.sorthandle', $row['ordering'], $canEditState, $canOrder); ?>
335 </td>
336
337 </tr>
338 <?php
339 }
340 ?>
341 </table>
342 <?php
343 }
344 ?>
345
346 <!-- hidden input for import tool -->
347 <input type="hidden" name="import_type" value="<?php echo $this->pageType == 1 ? 'groups' : 'empgroups'; ?>" />
348 <input type="hidden" name="import_args[type]" value="<?php echo $this->pageType; ?>" />
349
350 <input type="hidden" name="boxchecked" value="0" />
351 <input type="hidden" name="task" value="" />
352 <input type="hidden" name="view" value="groups" />
353 <input type="hidden" name="type" value="<?php echo $this->pageType; ?>" />
354
355 <input type="hidden" name="filter_order" value="<?php echo $this->ordering; ?>" />
356 <input type="hidden" name="filter_order_Dir" value="<?php echo $this->orderDir; ?>" />
357
358 <?php echo JHtml::fetch('form.token'); ?>
359 <?php echo $this->navbut; ?>
360 </form>
361
362 <script>
363
364 (function($) {
365 'use strict';
366
367 window['clearFilters'] = () => {
368 $('#vapkeysearch').val('');
369
370 document.adminForm.submit();
371 }
372
373 $(function() {
374 Joomla.submitbutton = function(task) {
375 if (task == 'import' || task == 'export') {
376 // populate view instead of task
377 document.adminForm.view.value = task;
378 task = '';
379 }
380
381 Joomla.submitform(task, document.adminForm);
382 }
383 });
384 })(jQuery);
385
386 </script>
387