PluginProbe ʕ •ᴥ•ʔ
VikAppointments Services Booking Calendar / trunk
VikAppointments Services Booking Calendar vtrunk
trunk 1.2.17 1.2.18 1.2.19
vikappointments / admin / views / countries / tmpl / default.php
vikappointments / admin / views / countries / tmpl Last commit date
default.php 4 years ago index.html 4 years ago
default.php
322 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 "onDisplayViewCountriesList". 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":"onDisplayViewCountriesList","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":"onDisplayViewCountriesList","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":"onDisplayCountriesTableTH","type":"th"} -->
125
126 <!-- Define role to detect the supported hook -->
127 <!-- {"rule":"customizer","event":"onDisplayCountriesTableTD","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', 'VAPMANAGECOUNTRY1', 'c.country_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 JText::translate('VAPMANAGECOUNTRY2'); ?>
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('VAPMANAGECOUNTRY3'); ?>
153 </th>
154
155 <!-- PHONE PREFIX -->
156
157 <th class="<?php echo $vik->getAdminThClass('hidden-phone'); ?>" width="10%" style="text-align: center;">
158 <?php echo JHtml::fetch('vaphtml.admin.sort', 'VAPMANAGECOUNTRY4', 'c.phone_prefix', $this->orderDir, $this->ordering); ?>
159 </th>
160
161 <!-- CUSTOM -->
162
163 <?php
164 foreach ($columns as $k => $col)
165 {
166 ?>
167 <th data-id="<?php echo $this->escape($k); ?>" class="<?php echo $vik->getAdminThClass('left hidden-phone'); ?>">
168 <?php echo $col->th; ?>
169 </th>
170 <?php
171 }
172 ?>
173
174 <!-- STATES -->
175
176 <th class="<?php echo $vik->getAdminThClass('hidden-phone'); ?>" width="10%" style="text-align: center;">
177 <?php echo JHtml::fetch('vaphtml.admin.sort', 'VAPMENUSTATES', 'states_count', $this->orderDir, $this->ordering); ?>
178 </th>
179
180 <!-- STATUS -->
181
182 <th class="<?php echo $vik->getAdminThClass(); ?>" width="10%" style="text-align: center;">
183 <?php echo JText::translate('VAPMANAGECOUNTRY5'); ?>
184 </th>
185
186 <!-- FLAG -->
187
188 <th class="<?php echo $vik->getAdminThClass(); ?>" width="10%" style="text-align: center;">
189 <?php echo JText::translate('VAPMANAGECOUNTRY6'); ?>
190 </th>
191
192 </tr>
193 <?php echo $vik->closeTableHead(); ?>
194
195 <?php
196 for ($i = 0, $n = count($rows); $i < $n; $i++)
197 {
198 $row = $rows[$i];
199 ?>
200 <tr class="row<?php echo ($i % 2); ?>">
201
202 <td>
203 <input type="checkbox" id="cb<?php echo $i;?>" name="cid[]" value="<?php echo $row['id']; ?>" onClick="<?php echo $vik->checkboxOnClick(); ?>">
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=country.edit&amp;cid[]=<?php echo $row['id']; ?>">
215 <?php echo $row['country_name']; ?>
216 </a>
217 <?php
218 }
219 else
220 {
221 echo $row['country_name'];
222 }
223 ?>
224 </div>
225
226 <div class="btn-group">
227 <a href="index.php?option=com_vikappointments&amp;view=states&amp;id_country=<?php echo $row['id']; ?>" class="btn btn-mini">
228 <i class="fas fa-filter"></i>
229 <span class="hidden-phone"><?php echo JText::translate('VAP_DISPLAY_STATES'); ?></span>
230 </a>
231
232 <a href="index.php?option=com_vikappointments&amp;task=state.add&amp;id_country=<?php echo $row['id']; ?>" class="btn btn-mini">
233 <i class="fas fa-plus-circle"></i>
234 <span class="hidden-phone"><?php echo JText::translate('VAP_ADD_STATE'); ?></span>
235 </a>
236 </div>
237 </td>
238
239 <!-- 2 CODE -->
240
241 <td style="text-align: center;">
242 <?php echo $row['country_2_code']; ?>
243 </td>
244
245 <!-- 3 CODE -->
246
247 <td style="text-align: center;" class="hidden-phone">
248 <?php echo $row['country_3_code']; ?>
249 </td>
250
251 <!-- PHONE PREFIX -->
252
253 <td style="text-align: center;" class="hidden-phone">
254 <?php echo $row['phone_prefix']; ?>
255 </td>
256
257 <!-- CUSTOM -->
258
259 <?php
260 foreach ($columns as $k => $col)
261 {
262 ?>
263 <td data-id="<?php echo $this->escape($k); ?>" class="hidden-phone">
264 <?php echo isset($col->td[$i]) ? $col->td[$i] : ''; ?>
265 </td>
266 <?php
267 }
268 ?>
269
270 <!-- STATES -->
271
272 <td style="text-align: center;" class="hidden-phone">
273 <?php echo ($row['states_count'] > 0 ? $row['states_count'] : ''); ?>
274 </td>
275
276 <!-- STATUS -->
277
278 <td style="text-align: center;">
279 <?php echo JHtml::fetch('vaphtml.admin.stateaction', $row['published'], $row['id'], 'country.publish', $canEditState); ?>
280 </td>
281
282 <!-- FLAG -->
283
284 <td style="text-align: center;">
285 <img src="<?php echo VAPASSETS_URI . 'css/flags/' . strtolower($row['country_2_code']) . '.png'; ?>" />
286 </td>
287
288 </tr>
289 <?php
290 }
291 ?>
292 </table>
293 <?php
294 }
295 ?>
296
297 <input type="hidden" name="boxchecked" value="0" />
298 <input type="hidden" name="task" value="" />
299 <input type="hidden" name="view" value="countries" />
300
301 <input type="hidden" name="filter_order" value="<?php echo $this->ordering; ?>" />
302 <input type="hidden" name="filter_order_Dir" value="<?php echo $this->orderDir; ?>" />
303
304 <?php echo JHtml::fetch('form.token'); ?>
305 <?php echo $this->navbut; ?>
306 </form>
307
308 <script>
309
310 jQuery(function($) {
311 VikRenderer.chosen('.btn-toolbar');
312 });
313
314 function clearFilters() {
315 jQuery('#vapkeysearch').val('');
316 jQuery('#vap-status-sel').updateChosen('');
317
318 document.adminForm.submit();
319 }
320
321 </script>
322