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