PluginProbe ʕ •ᴥ•ʔ
VikAppointments Services Booking Calendar / trunk
VikAppointments Services Booking Calendar vtrunk
1.2.21 1.2.20 trunk 1.2.17 1.2.18 1.2.19
vikappointments / admin / views / backups / tmpl / default.php
vikappointments / admin / views / backups / tmpl Last commit date
default.php 4 years ago default_modal.php 4 years ago index.html 4 years ago
default.php
358 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 JHtml::fetch('vaphtml.assets.fontawesome');
16
17 $rows = $this->rows;
18
19 $filters = $this->filters;
20
21 $vik = VAPApplication::getInstance();
22
23 $is_searching = $this->hasFilters();
24
25 $date_time_format = JText::translate('DATE_FORMAT_LC3') . ' ' . preg_replace("/:i/", ':i:s', VAPFactory::getConfig()->get('timeformat'));
26
27 $canEdit = JFactory::getUser()->authorise('core.admin', 'com_vikappointments');
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 "onDisplayViewBackupsList". The event method receives the
34 * view instance as argument.
35 *
36 * @since 1.7.1
37 */
38 $forms = $this->onDisplayListView($is_searching);
39 ?>
40
41 <form action="index.php?option=com_vikappointments" method="post" name="adminForm" id="adminForm">
42
43 <div class="btn-toolbar" style="height: 32px;">
44
45 <div class="btn-group pull-left">
46 <?php echo $vik->calendar($filters['date'], 'date', 'vap-date-filter', null, array('onChange' => 'document.adminForm.submit();')); ?>
47 </div>
48
49 <!-- Define role to detect the supported hook -->
50 <!-- {"rule":"customizer","event":"onDisplayViewBackupsList","type":"search","key":"search"} -->
51
52 <?php
53 // plugins can use the "search" key to introduce custom
54 // filters within the search bar
55 if (isset($forms['search']))
56 {
57 echo $forms['search'];
58 }
59 ?>
60
61 <div class="btn-group pull-left">
62 <button type="button" class="btn <?php echo ($is_searching ? 'btn-primary' : ''); ?>" onclick="vapToggleSearchToolsButton(this);">
63 <?php echo JText::translate('JSEARCH_TOOLS'); ?>&nbsp;<i class="fas fa-caret-<?php echo ($is_searching ? 'up' : 'down'); ?>" id="vap-tools-caret"></i>
64 </button>
65 </div>
66
67 <div class="btn-group pull-left">
68 <button type="button" class="btn" onclick="clearFilters();">
69 <?php echo JText::translate('JSEARCH_FILTER_CLEAR'); ?>
70 </button>
71 </div>
72 </div>
73
74 <div class="btn-toolbar" id="vap-search-tools" style="height: 32px;<?php echo ($is_searching ? '' : 'display: none;'); ?>">
75
76 <?php
77 $options = array();
78 $options[] = JHtml::fetch('select.option', '', JText::translate('VAPFILTERSELECTTYPE'));
79
80 foreach ($this->exportTypes as $id => $handler)
81 {
82 $options[] = JHtml::fetch('select.option', $id, $handler->getName());
83 }
84 ?>
85 <div class="btn-group pull-left">
86 <select name="type" id="vap-type-sel" class="<?php echo (!empty($filters['type']) ? 'active' : ''); ?>" onchange="document.adminForm.submit();">
87 <?php echo JHtml::fetch('select.options', $options, 'value', 'text', $filters['type']); ?>
88 </select>
89 </div>
90
91 <!-- Define role to detect the supported hook -->
92 <!-- {"rule":"customizer","event":"onDisplayViewBackupsList","type":"search","key":"filters"} -->
93
94 <?php
95 // plugins can use the "filters" key to introduce custom
96 // filters within the search bar
97 if (isset($forms['filters']))
98 {
99 echo $forms['filters'];
100 }
101 ?>
102
103 </div>
104
105 <?php
106 if (count($rows) == 0)
107 {
108 echo $vik->alert(JText::translate('JGLOBAL_NO_MATCHING_RESULTS'));
109 }
110 else
111 {
112 /**
113 * Trigger event to display custom columns.
114 *
115 * @since 1.7.1
116 */
117 $columns = $this->onDisplayTableColumns();
118 ?>
119
120 <!-- Define role to detect the supported hook -->
121 <!-- {"rule":"customizer","event":"onDisplayBackupsTableTH","type":"th"} -->
122
123 <!-- Define role to detect the supported hook -->
124 <!-- {"rule":"customizer","event":"onDisplayBackupsTableTD","type":"td"} -->
125
126 <table cellpadding="4" cellspacing="0" border="0" width="100%" class="<?php echo $vik->getAdminTableClass(); ?>">
127 <?php echo $vik->openTableHead(); ?>
128 <tr>
129
130 <th width="1%">
131 <?php echo $vik->getAdminToggle(count($rows)); ?>
132 </th>
133
134 <!-- DATE -->
135
136 <th class="<?php echo $vik->getAdminThClass('left'); ?>" width="20%" style="text-align: left;">
137 <?php echo JHtml::fetch('vaphtml.admin.sort', 'VAPMANAGEREVIEW4', 'createdon', $this->orderDir, $this->ordering); ?>
138 </th>
139
140 <!-- TYPE -->
141
142 <th class="<?php echo $vik->getAdminThClass('left'); ?>" width="20%" style="text-align: left;">
143 <?php echo JText::translate('VAPBACKUPCONFIG1'); ?>
144 </th>
145
146 <!-- CUSTOM -->
147
148 <?php
149 foreach ($columns as $k => $col)
150 {
151 ?>
152 <th data-id="<?php echo $this->escape($k); ?>" class="<?php echo $vik->getAdminThClass('left hidden-phone'); ?>">
153 <?php echo $col->th; ?>
154 </th>
155 <?php
156 }
157 ?>
158
159 <!-- SIZE -->
160
161 <th class="<?php echo $vik->getAdminThClass('hidden-phone nowrap'); ?>" width="8%" style="text-align: center;">
162 <?php echo JHtml::fetch('vaphtml.admin.sort', 'VAPMANAGEMEDIA13', 'filesize', $this->orderDir, $this->ordering); ?>
163 </th>
164
165 <!-- RESTORE -->
166
167 <th class="<?php echo $vik->getAdminThClass('hidden-phone nowrap'); ?>" width="5%" style="text-align: center;">
168 <?php echo JText::translate('VAPRESTORE'); ?>
169 </th>
170
171 <!-- DOWNLOAD -->
172
173 <th class="<?php echo $vik->getAdminThClass('hidden-phone nowrap'); ?>" width="5%" style="text-align: center;">
174 <?php echo JText::translate('VAPDOWNLOAD'); ?>
175 </th>
176
177 </tr>
178 <?php echo $vik->closeTableHead(); ?>
179
180 <?php
181 for ($i = 0, $n = count($rows); $i < $n; $i++)
182 {
183 $row = $rows[$i];
184 ?>
185 <tr class="row<?php echo ($i % 2); ?>">
186
187 <td>
188 <input type="checkbox" id="cb<?php echo $i;?>" name="cid[]" value="<?php echo $this->escape($row->name); ?>" onClick="<?php echo $vik->checkboxOnClick(); ?>">
189 </td>
190
191 <!-- NAME -->
192
193 <td>
194 <?php echo JHtml::fetch('date', $row->date, $date_time_format); ?>
195 </td>
196
197 <!-- TYPE -->
198
199 <td>
200 <?php echo $row->type->name; ?>
201 </td>
202
203 <!-- CUSTOM -->
204
205 <?php
206 foreach ($columns as $k => $col)
207 {
208 ?>
209 <td data-id="<?php echo $this->escape($k); ?>" class="hidden-phone">
210 <?php echo isset($col->td[$i]) ? $col->td[$i] : ''; ?>
211 </td>
212 <?php
213 }
214 ?>
215
216 <!-- SIZE -->
217
218 <td style="text-align: center;" class="hidden-phone">
219 <?php echo JHtml::fetch('number.bytes', $row->size); ?>
220 </td>
221
222 <!-- RESTORE -->
223
224 <td style="text-align: center;" class="hidden-phone">
225 <?php
226 if ($canEdit)
227 {
228 ?>
229 <a href="<?php echo $vik->addUrlCSRF('index.php?option=com_vikappointments&task=backup.restore&cid[]=' . $this->escape($row->name), $xhtml = true); ?>" class="backup-restore-link">
230 <i class="fas fa-history big"></i>
231 </a>
232 <?php
233 }
234 else
235 {
236 ?>
237 <a href="javascript:void(0)" class="disabled">
238 <i class="fas fa-history big"></i>
239 </a>
240 <?php
241 }
242 ?>
243 </td>
244
245 <!-- DOWNLOAD -->
246
247 <td style="text-align: center;" class="hidden-phone">
248 <?php
249 if ($canEdit)
250 {
251 ?>
252 <a href="<?php echo $row->url; ?>">
253 <i class="fas fa-download big"></i>
254 </a>
255 <?php
256 }
257 else
258 {
259 ?>
260 <a href="javascript:void(0)" class="disabled">
261 <i class="fas fa-download big"></i>
262 </a>
263 <?php
264 }
265 ?>
266 </td>
267
268 </tr>
269 <?php
270 }
271 ?>
272 </table>
273 <?php
274 }
275 ?>
276
277 <input type="hidden" name="boxchecked" value="0" />
278 <input type="hidden" name="task" value="" />
279 <input type="hidden" name="view" value="backups" />
280
281 <input type="hidden" name="filter_order" value="<?php echo $this->escape($this->ordering); ?>" />
282 <input type="hidden" name="filter_order_Dir" value="<?php echo $this->escape($this->orderDir); ?>" />
283
284 <?php echo JHtml::fetch('form.token'); ?>
285 <?php echo $this->navbut; ?>
286 </form>
287
288 <?php
289 // load create modal content
290 echo JHtml::fetch(
291 'bootstrap.renderModal',
292 'jmodal-newbackup',
293 array(
294 'title' => JText::translate('VAPMAINTITLENEWBACKUP'),
295 'closeButton' => true,
296 'keyboard' => false,
297 'bodyHeight' => 80,
298 'width' => 60,
299 'footer' => '<button type="button" class="btn btn-success" data-role="backup.save">' . JText::translate('VAPSAVE') . '</button>',
300 ),
301 $this->loadTemplate('modal')
302 );
303
304 JText::script('VAPBACKUPRESTORECONF1');
305 JText::script('VAPBACKUPRESTORECONF2');
306 ?>
307
308 <script>
309
310 (function($) {
311 'use strict';
312
313 window['clearFilters'] = () => {
314 $('#vap-date-filter').val('');
315 $('#vap-type-sel').updateChosen('');
316
317 document.adminForm.submit();
318 }
319
320 Joomla.submitbutton = (task) => {
321 if (task === 'backup.add') {
322 vapOpenJModal('newbackup');
323 } else {
324 Joomla.submitform(task, document.adminForm);
325 }
326 }
327
328 $(function() {
329 VikRenderer.chosen('.btn-toolbar');
330
331 $('a.backup-restore-link').on('click', (event) => {
332 let r = confirm(Joomla.JText._('VAPBACKUPRESTORECONF1'));
333
334 if (!r) {
335 return false;
336 }
337
338 r = confirm(Joomla.JText._('VAPBACKUPRESTORECONF2'));
339
340 if (!r) {
341 return false
342 }
343
344 return true;
345 });
346 });
347 })(jQuery);
348
349 function vapOpenJModal(id, url, jqmodal) {
350 <?php echo $vik->bootOpenModalJS(); ?>
351 }
352
353 function vapCloseJModal(id) {
354 <?php echo $vik->bootDismissModalJS(); ?>
355 }
356
357 </script>
358