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 / cities / tmpl / default.php
vikappointments / admin / views / cities / tmpl Last commit date
default.php 2 days ago index.html 2 days ago
default.php
314 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 "onDisplayViewCitiesList". 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":"onDisplayViewCitiesList","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":"onDisplayViewCitiesList","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":"onDisplayCitiesTableTH","type":"th"} -->
125
126 <!-- Define role to detect the supported hook -->
127 <!-- {"rule":"customizer","event":"onDisplayCitiesTableTD","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', 'VAPMANAGECITY1', 'c.city_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', 'VAPMANAGECITY2', 'c.city_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('VAPMANAGECITY3'); ?>
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 <!-- LATITUDE -->
169
170 <th class="<?php echo $vik->getAdminThClass('hidden-phone'); ?>" width="10%" style="text-align: center;">
171 <?php echo JText::translate('VAPMANAGECITY4'); ?>
172 </th>
173
174 <!-- LONGITUDE -->
175
176 <th class="<?php echo $vik->getAdminThClass('hidden-phone'); ?>" width="10%" style="text-align: center;">
177 <?php echo JText::translate('VAPMANAGECITY5'); ?>
178 </th>
179
180 <!-- STATUS -->
181
182 <th class="<?php echo $vik->getAdminThClass(); ?>" width="10%" style="text-align: center;">
183 <?php echo JText::translate('VAPMANAGECITY6'); ?>
184 </th>
185
186 </tr>
187 <?php echo $vik->closeTableHead(); ?>
188
189 <?php
190 for ($i = 0, $n = count($rows); $i < $n; $i++)
191 {
192 $row = $rows[$i];
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 <!-- NAME -->
201
202 <td style="text-align: left;">
203 <div class="td-primary">
204 <?php
205 if ($canEdit)
206 {
207 ?>
208 <a href="index.php?option=com_vikappointments&amp;task=city.edit&amp;cid[]=<?php echo $row['id']; ?>">
209 <?php echo $row['city_name']; ?>
210 </a>
211 <?php
212 }
213 else
214 {
215 echo $row['city_name'];
216 }
217 ?>
218 </div>
219 </td>
220
221 <!-- 2 CODE -->
222
223 <td style="text-align: center;">
224 <?php echo $row['city_2_code']; ?>
225 </td>
226
227 <!-- 3 CODE -->
228
229 <td style="text-align: center;" class="hidden-phone">
230 <?php echo $row['city_3_code']; ?>
231 </td>
232
233 <!-- CUSTOM -->
234
235 <?php
236 foreach ($columns as $k => $col)
237 {
238 ?>
239 <td data-id="<?php echo $this->escape($k); ?>" class="hidden-phone">
240 <?php echo isset($col->td[$i]) ? $col->td[$i] : ''; ?>
241 </td>
242 <?php
243 }
244 ?>
245
246 <!-- LATITUDE -->
247
248 <td style="text-align: center;">
249 <?php echo $row['latitude']; ?>
250 </td>
251
252 <!-- LONGITUDE -->
253
254 <td style="text-align: center;">
255 <?php echo $row['longitude']; ?>
256 </td>
257
258 <!-- STATUS -->
259
260 <td style="text-align: center;">
261 <?php echo JHtml::fetch('vaphtml.admin.stateaction', $row['published'], $row['id'], 'city.publish', $canEditState, array('id_state' => $filters['id_state'])); ?>
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="cities" />
275 <input type="hidden" name="import_args[id_country]" value="<?php echo $filters['id_country']; ?>" />
276 <input type="hidden" name="import_args[id_state]" value="<?php echo $filters['id_state']; ?>" />
277
278 <input type="hidden" name="boxchecked" value="0" />
279 <input type="hidden" name="task" value="" />
280 <input type="hidden" name="view" value="cities" />
281 <input type="hidden" name="id_state" value="<?php echo $filters['id_state']; ?>" />
282
283 <input type="hidden" name="filter_order" value="<?php echo $this->ordering; ?>" />
284 <input type="hidden" name="filter_order_Dir" value="<?php echo $this->orderDir; ?>" />
285
286 <?php echo JHtml::fetch('form.token'); ?>
287 <?php echo $this->navbut; ?>
288 </form>
289
290 <script>
291
292 jQuery(function($) {
293 VikRenderer.chosen('.btn-toolbar');
294 });
295
296 function clearFilters() {
297 jQuery('#vapkeysearch').val('');
298 jQuery('#vap-status-sel').updateChosen('');
299
300 document.adminForm.submit();
301 }
302
303 Joomla.submitbutton = function(task) {
304 if (task == 'import' || task == 'export') {
305 // populate view instead of task
306 document.adminForm.view.value = task;
307 task = '';
308 }
309
310 Joomla.submitform(task, document.adminForm);
311 }
312
313 </script>
314