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 / site / layouts / timeline / dropdown.php
vikappointments / site / layouts / timeline Last commit date
default.php 5 days ago dropdown.php 5 days ago index.html 5 days ago ratesgrid.php 5 days ago seats.php 5 days ago table.php 5 days ago
dropdown.php
94 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 /**
15 * Layout variables
16 * -----------------
17 * @var VAPAvailabilityTimeline $timeline The timeline to render.
18 */
19 extract($displayData);
20
21 $time_format = VAPFactory::getConfig()->get('timeformat');
22
23 $tz = VikAppointments::getUserTimezone();
24
25 // get timeline date
26 $date = $timeline->getDate();
27
28 ?>
29
30 <!-- CHECKIN -->
31
32 <select id="vap-checkin-sel" onchange="checkinSelectValueChanged(this);">
33
34 <option></option>
35
36 <?php
37 $link = 0;
38 foreach ($timeline as $times)
39 {
40 $link++;
41 foreach ($times as $time)
42 {
43 if ($time->isAvailable())
44 {
45 // get hour and minutes
46 $hour = (int) $time->checkin('G');
47 $min = (int) $time->checkin('i');
48
49 /**
50 * Hide time slots that exceed the midnight.
51 * The "hidden" class should do the trick for select2 plugin.
52 *
53 * @since 1.6.2
54 */
55 $should_hide = $time->checkin('Y-m-d') != $date ? 'hidden' : '';
56 ?>
57 <option
58 value="<?php echo $time->checkin('Y-m-d H:i'); ?>"
59 class="<?php echo $should_hide; ?>"
60 data-hour="<?php echo $hour; ?>"
61 data-min="<?php echo $min; ?>"
62 data-link="<?php echo $link; ?>"
63 data-checkout="<?php echo $time->checkout('Y-m-d H:i'); ?>"
64 data-checkout-date="<?php echo $time->checkout($time_format, $tz); ?>"
65 ><?php echo $time->checkin($time_format, $tz); ?></option>
66 <?php
67 }
68 else
69 {
70 $link++;
71 }
72 }
73 }
74 ?>
75
76 </select>
77
78 <!-- CHECKOUT -->
79
80 <select id="vap-checkout-sel" disabled="disabled" style="margin-left: 10px;" onchange="checkoutSelectValueChanged(this);">
81 <option></option>
82 </select>
83
84 <script>
85
86 jQuery('#vap-checkin-sel, #vap-checkout-sel').select2({
87 minimumResultsForSearch: -1,
88 placeholder: '--',
89 allowClear: false,
90 width: 150,
91 });
92
93 </script>
94