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 / managestatuscode / tmpl / default_publishing.php
vikappointments / admin / views / managestatuscode / tmpl Last commit date
default.php 2 days ago default_publishing.php 2 days ago default_roles.php 2 days ago default_status.php 2 days ago index.html 2 days ago
default_publishing.php
92 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 $status = $this->status;
15
16 $vik = VAPApplication::getInstance();
17
18 ?>
19
20 <!-- APPOINTMENTS - Checkbox -->
21
22 <?php
23 $yes = $vik->initRadioElement('', '', $status->appointments == 1);
24 $no = $vik->initRadioElement('', '', $status->appointments == 0);
25
26 echo $vik->openControl(JText::translate('VAPMENUTITLEHEADER2'));
27 echo $vik->radioYesNo('appointments', $yes, $no, false);
28 echo $vik->closeControl();
29 ?>
30
31 <!-- PACKAGES - Checkbox -->
32
33 <?php
34 $yes = $vik->initRadioElement('', '', $status->packages == 1);
35 $no = $vik->initRadioElement('', '', $status->packages == 0);
36
37 echo $vik->openControl(JText::translate('VAPMENUPACKAGES'));
38 echo $vik->radioYesNo('packages', $yes, $no, false);
39 echo $vik->closeControl();
40 ?>
41
42 <!-- SUBSCRIPTIONS - Checkbox -->
43
44 <?php
45 $yes = $vik->initRadioElement('', '', $status->subscriptions == 1);
46 $no = $vik->initRadioElement('', '', $status->subscriptions == 0);
47
48 echo $vik->openControl(JText::translate('VAPMENUSUBSCRIPTIONS'));
49 echo $vik->radioYesNo('subscriptions', $yes, $no, false);
50 echo $vik->closeControl();
51 ?>
52
53 <script>
54
55 jQuery(function($) {
56
57 // extend form validation by checking whether the user
58 // selected at least one of the available groups
59 validator.addCallback((form) => {
60 // get all group fields
61 const fields = $('input[name="appointments"]')
62 .add($('input[name="packages"]'))
63 .add($('input[name="subscriptions"]'));
64
65 let checked = false;
66
67 // look for a group selection
68 fields.each(function() {
69 if ($(this).is(':checkbox')) {
70 checked = checked || $(this).is(':checked');
71 } else {
72 checked = checked || ($(this).val() == 1);
73 }
74 });
75
76 if (!checked) {
77 // no selected groups, mark as invalid
78 form.setInvalid(fields);
79
80 return false;
81 }
82
83 // at least one selected, mark as valid
84 form.unsetInvalid(fields);
85
86 return true;
87 });
88
89 });
90
91 </script>
92